From: heltai Date: Tue, 23 Jul 2013 13:01:18 +0000 (+0000) Subject: Merged from mainline X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b2b1725a3a94e3a973cb2c9c77f956507c1b036;p=dealii-svn.git Merged from mainline git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@30130 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index b665897d70..04dba539c6 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: @@ -66,7 +68,10 @@ 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_deal_ii) INCLUDE(setup_compiler_flags) @@ -105,11 +110,11 @@ ENDFOREACH() INCLUDE(setup_finalize) -########################################################################### -# # -# Compilation and installation: # -# # -########################################################################### +######################################################################## +# # +# Compilation and installation: # +# # +######################################################################## MESSAGE(STATUS "") MESSAGE(STATUS "Configuring done. Proceed to target definitions now.") @@ -130,11 +135,6 @@ 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) - # # 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..1e0d8a1e9b 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 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..d8c275b578 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,8 +39,14 @@ # # Determine the Endianess of the platform: # -INCLUDE(TestBigEndian) -TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN) +IF(CMAKE_C_COMPILER_WORKS) + INCLUDE(TestBigEndian) + TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN) +ELSE() + MESSAGE(STATUS + "No suitable C compiler was found! Assuming little endian platform." + ) +ENDIF() IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) 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..25d54167f5 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") + SET(CMAKE_REQUIRED_LIBRARIES ${m_LIBRARY}) CHECK_CXX_SYMBOL_EXISTS("jn" "math.h" HAVE_JN) SET(CMAKE_REQUIRED_LIBRARIES) 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") # @@ -122,9 +130,9 @@ 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") diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index b33e40b11c..cf49fb0e57 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.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 bugs: # -# # -########################################################################### +######################################################################## +# # +# Check for various compiler bugs: # +# # +######################################################################## # @@ -96,38 +100,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 @@ -256,7 +228,7 @@ CHECK_CXX_SOURCE_COMPILES( explicit X(T) {} }; void f(X) {} - int main() { f(1) }; + int main() { f(1); } " DEAL_II_EXPLICIT_CONSTRUCTOR_BUG ) diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 206504899c..037af96e8c 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/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 -## -##### +## --------------------------------------------------------------------- # @@ -22,11 +24,11 @@ CONFIGURE_FILE( ) -########################################################################### -# # -# Setup and install the convenience macros: # -# # -########################################################################### +######################################################################## +# # +# Setup and install the convenience macros: # +# # +######################################################################## INSTALL(FILES ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake @@ -37,11 +39,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 @@ -136,11 +138,11 @@ INSTALL(FILES ) -########################################################################### -# # -# Configure and install the old Makefile configuration: # -# # -########################################################################### +######################################################################## +# # +# Configure and install the old Makefile configuration: # +# # +######################################################################## IF(DEAL_II_COMPONENT_COMPAT_FILES) @@ -241,7 +243,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() diff --git a/deal.II/cmake/config/Config.cmake.in b/deal.II/cmake/config/Config.cmake.in index c28eb39495..150793f5cc 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 ## +## ## +######################################################################## # @@ -108,13 +110,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@") @@ -126,6 +128,13 @@ SET(DEAL_II_USER_DEFINITIONS_DEBUG "@DEAL_II_USER_DEFINITIONS_DEBUG@") SET(DEAL_II_USER_DEFINITIONS_RELEASE "@DEAL_II_USER_DEFINITIONS_RELEASE@") +# +# Build a static executable: +# + +SET(DEAL_II_STATIC_EXECUTABLE "@DEAL_II_STATIC_EXECUTABLE@") + + # # Information about include directories and libraries # diff --git a/deal.II/cmake/configure/configure_1_lapack.cmake b/deal.II/cmake/configure/configure_1_lapack.cmake index 6445f6b1f1..a319fe155b 100644 --- a/deal.II/cmake/configure/configure_1_lapack.cmake +++ b/deal.II/cmake/configure/configure_1_lapack.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 lapack library: @@ -19,18 +21,62 @@ MACRO(FEATURE_LAPACK_FIND_EXTERNAL var) FIND_PACKAGE(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 + # + # 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() + + MARK_AS_ADVANCED( + atlas_LIBRARY + blas_LIBRARY + gslcblas_LIBRARY + lapack_LIBRARY + m_LIBRARY + ptf77blas_LIBRARY + ptlapack_LIBRARY + refblas_LIBRARY + reflapack_LIBRARY + ) + + IF(LAPACK_FOUND) + # + # 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 LAPACK_LIBRARIES ${${_lib}_LIBRARY}) + ENDIF() + ENDFOREACH() + SWITCH_LIBRARY_PREFERENCE() + SET(${var} TRUE) ENDIF() ENDMACRO() @@ -52,24 +98,29 @@ SET(DEAL_II_LAPACK_FUNCTIONS MACRO(CHECK_FOR_LAPACK_FUNCTIONS) SET(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES}) + ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") # - # 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}") + STRIP_FLAG(CMAKE_REQUIRED_FLAGS "-pthread") ENDMACRO() @@ -81,29 +132,12 @@ 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}") + ADD_FLAGS(DEAL_II_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") LIST(APPEND DEAL_II_EXTERNAL_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..85de2a41c2 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,7 +93,7 @@ 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}) INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH}) diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index f2df405156..8525ad770e 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,38 @@ # 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() + FIND_PACKAGE(Threads) + 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 +80,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: @@ -135,15 +165,6 @@ MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) 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 +189,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") + LIST(APPEND DEAL_II_EXTERNAL_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_metis.cmake b/deal.II/cmake/configure/configure_2_metis.cmake similarity index 51% rename from deal.II/cmake/configure/configure_metis.cmake rename to deal.II/cmake/configure/configure_2_metis.cmake index 14f76ca5f5..92a1f10880 100644 --- a/deal.II/cmake/configure/configure_metis.cmake +++ b/deal.II/cmake/configure/configure_2_metis.cmake @@ -1,19 +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 -## -##### +## --------------------------------------------------------------------- # -# Configuration for the netcdf library: +# Configuration for the metis library: # MACRO(FEATURE_METIS_FIND_EXTERNAL var) diff --git a/deal.II/cmake/configure/configure_petsc.cmake b/deal.II/cmake/configure/configure_2_petsc.cmake similarity index 66% rename from deal.II/cmake/configure/configure_petsc.cmake rename to deal.II/cmake/configure/configure_2_petsc.cmake index eaad928c7d..a78757796a 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: @@ -45,7 +47,7 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) # Petsc has to be configured with the same MPI configuration as # deal.II. # - # petscconf.h should export PETSC_HAVE_MPIUNI 1 in case mpi support is + # petscconf.h should export PETSC_HAVE_MPIUNI 1 in case mpi support is # _NOT_ enabled. # So we check for this: # @@ -65,6 +67,33 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() + + # + # Petsc has to be configured with the same number of bits for indices as + # deal.II. + # + # petscconf.h should export PETSC_WITH_64BIT_INDICES 1 in case 64bits + # indices support is enabled. + # So we check for this: + # + IF( (NOT PETSC_WITH_64BIT_INDICES AND DEAL_II_WITH_64BIT_INDICES) + OR + (PETSC_WITH_64BIT_INDICES AND NOT DEAL_II_WITH_64BIT_INDICES)) + MESSAGE(STATUS "Could not find a sufficient PETSc installation: " + "PETSc has to be configured to use the same number of bits for the " + "global indices as deal.II." + ) + SET(PETSC_ADDITIONAL_ERROR_STRING + ${PETSC_ADDITIONAL_ERROR_STRING} + "Could not find a sufficient PETSc installation:\n" + "PETSc has to be configured to use the same number of bits for the " + "global indices as deal.II, but found:\n" + " DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n" + " PETSC_WITH_64BIT_INDICES = (${PETSC_WITH_64BIT_INDICES})\n" + ) + SET(${var} FALSE) + ENDIF() + IF(NOT ${var}) UNSET(PETSC_INCLUDE_DIR_ARCH CACHE) UNSET(PETSC_INCLUDE_DIR_COMMON CACHE) @@ -80,13 +109,6 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) 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}) diff --git a/deal.II/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake similarity index 74% rename from deal.II/cmake/configure/configure_trilinos.cmake rename to deal.II/cmake/configure/configure_2_trilinos.cmake index 346d2165fb..41a5f93bf5 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: @@ -115,9 +117,47 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() + # + # Trilinos has to be configured with 32bit indices if deal.II uses unsigned long + # long int. + # + IF(TRILINOS_WITH_NO_32BIT_INDICES AND NOT DEAL_II_WITH_64BIT_INDICES) + MESSAGE(STATUS "deal.II was configured to use 32bit 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_32BIT_INDICES = ${TRILINOS_WITH_NO_32_BIT_INDICES}\n" + ) + SET(${var} FALSE) + ENDIF() # - # Some verions of Sacado_cmath.hpp does things that aren't compatible + # Trilinos has to be configured with 64bit indices if deal.II uses unsigned long + # long int. + # + 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" + ) + SET(${var} FALSE) + 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 # @@ -177,15 +217,6 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) 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... @@ -200,13 +231,7 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL) # 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} - ) + LIST(APPEND DEAL_II_EXTERNAL_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..7d017236b4 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: @@ -35,21 +37,39 @@ 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(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) + IF( Boost_SERIALIZATION_FOUND AND Boost_SYSTEM_FOUND AND (NOT DEAL_II_WITH_THREADS OR Boost_THREAD_FOUND) ) SET(${var} TRUE) - MARK_AS_ADVANCED(Boost_DIR) 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..d46c23409b 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: diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake index 3757724b59..f4a9a27446 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: 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..3773a88b12 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: diff --git a/deal.II/cmake/configure/configure_slepc.cmake b/deal.II/cmake/configure/configure_slepc.cmake index cc1ff2b65e..269f85daa1 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: 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_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..0ae79de3c0 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: @@ -143,16 +145,16 @@ MACRO(FEATURE_CONFIGURE_EXTERNAL _feature) LIST(APPEND DEAL_II_EXTERNAL_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_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake index 6aa654d35b..bcd842eb09 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,34 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES) ENDIF() # - # Bail out if build type is unknown... - # - 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" - ) - ENDIF() - # - # ... or unsupported + # Reset build type if 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" + 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}\". +# +###" + ) + 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..a895702cd6 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 @@ -81,22 +83,22 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) 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" - ) + ADD_CUSTOM_TARGET(debug + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMENT "Switch CMAKE_BUILD_TYPE to Debug" + ) + + ADD_CUSTOM_TARGET(release + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + 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 - "${_switch_targets}# $ make release - to switch the build type to \"Release\"\n" +"# $ make debug - to switch the build type to \"Debug\" +# $ make release - to switch the build type to \"Release\"\n" ) ENDIF() 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..e98bd25576 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 @@ -68,7 +70,7 @@ MACRO(DEAL_II_SETUP_TARGET _target) # # 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". + # considered a "debug" build. The rest is "optimized". # # Otherwise every build type that (case insensitively) matches "debug" is # considered a debug build. @@ -116,4 +118,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..0f4ef07e96 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 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..885b960f8c --- /dev/null +++ b/deal.II/cmake/macros/macro_enable_language_optional.cmake @@ -0,0 +1,66 @@ +## --------------------------------------------------------------------- +## $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) + # + # Run this check exactly once: + # + IF(NOT ${_language}_CHECKED) + 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") + ENABLE_LANGUAGE(${_language}) + ELSE() + MESSAGE(STATUS "No working ${_language} compiler found, disabling ${_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..5516eb01de 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 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_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 index c39c5fb4c5..dd05b98c9c 100644 --- a/deal.II/cmake/macros/macro_split_debug_release.cmake +++ b/deal.II/cmake/macros/macro_split_debug_release.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 -## -##### +## --------------------------------------------------------------------- # 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..243899b9e0 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 @@ -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/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..f0cfa9eba7 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 @@ -26,8 +28,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,13 +51,37 @@ 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}) # @@ -67,11 +95,7 @@ IF(METIS_FOUND) REGEX "METIS_VER_MINOR") STRING(REGEX REPLACE "^.*METIS_VER_MINOR.* ([0-9]+).*" "\\1" METIS_MINOR "${METIS_MINOR_STRING}") - 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 0c3bcf2952..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 @@ -62,7 +61,7 @@ FIND_LIBRARY(MUMPS_COMMON_LIBRARY # If we can find libport.so (or similiar), link it in as well: # FIND_LIBRARY(PORD_LIBRARY - NAMES port + NAMES pord HINTS ${MUMPS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib @@ -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} @@ -89,19 +95,16 @@ IF(MUMPS_FOUND) SET(MUMPS_LIBRARIES ${DMUMPS_LIBRARY} ${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..06e031198a 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 @@ -82,16 +84,26 @@ FIND_LIBRARY(SC_LIBRARY SET(_output ${P4EST_LIBRARY} ${SC_LIBRARY}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG + _output # Cosmetic: Gives nice output P4EST_LIBRARY SC_LIBRARY P4EST_INCLUDE_DIR SC_INCLUDE_DIR ) +MARK_AS_ADVANCED( + P4EST_LIBRARY + P4EST_INCLUDE_DIR + SC_LIBRARY + SC_INCLUDE_DIR + ) + IF(P4EST_FOUND) SET(P4EST_LIBRARIES ${P4EST_LIBRARY} ${SC_LIBRARY} + ${LAPACK_LIBRARIES} # for good measure + ${MPI_C_LIBRARIES} # for good measure ) SET(P4EST_INCLUDE_DIRS ${P4EST_INCLUDE_DIR} @@ -109,13 +121,7 @@ IF(P4EST_FOUND) SET(P4EST_WITH_MPI TRUE) ENDIF() - MARK_AS_ADVANCED( - P4EST_DIR - P4EST_LIBRARY - P4EST_INCLUDE_DIR - SC_LIBRARY - SC_INCLUDE_DIR - ) + 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 e61211b6f0..119fa42026 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 @@ -26,6 +28,7 @@ # PETSC_VERSION_SUBMINOR # PETSC_VERSION_PATCH # PETSC_WITH_MPIUNI +# PETSC_WITH_64BIT_INDICES # INCLUDE(FindPackageHandleStandardArgs) @@ -51,8 +54,8 @@ FIND_LIBRARY(PETSC_LIBRARY FIND_FILE(PETSC_PETSCVARIABLES NAMES petscvariables HINTS - ${PETSC_DIR} ${PETSC_DIR}/${PETSC_ARCH} + ${PETSC_DIR} PATH_SUFFIXES conf ) @@ -74,7 +77,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}}) @@ -129,6 +132,14 @@ 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} @@ -153,6 +164,17 @@ IF(PETSC_FOUND) SET(PETSC_WITH_MPIUNI TRUE) ENDIF() + # + # Is petsc compiled with support for 64BIT_INDICES? + # + FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_64BIT_INDICES_STRING + REGEX "#define.*PETSC_USE_64BIT_INDICES 1") + IF("${PETSC_64BIT_INDICES_STRING}" STREQUAL "") + SET(PETSC_WITH_64BIT_INDICES FALSE) + ELSE() + SET(PETSC_WITH_64BIT_INDICES TRUE) + ENDIF() + FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MAJOR_STRING REGEX "#define.*PETSC_VERSION_MAJOR") STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1" @@ -179,15 +201,7 @@ IF(PETSC_FOUND) SET(PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}") - 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..4cd616dbae 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 @@ -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..ddb706d05b 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} @@ -113,13 +123,7 @@ IF(SLEPC_FOUND) SET(SLEPC_VERSION "${SLEPC_VERSION_MAJOR}.${SLEPC_VERSION_MINOR}.${SLEPC_VERSION_SUBMINOR}") - 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 0c30184f78..f5f8d2240d 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.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 Trilinos library @@ -76,11 +78,21 @@ FOREACH(_library ${Trilinos_LIBRARIES}) UNSET(TRILINOS_LIBRARY_${_library} CACHE) 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_DIR) + IF(TRILINOS_FOUND) # @@ -99,7 +111,7 @@ IF(TRILINOS_FOUND) TRILINOS_VERSION_SUBMINOR "${Trilinos_VERSION}") # - # Determine whether Trilinos was configured with MPI: + # Determine whether Trilinos was configured with MPI and 64bit indices: # FIND_FILE(EPETRA_CONFIG_H Epetra_config.h HINTS ${TRILINOS_INCLUDE_DIRS} @@ -117,16 +129,25 @@ IF(TRILINOS_FOUND) ELSE() SET(TRILINOS_WITH_MPI TRUE) ENDIF() + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_32BIT_STRING + REGEX "#define EPETRA_NO_32BIT_GLOBAL_INDICES") + IF("${EPETRA_64BIT_STRING}" STREQUAL "") + SET(TRILINOS_WITH_NO_32BITS_INDICES TRUE) + ELSE() + SET(TRILINOS_WITH_NO_32BITS_INDICES FALSE) + ENDIF() + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_64BIT_STRING + REGEX "#define EPETRA_NO_64BIT_GLOBAL_INDICES") + IF("${EPETRA_64BIT_STRING}" STREQUAL "") + SET(TRILINOS_WITH_NO_64BITS_INDICES TRUE) + ELSE() + SET(TRILINOS_WITH_NO_64BITS_INDICES FALSE) + ENDIF() UNSET(EPETRA_CONFIG_H CACHE) - MARK_AS_ADVANCED( - TRILINOS_DIR - TRILINOS_CONFIG_DIR - ) - + MARK_AS_ADVANCED(TRILINOS_DIR) ELSE() - SET(TRILINOS_DIR "" CACHE PATH "An optional hint to a Trilinos installation" ) diff --git a/deal.II/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake index 029e8708db..378b68cb56 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 @@ -35,6 +37,7 @@ ENDFOREACH() # now. # FIND_PACKAGE(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..5ac93c43cc 100644 --- a/deal.II/cmake/scripts/CMakeLists.txt +++ b/deal.II/cmake/scripts/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 -## -##### +## --------------------------------------------------------------------- ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc) IF(NOT CMAKE_CROSSCOMPILING) @@ -49,12 +51,31 @@ 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) 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 6e9570453f..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; @@ -166,4 +169,7 @@ std::cout << "dealii-feature: BOOST=" std::cout << "dealii-feature: LibZ=yes" << std::endl; #endif +#ifdef DEAL_II_WITH_64BIT_INDICES + std::cout << "dealii-feature: 64bit_indices=yes" < -## 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,30 +32,33 @@ # # 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_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) +# (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 @@ -108,23 +113,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: @@ -147,10 +140,46 @@ IF( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND ) ENDIF() + +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) + 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 @@ -161,6 +190,18 @@ 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. +# +OPTION(DEAL_II_WITH_64BIT_INDICES + "If set to ON, then use 64-bit data types to represent global degree of freedom indices. The default is to OFF. You only want to set this to ON if you will solve problems with more than 2^31 (approximately 2 billion) unknowns. If set to ON, you also need to ensure that both Trilinos and/or PETSc support 64-bit indices." + OFF + ) + + + # # Tell the user very prominently, that we're doing things differently w.r.t # CMAKE_(C|CXX)_FLAGS_(DEBUG|RELEASE) @@ -191,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 @@ -204,13 +250,12 @@ 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}) @@ -236,41 +281,38 @@ FOREACH(_flag ${DEAL_II_USED_FLAGS}) MARK_AS_ADVANCED(${_flag}) 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}) -########################################################################### -# # -# Miscellanious 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) @@ -280,7 +322,9 @@ FOREACH(_var ${_res}) # If DEAL_II_FORCE_AUTODETECTION is set undefine all feature toggles # DEAL_II_WITH_* prior to configure: # - IF(DEAL_II_FORCE_AUTODETECTION AND _var MATCHES "^DEAL_II_WITH_") + IF(DEAL_II_FORCE_AUTODETECTION AND _var MATCHES "^DEAL_II_WITH_" + # Exclude FEATURES that do not represent external libraries: + AND NOT _var MATCHES "^DEAL_II_WITH_64BIT_INDICES" ) UNSET(${_var} CACHE) ENDIF() ENDFOREACH() diff --git a/deal.II/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake index db784362b4..4815abf65f 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,36 +56,16 @@ # -########################################################################### -# # -# 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}") UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) ENDIF() @@ -104,25 +86,11 @@ IF(NOT DEAL_II_HAVE_USABLE_CXX_FLAGS) 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..63bf98e31a 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: @@ -79,6 +81,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 +102,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 +125,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 +144,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_O0) + 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..e08b7a382a 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,7 +104,7 @@ IF (CMAKE_BUILD_TYPE MATCHES "Release") # # General optimization flags: # - ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2") + ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O1") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-ip") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-loops") 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..931bf618f3 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 @@ -55,11 +57,11 @@ # *) 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 +85,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}") @@ -145,11 +147,11 @@ IF(CMAKE_BUILD_TYPE MATCHES "Release") ENDIF() -########################################################################### -# # -# Cleanup and Includes that have to happen after the call to PROJECT(): # -# # -########################################################################### +######################################################################## +# # +# Cleanup and setup that has to happen after the call to PROJECT(): # +# # +######################################################################## # # Cleanup some files used for storing the names of all object targets that @@ -164,6 +166,14 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ) ENDFOREACH() +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: @@ -180,5 +190,5 @@ IF(CMAKE_CROSSCOMPILING) 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) + 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 d30d86744e..e2f919a309 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... @@ -59,11 +61,11 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ENDFOREACH() -########################################################################### -# # -# 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 +101,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") @@ -189,6 +197,8 @@ FOREACH(_var ${_features}) ELSE() _both("# ${_var} set up with bundled packages\n") ENDIF() + ELSE() + _both("# ${_var} = ${${_var}}\n") ENDIF() ELSE() # FEATURE is disabled 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/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..1add7f46e0 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 diff --git a/deal.II/contrib/parameter_gui/parameter_delegate.h b/deal.II/contrib/parameter_gui/parameter_delegate.h index a4bcb2b98f..155fa8edaa 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 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..eeb7064928 100644 --- a/deal.II/doc/CMakeLists.txt +++ b/deal.II/doc/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 -## -##### +## --------------------------------------------------------------------- # @@ -44,6 +46,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..1af8db86d0 100644 --- a/deal.II/doc/authors.html +++ b/deal.II/doc/authors.html @@ -59,7 +59,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 +94,9 @@
  • Chih-Che Chueh: Step-43 tutorial program. +
  • Denis Davydov: + FEValuesExtractors::Tensor and associated functionality, various other changes. +
  • Kevin Dugan: Fixes in VectorTools::interpolate. @@ -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,11 @@ Packaging and configuration issues.
  • Bruno Turcksin: - Extending deal.ii for 64-bit integer support. + Extending deal.ii for 64-bit integer support, various other changes.
  • Kainan Wang: Extending deal.ii for 64-bit integer support. - +
  • Yaqi Wang: The step-28 tutorial program;   @@ -288,6 +293,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; diff --git a/deal.II/doc/development/Config.sample b/deal.II/doc/development/Config.sample index 528eb299e8..6f4ad89247 100644 --- a/deal.II/doc/development/Config.sample +++ b/deal.II/doc/development/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,26 +99,39 @@ # "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" # ) # +# SET(DEAL_II_WITH_64BIT_INDICES "OFF" CACHE BOOL +# "If set to ON, then use 64-bit data types to represent global degree of freedom indices. The default is to OFF. You only want to set this to ON if you will solve problems with more than 2^31 (approximately 2 billion) unknowns. If set to ON, you also need to ensure that both Trilinos and/or PETSc support 64-bit indices." +# ) +# +# ########################################################################### @@ -275,17 +292,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: # @@ -300,6 +323,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 "") +# +# # diff --git a/deal.II/doc/development/cmake-internals.html b/deal.II/doc/development/cmake-internals.html index a21b8f0b79..cacc2e4bbe 100644 --- a/deal.II/doc/development/cmake-internals.html +++ b/deal.II/doc/development/cmake-internals.html @@ -43,7 +43,6 @@
  • ./include/deal.II/base/config.h.in
  • ./source/CMakeLists.txt
  • ./cmake/config/CMakeLists.txt -
  • TODO @@ -110,7 +109,7 @@ PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION} - LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}" + LINK_FLAGS "${DEAL_II_LINKER_FLAGS_${build}}" COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}" COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}" ) @@ -177,15 +176,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 @@ -513,9 +512,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
  • @@ -601,10 +600,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
    +    # tradeoff 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 +622,7 @@
         #
         # A list of instantiations that must be expanded:
         #
    -    SET(inst_in_files
    +    SET(_inst
           ...
           dof_tools.inst.in
           )
    @@ -625,7 +635,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
    diff --git a/deal.II/doc/development/cmake.html b/deal.II/doc/development/cmake.html
    index e9e6643ea9..05fe95d6e9 100644
    --- a/deal.II/doc/development/cmake.html
    +++ b/deal.II/doc/development/cmake.html
    @@ -244,6 +244,7 @@
         DEAL_II_WITH_TRILINOS
         DEAL_II_WITH_UMFPACK
         DEAL_II_WITH_ZLIB
    +    DEAL_II_WITH_64BIT_INDICES
           
    They all have standard meaning with the exception of two: @@ -569,6 +570,19 @@ BUILD_SHARED_LIBS: If set (default), deal.II will be linked as a shared library +
  • + DEAL_II_PREFER_STATIC_LIBS (defaults to off): If set + to true, static archives will be preferred over dynamic libraries when + searching for features and corresponding link interface. + +
  • + DEAL_II_STATIC_EXECUTABLE (defaults to off): + If set to true, deal.II will be configured in + a way to provide a link interface that is suitable for static + linkage of executables. Enabling this option forces + BUILD_SHARED_LIBS=OFF and + DEAL_II_PERFER_STATIC_LIBS. +
  • CMAKE_INSTALL_RPATH_USE_LINK_PATH: If set (default), the deal.II library will be @@ -583,12 +597,12 @@

    Compilers can be switched either by command line or by setting - CMAKE_(C|CXX)_COMPILER: + CMAKE_(C|CXX|Fortran)_COMPILER:
     
          CC=mpicc CXX=mpicxx cmake <...>
     
    -     cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" <...>
    +     cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" -DCMAKE_Fortran_COMPILER="mpif90" <...>
           
    Please note that
      @@ -596,15 +610,15 @@ The compiler must be specified at the very first invokation of cmake.
    • - 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.

    - deal.II will configure sensible default CFLAGS and - CXXFLAGS depending on platform, compiler and build - target. There are two options to override this behaviour: + deal.II will configure sensible default CXXFLAGS + depending on platform, compiler and build target. There are two + options to override this behaviour:

    1. diff --git a/deal.II/doc/development/index.html b/deal.II/doc/development/index.html index e883492169..de8bad7977 100644 --- a/deal.II/doc/development/index.html +++ b/deal.II/doc/development/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/development/navbar.html index 82aa59cfce..fcfa429f45 100644 --- a/deal.II/doc/development/navbar.html +++ b/deal.II/doc/development/navbar.html @@ -14,8 +14,14 @@ <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> + + <p> + <a href="index.html" target="_top">Development</a><br /> </p> <hr> @@ -23,13 +29,14 @@ <b><small>Writing code</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.html" target="body">CMake documentation</a><br /> + <a href="cmakelists.html" target="body">CMake in user projects</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="../doxygen/deal.II/CodingConventions.html" target="body">Coding conventions</a><br /> </p> <hr> @@ -39,6 +46,8 @@ <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="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="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 /> </p> diff --git a/deal.II/doc/development/testsuite.html b/deal.II/doc/development/testsuite.html index 27b34d04ab..e101dcf7ed 100644 --- a/deal.II/doc/development/testsuite.html +++ b/deal.II/doc/development/testsuite.html @@ -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 diff --git a/deal.II/doc/doxygen/CMakeLists.txt b/deal.II/doc/doxygen/CMakeLists.txt index fcbda0eb42..beeb1046b6 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 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..999a97659e 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 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 new file mode 100644 index 0000000000..a4b5542416 --- /dev/null +++ b/deal.II/doc/doxygen/headers/global_dof_index.h @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + + +/** + * @page GlobalDoFIndex When to use types::global_dof_index instead of unsigned int + * + * When the 64-bits version of deal.II is used, it becomes necessary to + * declare as types::global_dof_index (unsigned long long int) instead of + * unsigned int. Here, we want to clarify when types::global_dof_index must be + * used. + * + * <dl> + * + * <dt class="glossary">@anchor GlobalDoFIndexBlockIndices + * <b>BlockIndices</b></dt> + * <dd> + * The number of blocks is an unsigned int because the number is expected to + * be low, i.e less than four billions. However, the size of the block is a + * types::global_dof_index because each block can be arbitrary large. + * </dd> + * + * <dt class="glossary">@anchor GlobalDoFIndexCell <b>Cell</b></dt> + * <dd> + * The ID of cell is not unique. Cells with different levels of refinement + * and/or on different processors can have the same ID. Thus, all the data + * associated to cells can be unsigned int. + * </dd> + * + * <dt class="glossary">@anchor GlobalDoFIndexDoFHandler + * <b>DoFHandler</b></dt> + * <dd> + * The ID of each degree of freedom is unique. Therefore, degrees of freedom + * are types::global_dof_index. + * </dd> + * + * <dt class="glossary">@anchor GlobalDoFIndexFullMatrix + * <b>FullMatrix</b></dt> + * <dd> + * The numbers of row and column are types::global_dof_index even if it is not + * expected that someone will create a FullMatrix with so many entries. + * However, ConstraintMatrix is templated on the matrix type and thus, the + * size of a FullMatrix has to be of the same type than the size of + * SparseMatrix. + * </dd> + * + * <dt class="glossary">@anchor GlobalDoFIndexSparseMatrix + * <b>SparseMatrix</b></dt> + * <dd> + * The size of SparseMatrix can be arbitrary large therefore, + * types::global_do_index is used. However, even for a large complex problem we + * 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. + * + * + */ diff --git a/deal.II/doc/doxygen/headers/glossary.h b/deal.II/doc/doxygen/headers/glossary.h index 688339494a..a84c1a6612 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 @@ -24,7 +27,10 @@ * <dl> * * <dt class="glossary">@anchor GlossActive <b>Active cells</b></dt> - * <dd>Mesh cells not refined any further in the hierarchy.</dd> + * <dd>A cell, face or edge is defined as <i>active</i> if it is not + * refined any further, i.e., if it does not have children. Unless + * working with a multigrid algorithm, active cells are the only + * ones carrying degrees of freedom.</dd> * * * 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..91e95805d0 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 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..9c24a2f7c5 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 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/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/mumps.html b/deal.II/doc/external-libs/mumps.html index ad74a1e469..6f26ade667 100644 --- a/deal.II/doc/external-libs/mumps.html +++ b/deal.II/doc/external-libs/mumps.html @@ -3,8 +3,8 @@ <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) $"> @@ -329,6 +329,7 @@ <p> You can override the autodetection by manually specifying <pre> + -DDEAL_II_WITH_MUMPS=OFF|ON </pre>. </p> diff --git a/deal.II/doc/external-libs/p4est.html b/deal.II/doc/external-libs/p4est.html index 6f24b8d7d8..735d088210 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,34 +23,38 @@ <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. 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> 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 f5ca147c63..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=OFF \ - -D CMAKE_INSTALL_PREFIX:PATH=/w/bangerth/share/x86_64/trilinos-10.12.2 \ - -D BUILD_SHARED_LIBS:BOOL=ON .. - - 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/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/navbar.html b/deal.II/doc/navbar.html index fcc7b54ec1..698b4cc17d 100644 --- a/deal.II/doc/navbar.html +++ b/deal.II/doc/navbar.html @@ -12,13 +12,18 @@ <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 /> - <a href="readme.html" target="body">README</a><br /> </p> <hr> + <p> + <a href="readme.html" target="body">README</a><br /> + + </p> + <hr> + <p> <a href="doxygen/tutorial/index.html" target="_top">Tutorial</a><br /> <a href="doxygen/deal.II/index.html" target="_top">Manual</a><br /> 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..c720497bb0 --- /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. <blink>TODO TODO TODO</blink> + </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 a29684ee60..59758c9601 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> @@ -25,35 +25,6 @@ inconvenience this causes. <ol> -<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> @@ -64,63 +35,6 @@ this function. <ol> - - <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. <blink>TODO TODO TODO</blink> - </ul> - <br> - (Matthias Maier, 2013/03/07) - </li> </ol> @@ -130,347 +44,6 @@ this function. <h3>Specific improvements</h3> <ol> -<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> </ol> diff --git a/deal.II/doc/news/news.html b/deal.II/doc/news/news.html index 21da046e26..79fa7929fb 100644 --- a/deal.II/doc/news/news.html +++ b/deal.II/doc/news/news.html @@ -32,17 +32,41 @@ <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>. + </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. + </dd> + + <dt> <strong>2013/03/07: Build system switched to CMake</strong> </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 diff --git a/deal.II/doc/publications/index.html b/deal.II/doc/publications/index.html index 77d0a3a83b..eea2a46b95 100644 --- a/deal.II/doc/publications/index.html +++ b/deal.II/doc/publications/index.html @@ -246,6 +246,38 @@ submitted, 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> G. Alam + <br> + <strong>Fast iterative solution of large scale statistical + inverse problems + </strong> + <br> + Master Thesis, Stockholm University, 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> 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 +287,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> + 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> - submitted, 2013. + 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 +317,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 +351,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 +411,33 @@ 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> 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 +462,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 +494,15 @@ 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> T. Kr&uuml;ger <br> <strong>Regularization-based fictitious domain methods @@ -357,6 +511,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 +540,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 +565,21 @@ 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. 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 +605,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 +648,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 @@ -479,21 +802,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 +841,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 +887,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 +904,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 +933,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 +987,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 +1032,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 +1135,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 +1307,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 +1879,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 +1887,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 +2459,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> diff --git a/deal.II/doc/readme.html b/deal.II/doc/readme.html index e80ebdac83..46a57e77da 100644 --- a/deal.II/doc/readme.html +++ b/deal.II/doc/readme.html @@ -225,7 +225,6 @@ 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 @@ -239,10 +238,12 @@ <li> <code>/path/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 <code>`pwd`/../installed/</code> (note the + backticks). <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 @@ -364,7 +365,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> @@ -414,6 +415,24 @@ <code>-DDEAL_II_COMPONENT_PARAMETER_GUI=ON</code>. Beware of the fact that <code>parameter_gui</code> needs development packages for Qt. </p> + + <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> + </ul> @@ -478,7 +497,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. @@ -502,7 +521,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 @@ -538,7 +557,7 @@ 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> @@ -577,7 +596,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 @@ -597,7 +616,7 @@ 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 + 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> @@ -629,7 +648,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 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. ## -## <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> -## -##### +## --------------------------------------------------------------------- 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..c887721bed 100644 --- a/deal.II/examples/step-1/step-1.cc +++ b/deal.II/examples/step-1/step-1.cc @@ -1,12 +1,19 @@ -/* $Id$ - * - * Copyright (C) 1999-2003, 2005-2007, 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) 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. +// +// --------------------------------------------------------------------- + // @sect3{Include files} diff --git a/deal.II/examples/step-10/step-10.cc b/deal.II/examples/step-10/step-10.cc index d9bf4843a7..ca6507013b 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-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. */ +// --------------------------------------------------------------------- +// $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 + */ + // The first of the following include files are probably well-known by now and // need no further explanation. diff --git a/deal.II/examples/step-11/step-11.cc b/deal.II/examples/step-11/step-11.cc index d27b6d1fda..c4f7647646 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-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. */ +// --------------------------------------------------------------------- +// $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 + */ + // As usual, the program starts with a rather long list of include files which // you are probably already used to by now: diff --git a/deal.II/examples/step-12/step-12.cc b/deal.II/examples/step-12/step-12.cc index 2ad4fc7d51..e50de11a6f 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/step-13.cc b/deal.II/examples/step-13/step-13.cc index 054b3b5f79..4334e90534 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, @@ -765,7 +774,7 @@ namespace Step13 // And while we're already computing things in parallel, interpolating // boundary values is one more thing that can be done independently, so // we do it here: - std::map<unsigned int,double> boundary_value_map; + std::map<types::global_dof_index,double> boundary_value_map; VectorTools::interpolate_boundary_values (dof_handler, 0, *boundary_values, @@ -807,7 +816,7 @@ namespace Step13 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); for (typename DoFHandler<dim>::active_cell_iterator cell=begin_cell; cell!=end_cell; ++cell) @@ -1026,7 +1035,7 @@ namespace Step13 Vector<double> cell_rhs (dofs_per_cell); std::vector<double> rhs_values (n_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = this->dof_handler.begin_active(), diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index 9536e7d82c..a8e2883368 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... @@ -554,7 +563,7 @@ namespace Step14 assemble_rhs (linear_system.rhs); linear_system.hanging_node_constraints.condense (linear_system.rhs); - std::map<unsigned int,double> boundary_value_map; + std::map<types::global_dof_index,double> boundary_value_map; VectorTools::interpolate_boundary_values (dof_handler, 0, *boundary_values, @@ -585,7 +594,7 @@ namespace Step14 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); for (typename DoFHandler<dim>::active_cell_iterator cell=begin_cell; cell!=end_cell; ++cell) @@ -806,7 +815,7 @@ namespace Step14 Vector<double> cell_rhs (dofs_per_cell); std::vector<double> rhs_values (n_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = this->dof_handler.begin_active(), diff --git a/deal.II/examples/step-15/step-15.cc b/deal.II/examples/step-15/step-15.cc index 098be10b69..4ec576c051 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} @@ -243,7 +252,7 @@ namespace Step15 std::vector<Tensor<1, dim> > old_solution_gradients(n_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -323,7 +332,7 @@ namespace Step15 hanging_node_constraints.condense (system_matrix); hanging_node_constraints.condense (system_rhs); - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, ZeroFunction<dim>(), @@ -464,12 +473,12 @@ namespace Step15 template <int dim> void MinimalSurfaceProblem<dim>::set_boundary_values () { - std::map<unsigned int, double> boundary_values; + std::map<types::global_dof_index, double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, BoundaryValues<dim>(), boundary_values); - for (std::map<unsigned int, double>::const_iterator + for (std::map<types::global_dof_index, double>::const_iterator p = boundary_values.begin(); p != boundary_values.end(); ++p) present_solution(p->first) = p->second; @@ -514,7 +523,7 @@ namespace Step15 Vector<double> cell_rhs (dofs_per_cell); std::vector<Tensor<1, dim> > gradients(n_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), diff --git a/deal.II/examples/step-16/step-16.cc b/deal.II/examples/step-16/step-16.cc index 8ebda66254..81e5ff040d 100644 --- a/deal.II/examples/step-16/step-16.cc +++ b/deal.II/examples/step-16/step-16.cc @@ -1,15 +1,25 @@ -/* 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-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* 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) 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. +// +// --------------------------------------------------------------------- + +/* + * Authors: Guido Kanschat, University of Heidelberg, 2003 + * Baerbel Janssen, University of Heidelberg, 2010 + * Wolfgang Bangerth, Texas A&M University, 2010 + */ + // As discussed in the introduction, most of this program is copied almost // verbatim from step-6, which itself is only a slight modification of @@ -367,7 +377,7 @@ namespace Step16 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const Coefficient<dim> coefficient; std::vector<double> coefficient_values (n_q_points); @@ -433,7 +443,7 @@ namespace Step16 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const Coefficient<dim> coefficient; std::vector<double> coefficient_values (n_q_points); diff --git a/deal.II/examples/step-17/step-17.cc b/deal.II/examples/step-17/step-17.cc index 9f7f7c6b14..43e274a2b6 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 @@ -298,7 +307,7 @@ namespace Step17 // While we're at it, let us also count how many degrees of freedom there // exist on the present process: - const unsigned int n_local_dofs + const types::global_dof_index n_local_dofs = DoFTools::count_dofs_with_subdomain_association (dof_handler, this_mpi_process); @@ -390,7 +399,7 @@ namespace Step17 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<double> lambda_values (n_q_points); std::vector<double> mu_values (n_q_points); @@ -503,8 +512,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: @@ -517,7 +526,7 @@ namespace Step17 // // However, we still have to apply boundary values, in the same way as we // always do: - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, ZeroFunction<dim>(dim), diff --git a/deal.II/examples/step-18/step-18.cc b/deal.II/examples/step-18/step-18.cc index 607d760ecb..34ed6cb280 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 @@ -512,12 +521,12 @@ namespace Step18 // Here is a vector where each entry denotes the numbers of degrees of // freedom that are stored on the processor with that particular number: - std::vector<unsigned int> local_dofs_per_process; + std::vector<types::global_dof_index> local_dofs_per_process; // Next, how many degrees of freedom the present processor stores. This // is, of course, an abbreviation to // <code>local_dofs_per_process[this_mpi_process]</code>. - unsigned int n_local_dofs; + types::global_dof_index n_local_dofs; // In the same direction, also cache how many cells the present processor // owns. Note that the cells that belong to a processor are not @@ -1050,7 +1059,7 @@ namespace Step18 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); BodyForce<dim> body_force; std::vector<Vector<double> > body_force_values (n_q_points, @@ -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 // <code>apply_boundary_values</code> function wants to have a solution @@ -1182,7 +1191,7 @@ namespace Step18 // for each vector component and because we only want to restrict vertical // motion, it has only its last component set: FEValuesExtractors::Scalar z_component (dim-1); - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools:: interpolate_boundary_values (dof_handler, 0, diff --git a/deal.II/examples/step-19/step-19.cc b/deal.II/examples/step-19/step-19.cc index cac451597d..6f8b667281 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} diff --git a/deal.II/examples/step-2/step-2.cc b/deal.II/examples/step-2/step-2.cc index ad6fd4a15e..1747f1db35 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-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. */ +// --------------------------------------------------------------------- +// $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 + */ + // The first few includes are just like in the previous program, so do not // require additional comments: diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index cea600c2d7..e71fa739e8 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} @@ -330,7 +340,7 @@ namespace Step20 // of pressure variables equals the number of shape functions that are // nonzero in the dim-th component. Let us compute these numbers and then // create some nice output with that: - std::vector<unsigned int> dofs_per_component (dim+1); + std::vector<types::global_dof_index> dofs_per_component (dim+1); DoFTools::count_dofs_per_component (dof_handler, dofs_per_component); const unsigned int n_u = dofs_per_component[0], n_p = dofs_per_component[dim]; @@ -422,7 +432,7 @@ namespace Step20 FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // The next step is to declare objects that represent the source term, // pressure boundary value, and coefficient in the equation. In addition diff --git a/deal.II/examples/step-21/step-21.cc b/deal.II/examples/step-21/step-21.cc index bd22cb396b..fbf4aee19e 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 part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any 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 + */ -/* $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. */ // 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 @@ -477,7 +487,7 @@ namespace Step21 void InverseMatrix<Matrix>::vmult (Vector<double> &dst, const Vector<double> &src) const { - SolverControl solver_control (std::max(src.size(), 200U), + SolverControl solver_control (std::max(src.size(), static_cast<std::size_t> (200)), 1e-8*src.l2_norm()); SolverCG<> cg (solver_control); @@ -606,7 +616,7 @@ namespace Step21 dof_handler.distribute_dofs (fe); DoFRenumbering::component_wise (dof_handler); - std::vector<unsigned int> dofs_per_component (dim+2); + std::vector<types::global_dof_index> dofs_per_component (dim+2); DoFTools::count_dofs_per_component (dof_handler, dofs_per_component); const unsigned int n_u = dofs_per_component[0], n_p = dofs_per_component[dim], @@ -704,7 +714,7 @@ namespace Step21 FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const PressureRightHandSide<dim> pressure_right_hand_side; const PressureBoundaryValues<dim> pressure_boundary_values; @@ -863,7 +873,7 @@ namespace Step21 std::vector<Vector<double> > present_solution_values_face(n_face_q_points, Vector<double>(dim+2)); std::vector<double> neighbor_saturation (n_face_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); SaturationBoundaryValues<dim> saturation_boundary_values; diff --git a/deal.II/examples/step-22/step-22.cc b/deal.II/examples/step-22/step-22.cc index 3e8f8563b5..1fcf3b5a3b 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} @@ -481,7 +490,7 @@ namespace Step22 // <code>DoFTools::count_dofs_per_block</code> does the same as // <code>DoFTools::count_dofs_per_component</code>, but now grouped as // velocity and pressure block via <code>block_component</code>. - std::vector<unsigned int> dofs_per_block (2); + std::vector<types::global_dof_index> dofs_per_block (2); DoFTools::count_dofs_per_block (dof_handler, dofs_per_block, block_component); const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1]; @@ -593,7 +602,7 @@ namespace Step22 FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const RightHandSide<dim> right_hand_side; std::vector<Vector<double> > rhs_values (n_q_points, diff --git a/deal.II/examples/step-23/step-23.cc b/deal.II/examples/step-23/step-23.cc index b8c35a0eb0..628f840f7a 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} @@ -542,7 +550,7 @@ namespace Step23 BoundaryValuesU<dim> boundary_values_u_function; boundary_values_u_function.set_time (time); - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, boundary_values_u_function, @@ -588,7 +596,7 @@ namespace Step23 BoundaryValuesV<dim> boundary_values_v_function; boundary_values_v_function.set_time (time); - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, boundary_values_v_function, diff --git a/deal.II/examples/step-24/step-24.cc b/deal.II/examples/step-24/step-24.cc index 45b3871515..ccf969d74d 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} @@ -346,7 +356,7 @@ namespace Step24 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); diff --git a/deal.II/examples/step-25/step-25.cc b/deal.II/examples/step-25/step-25.cc index 057371fa19..a03335ce34 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} @@ -413,7 +423,7 @@ namespace Step25 const unsigned int n_q_points = quadrature_formula.size(); Vector<double> local_nl_term (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<double> old_data_values (n_q_points); std::vector<double> new_data_values (n_q_points); @@ -475,7 +485,7 @@ namespace Step25 const unsigned int n_q_points = quadrature_formula.size(); FullMatrix<double> local_nl_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<double> old_data_values (n_q_points); std::vector<double> new_data_values (n_q_points); diff --git a/deal.II/examples/step-26/step-26.cc b/deal.II/examples/step-26/step-26.cc index 0d4da01968..23c2250e1e 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 <deal.II/base/utilities.h> #include <deal.II/base/quadrature_lib.h> @@ -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<dim> triangulation; FE_Q<dim> 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<dim>(fe.degree+1), mass_matrix, - (const Function<dim>*)0, + (const Function<dim> *)0, constraints); MatrixCreator::create_laplace_matrix(dof_handler, QGauss<dim>(fe.degree+1), laplace_matrix, - (const Function<dim>*)0, + (const Function<dim> *)0, constraints); solution.reinit(dof_handler.n_dofs()); @@ -291,7 +301,7 @@ namespace Step26 // too high a mesh level. template <int dim> void HeatEquation<dim>::refine_mesh (const unsigned int min_grid_level, - const unsigned int max_grid_level) + const unsigned int max_grid_level) { Vector<float> 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<dim>::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 (); @@ -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); @@ -434,7 +444,7 @@ start_time_iteration: BoundaryValues<dim> boundary_values_function; boundary_values_function.set_time(time); - std::map<unsigned int, double> boundary_values; + std::map<types::global_dof_index, double> boundary_values; VectorTools::interpolate_boundary_values(dof_handler, 0, boundary_values_function, @@ -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 2ebbd9fa4d..4f9bc6680f 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 - 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 + */ -/* $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. */ // @sect3{Include files} @@ -269,7 +279,7 @@ namespace Step27 FullMatrix<double> cell_matrix; Vector<double> cell_rhs; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; typename hp::DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), diff --git a/deal.II/examples/step-28/step-28.cc b/deal.II/examples/step-28/step-28.cc index 049d63568e..14ac1ba6be 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} @@ -492,7 +502,7 @@ namespace Step28 Vector<double> system_rhs; - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; ConstraintMatrix hanging_node_constraints; @@ -667,7 +677,7 @@ namespace Step28 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -743,7 +753,7 @@ namespace Step28 std::vector<double> extraneous_source_values (n_q_points); std::vector<double> solution_old_values (n_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -941,7 +951,7 @@ namespace Step28 prolongation_matrix.Tvmult_add (cell_rhs, tmp); } - std::vector<unsigned int> local_dof_indices (fe.dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (fe.dofs_per_cell); cell_g->get_dof_indices (local_dof_indices); for (unsigned int i=0; i<fe.dofs_per_cell; ++i) @@ -1580,7 +1590,7 @@ namespace Step28 template <int dim> void NeutronDiffusionProblem<dim>::refine_grid () { - std::vector<unsigned int> n_cells (parameters.n_groups); + std::vector<types::global_dof_index> n_cells (parameters.n_groups); for (unsigned int group=0; group<parameters.n_groups; ++group) n_cells[group] = energy_groups[group]->n_active_cells(); diff --git a/deal.II/examples/step-29/step-29.cc b/deal.II/examples/step-29/step-29.cc index b97a0558b7..d955cd261e 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} @@ -602,7 +611,7 @@ namespace Step29 // vector to transfer the cell contributions to the appropriate location // in the global system matrix after. FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -769,7 +778,7 @@ namespace Step29 // which is characterized by the boundary indicator 1. The Dirichlet // values are provided by the <code>DirichletBoundaryValues</code> class // we defined above: - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 1, DirichletBoundaryValues<dim>(), diff --git a/deal.II/examples/step-3/doc/intro.dox b/deal.II/examples/step-3/doc/intro.dox index ad3f4abe64..6286abe7bc 100644 --- a/deal.II/examples/step-3/doc/intro.dox +++ b/deal.II/examples/step-3/doc/intro.dox @@ -315,4 +315,72 @@ separation of functionality &mdash; again in many of the following tutorial programs. +<h3> A note on types </h3> + +deal.II defines a number of integral %types via <code>typedef</code>s 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 <i>global</i> 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 <i>locally on each cell</i> in 2d and 8 in 3d). Consequently, a data +type that allows to store sufficiently large numbers for global DoF indices is +<code>unsigned int</code> 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 <code>unsigned int</code> 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 <code>unsigned int</code> 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 <code>unsigned +int</code> whereas it is possible to define it as <code>unsigned long long +int</code> 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 <code>unsigned int</code> (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 <code>local_dof_indices</code> is declared as +@code + std::vector<types::global_dof_index> 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 +<code>typedef</code>s 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 <code>unsigned int</code> +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..c5d2e96c05 100644 --- a/deal.II/examples/step-3/doc/results.dox +++ b/deal.II/examples/step-3/doc/results.dox @@ -187,7 +187,7 @@ suggestions: <code>LaplaceProblem::LaplaceProblem</code>. <li>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 &mdash; 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 <code>LaplaceProblem::output_results</code>: @code diff --git a/deal.II/examples/step-3/step-3.cc b/deal.II/examples/step-3/step-3.cc index 7a991c7211..884be34c03 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 - 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. +// +// --------------------------------------------------------------------- -/* $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. */ +/* + * 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,8 +343,9 @@ 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: - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + // these numbers (see the discussion at the end of the introduction for + // the type, types::global_dof_index, used here): + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // Now for the loop over all cells. We have seen before how this works, so // this should be familiar including the conventional names for these @@ -458,7 +469,7 @@ void Step3::assemble_system () // their boundary values (which are zero here for all entries). This mapping // of DoF numbers to boundary values is done by the <code>std::map</code> // class. - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, ZeroFunction<2>(), diff --git a/deal.II/examples/step-30/step-30.cc b/deal.II/examples/step-30/step-30.cc index e9eeca97e6..5e50d7316a 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. @@ -426,8 +435,8 @@ namespace Step30 void DGMethod<dim>::assemble_system2 () { const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; - std::vector<unsigned int> dofs (dofs_per_cell); - std::vector<unsigned int> dofs_neighbor (dofs_per_cell); + std::vector<types::global_dof_index> dofs (dofs_per_cell); + std::vector<types::global_dof_index> dofs_neighbor (dofs_per_cell); const UpdateFlags update_flags = update_values | update_gradients diff --git a/deal.II/examples/step-31/doc/results.dox b/deal.II/examples/step-31/doc/results.dox index 9310d49090..55b0db1520 100644 --- a/deal.II/examples/step-31/doc/results.dox +++ b/deal.II/examples/step-31/doc/results.dox @@ -506,13 +506,16 @@ Again, small values of $\beta$ lead to less diffusion but we have to choose the time step very small to keep things under control. Too large values of $\beta$ make for more diffusion, but again require small time steps. The best value would appear to be $\beta=0.03$, as -for the $Q_1$ element, and the we have to choose +for the $Q_1$ element, and then we have to choose $k=\frac 18\frac{h_K}{\|\mathbf{u}\|_{L^\infty(K)}}$ &mdash; exactly 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 <i>grid point</i> away (which for $Q_1$ elements -is $h_K$, but for $Q_2$ elements is $h_K/2$). +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 +the simulation at times larger than 60, so we actually choose it as +$\beta = 0.034$ in the code. <h5>Results for 3d</h5> @@ -520,7 +523,7 @@ is $h_K$, but for $Q_2$ elements is $h_K/2$). One can repeat these experiments in 3d and find the optimal time step for each value of $\beta$ and find the best value of $\beta$. What one finds is that for the same $\beta$ already used in 2d, the time steps -needs to be a bit small, by around a factor of 1.2 or so. This is +needs to be a bit smaller, by around a factor of 1.2 or so. This is easily explained: the time step restriction is $k=\min_K \frac{ch_K}{\|\mathbf{u}\|_{L^\infty(K)}}$ where $h_K$ is the <i>diameter</i> of the cell. However, what is really needed is the @@ -537,28 +540,29 @@ can take. <h5>Conclusions</h5> -Concluding, from the simple computations above, $\beta=0.03$ appears to be a +Concluding, from the simple computations above, $\beta=0.034$ appears to be a good choice for the stabilization parameter in 2d, and $\beta=0.05$ in 3d. In -a dimension independent way, we can model this as $\beta=0.015d$. If one does +a dimension independent way, we can model this as $\beta=0.017d$. If one does longer computations (several thousand time steps) on finer meshes, one -realizes that that's not quite small enough and that for stability one will -have to reduce the above values a bit more (by about a factor of $\frac 78$). +realizes that the time step size is not quite small enough and that for +stability one will have to reduce the above values a bit more (by about a +factor of $\frac 78$). As a consequence, a formula that reconciles 2d, 3d, and variable polynomial degree and takes all factors in account reads as follows: @f{eqnarray*} k = - \frac 1{2 \cdot 1.6} \frac 1{\sqrt{d}} + \frac 1{2 \cdot 1.7} \frac 1{\sqrt{d}} \frac 2d \frac 1{q_T} \frac{h_K}{\|\mathbf{u}\|_{L^\infty(K)}} = - \frac 1{1.6 d\sqrt{d}} + \frac 1{1.7 d\sqrt{d}} \frac 1{q_T} \frac{h_K}{\|\mathbf{u}\|_{L^\infty(K)}}. @f} In the first form (in the center of the equation), $\frac -1{2 \cdot 1.6}$ is a universal constant, $\frac 1{\sqrt{d}}$ +1{2 \cdot 1.7}$ is a universal constant, $\frac 1{\sqrt{d}}$ is the factor that accounts for the difference between cell diameter and grid point separation, $\frac 2d$ accounts for the increase in $\beta$ with space dimension, diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index 7d9a55ac91..e8d0062099 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-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. +// +// --------------------------------------------------------------------- + +/* + * Authors: Martin Kronbichler, Uppsala University, + * Wolfgang Bangerth, Texas A&M University 2007, 2008 + */ + // @sect3{Include files} @@ -492,7 +502,7 @@ namespace Step31 DoFHandler<dim> stokes_dof_handler; ConstraintMatrix stokes_constraints; - std::vector<unsigned int> stokes_block_sizes; + std::vector<types::global_dof_index> stokes_block_sizes; TrilinosWrappers::BlockSparseMatrix stokes_matrix; TrilinosWrappers::BlockSparseMatrix stokes_preconditioner_matrix; @@ -750,7 +760,7 @@ namespace Step31 // introduction. // // There are some universal constants worth mentioning here. First, we need - // to fix $\beta$; we choose $\beta=0.015\cdot dim$, a choice discussed in + // to fix $\beta$; we choose $\beta=0.017\cdot dim$, a choice discussed in // 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 @@ -779,7 +789,7 @@ namespace Step31 const double global_T_variation, const double cell_diameter) const { - const double beta = 0.015 * dim; + const double beta = 0.017 * dim; const double alpha = 1; if (global_u_infty == 0) @@ -886,7 +896,7 @@ namespace Step31 temperature_constraints.close (); } - std::vector<unsigned int> stokes_dofs_per_block (2); + std::vector<types::global_dof_index> stokes_dofs_per_block (2); DoFTools::count_dofs_per_block (stokes_dof_handler, stokes_dofs_per_block, stokes_sub_blocks); @@ -1076,7 +1086,7 @@ namespace Step31 const unsigned int n_q_points = quadrature_formula.size(); FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<Tensor<2,dim> > grad_phi_u (dofs_per_cell); std::vector<double> phi_p (dofs_per_cell); @@ -1293,7 +1303,7 @@ namespace Step31 FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // Next we need a vector that will contain the values of the temperature // solution at the previous time level at the quadrature points to @@ -1459,7 +1469,7 @@ namespace Step31 FullMatrix<double> local_mass_matrix (dofs_per_cell, dofs_per_cell); FullMatrix<double> local_stiffness_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<double> phi_T (dofs_per_cell); std::vector<Tensor<1,dim> > grad_phi_T (dofs_per_cell); @@ -1571,7 +1581,7 @@ namespace Step31 Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // Next comes the declaration of vectors to hold the old and older // solution values (as a notation for time levels <i>n-1</i> and @@ -1828,12 +1838,12 @@ namespace Step31 const double maximal_velocity = get_maximal_velocity(); if (maximal_velocity >= 0.01) - time_step = 1./(1.6*dim*std::sqrt(1.*dim)) / + time_step = 1./(1.7*dim*std::sqrt(1.*dim)) / temperature_degree * GridTools::minimal_cell_diameter(triangulation) / maximal_velocity; else - time_step = 1./(1.6*dim*std::sqrt(1.*dim)) / + time_step = 1./(1.7*dim*std::sqrt(1.*dim)) / temperature_degree * GridTools::minimal_cell_diameter(triangulation) / .01; @@ -1967,9 +1977,9 @@ namespace Step31 // output as only a qualititative means to understand a solution, we // ignore this $\mathcal{O}(h)$ error. { - std::vector<unsigned int> local_joint_dof_indices (joint_fe.dofs_per_cell); - std::vector<unsigned int> local_stokes_dof_indices (stokes_fe.dofs_per_cell); - std::vector<unsigned int> local_temperature_dof_indices (temperature_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_joint_dof_indices (joint_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_stokes_dof_indices (stokes_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_temperature_dof_indices (temperature_fe.dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator joint_cell = joint_dof_handler.begin_active(), diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index ba978a498d..1b1d71ea0e 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} @@ -617,7 +629,7 @@ namespace Step32 StokesPreconditioner (const StokesPreconditioner &data); FullMatrix<double> local_matrix; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; }; template <int dim> @@ -674,7 +686,7 @@ namespace Step32 FullMatrix<double> local_mass_matrix; FullMatrix<double> local_stiffness_matrix; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; }; template <int dim> @@ -706,7 +718,7 @@ namespace Step32 TemperatureRHS (const TemperatureRHS &data); Vector<double> local_rhs; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; FullMatrix<double> matrix_for_bc; }; @@ -1690,7 +1702,7 @@ namespace Step32 const unsigned int dofs_per_cell = fe_values.dofs_per_cell, n_q_points = fe_values.n_quadrature_points; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); Vector<double> cell_vector (dofs_per_cell); FullMatrix<double> matrix_for_bc (dofs_per_cell, dofs_per_cell); @@ -1945,7 +1957,7 @@ namespace Step32 temperature_dof_handler.distribute_dofs (temperature_fe); - std::vector<unsigned int> stokes_dofs_per_block (2); + std::vector<types::global_dof_index> stokes_dofs_per_block (2); DoFTools::count_dofs_per_block (stokes_dof_handler, stokes_dofs_per_block, stokes_sub_blocks); @@ -3251,9 +3263,9 @@ namespace Step32 joint_solution.reinit (joint_dof_handler.locally_owned_dofs(), MPI_COMM_WORLD); { - std::vector<unsigned int> local_joint_dof_indices (joint_fe.dofs_per_cell); - std::vector<unsigned int> local_stokes_dof_indices (stokes_fe.dofs_per_cell); - std::vector<unsigned int> local_temperature_dof_indices (temperature_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_joint_dof_indices (joint_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_stokes_dof_indices (stokes_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_temperature_dof_indices (temperature_fe.dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator joint_cell = joint_dof_handler.begin_active(), diff --git a/deal.II/examples/step-33/step-33.cc b/deal.II/examples/step-33/step-33.cc index 37c8cf9792..3d17389c1b 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} @@ -1290,12 +1300,12 @@ namespace Step33 void assemble_system (); void assemble_cell_term (const FEValues<dim> &fe_v, - const std::vector<unsigned int> &dofs); + const std::vector<types::global_dof_index> &dofs); void assemble_face_term (const unsigned int face_no, const FEFaceValuesBase<dim> &fe_v, const FEFaceValuesBase<dim> &fe_v_neighbor, - const std::vector<unsigned int> &dofs, - const std::vector<unsigned int> &dofs_neighbor, + const std::vector<types::global_dof_index> &dofs, + const std::vector<types::global_dof_index> &dofs_neighbor, const bool external_face, const unsigned int boundary_id, const double face_diameter); @@ -1430,8 +1440,8 @@ namespace Step33 { const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; - std::vector<unsigned int> dof_indices (dofs_per_cell); - std::vector<unsigned int> dof_indices_neighbor (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_neighbor (dofs_per_cell); const UpdateFlags update_flags = update_values | update_gradients @@ -1481,7 +1491,7 @@ namespace Step33 assemble_face_term (face_no, fe_v_face, fe_v_face, dof_indices, - std::vector<unsigned int>(), + std::vector<types::global_dof_index>(), true, cell->face(face_no)->boundary_indicator(), cell->face(face_no)->diameter()); @@ -1661,7 +1671,7 @@ namespace Step33 void ConservationLaw<dim>:: assemble_cell_term (const FEValues<dim> &fe_v, - const std::vector<unsigned int> &dof_indices) + const std::vector<types::global_dof_index> &dof_indices) { const unsigned int dofs_per_cell = fe_v.dofs_per_cell; const unsigned int n_q_points = fe_v.n_quadrature_points; @@ -1862,8 +1872,8 @@ namespace Step33 ConservationLaw<dim>::assemble_face_term(const unsigned int face_no, const FEFaceValuesBase<dim> &fe_v, const FEFaceValuesBase<dim> &fe_v_neighbor, - const std::vector<unsigned int> &dof_indices, - const std::vector<unsigned int> &dof_indices_neighbor, + const std::vector<types::global_dof_index> &dof_indices, + const std::vector<types::global_dof_index> &dof_indices_neighbor, const bool external_face, const unsigned int boundary_id, const double face_diameter) @@ -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/step-34.cc b/deal.II/examples/step-34/step-34.cc index e5b9c78bb2..9667a2dc9a 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} @@ -553,7 +563,7 @@ namespace Step34 const unsigned int n_q_points = fe_v.n_quadrature_points; - std::vector<unsigned int> local_dof_indices(fe.dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices(fe.dofs_per_cell); std::vector<Vector<double> > cell_wind(n_q_points, Vector<double>(dim) ); double normal_wind; @@ -932,7 +942,7 @@ namespace Step34 const unsigned int n_q_points = fe_v.n_quadrature_points; - std::vector<unsigned int> dofs(fe.dofs_per_cell); + std::vector<types::global_dof_index> dofs(fe.dofs_per_cell); std::vector<double> local_phi(n_q_points); std::vector<double> normal_wind(n_q_points); diff --git a/deal.II/examples/step-35/step-35.cc b/deal.II/examples/step-35/step-35.cc index d5fffbf38e..894966c8f5 100644 --- a/deal.II/examples/step-35/step-35.cc +++ b/deal.II/examples/step-35/step-35.cc @@ -1,13 +1,22 @@ -/* Author: Abner Salgado, Texas A&M University 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. */ +// --------------------------------------------------------------------- +// $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: Abner Salgado, Texas A&M University 2009 + */ // @sect3{Include files} @@ -402,7 +411,7 @@ namespace Step35 const double t_0, T, Re; EquationData::Velocity<dim> vel_exact; - std::map<unsigned int, double> boundary_values; + std::map<types::global_dof_index, double> boundary_values; std::vector<types::boundary_id> boundary_indicators; Triangulation<dim> triangulation; @@ -516,8 +525,8 @@ namespace Step35 unsigned int vel_dpc; unsigned int pres_dpc; FullMatrix<double> local_grad; - std::vector<unsigned int> vel_local_dof_indices; - std::vector<unsigned int> pres_local_dof_indices; + std::vector<types::global_dof_index> vel_local_dof_indices; + std::vector<types::global_dof_index> pres_local_dof_indices; InitGradPerTaskData (const unsigned int dd, const unsigned int vdpc, @@ -572,7 +581,7 @@ namespace Step35 struct AdvectionPerTaskData { FullMatrix<double> local_advection; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; AdvectionPerTaskData (const unsigned int dpc) : local_advection (dpc, dpc), @@ -1192,7 +1201,7 @@ namespace Step35 phi_n_minus_1 = phi_n; - static std::map<unsigned int, double> bval; + static std::map<types::global_dof_index, double> bval; if (reinit_prec) VectorTools::interpolate_boundary_values (dof_handler_pressure, 3, ZeroFunction<dim>(), bval); @@ -1276,7 +1285,7 @@ namespace Step35 dof_handler_pressure.n_dofs()), ExcInternalError()); static Vector<double> joint_solution (joint_dof_handler.n_dofs()); - std::vector<unsigned int> loc_joint_dof_indices (joint_fe.dofs_per_cell), + std::vector<types::global_dof_index> loc_joint_dof_indices (joint_fe.dofs_per_cell), loc_vel_dof_indices (fe_velocity.dofs_per_cell), loc_pres_dof_indices (fe_pressure.dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator @@ -1361,7 +1370,7 @@ namespace Step35 update_values); const unsigned int dpc = fe_velocity.dofs_per_cell, nqp = quadrature_velocity.size(); - std::vector<unsigned int> ldi (dpc); + std::vector<types::global_dof_index> ldi (dpc); Vector<double> loc_rot (dpc); std::vector< Tensor<1,dim> > grad_u1 (nqp), grad_u2 (nqp); diff --git a/deal.II/examples/step-36/step-36.cc b/deal.II/examples/step-36/step-36.cc index 665301d399..7c93a435c4 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} @@ -223,7 +233,7 @@ namespace Step36 FullMatrix<double> cell_stiffness_matrix (dofs_per_cell, dofs_per_cell); FullMatrix<double> cell_mass_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); FunctionParser<dim> potential; potential.initialize (FunctionParser<dim>::default_variable_names (), diff --git a/deal.II/examples/step-37/step-37.cc b/deal.II/examples/step-37/step-37.cc index 453e0ae72b..62c51b30ac 100644 --- a/deal.II/examples/step-37/step-37.cc +++ b/deal.II/examples/step-37/step-37.cc @@ -1,14 +1,23 @@ -/* $Id$ */ -/* Author: Katharina Kormann, Martin Kronbichler, Uppsala University, 2009-2012 */ - -/* $Id$ */ -/* */ -/* 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. */ +// --------------------------------------------------------------------- +// $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: Katharina Kormann, Martin Kronbichler, Uppsala University, 2009-2012 + */ + // First include the necessary files from the deal.II library. #include <deal.II/base/quadrature_lib.h> @@ -794,13 +803,13 @@ namespace Step37 typename FunctionMap<dim>::type dirichlet_boundary; ZeroFunction<dim> homogeneous_dirichlet_bc (1); dirichlet_boundary[0] = &homogeneous_dirichlet_bc; - std::vector<std::set<unsigned int> > boundary_indices(triangulation.n_levels()); + std::vector<std::set<types::global_dof_index> > boundary_indices(triangulation.n_levels()); MGTools::make_boundary_list (dof_handler, dirichlet_boundary, boundary_indices); for (unsigned int level=0; level<nlevels; ++level) { - std::set<unsigned int>::iterator bc_it = boundary_indices[level].begin(); + std::set<types::global_dof_index>::iterator bc_it = boundary_indices[level].begin(); for ( ; bc_it != boundary_indices[level].end(); ++bc_it) mg_constraints[level].add_line(*bc_it); @@ -835,7 +844,7 @@ namespace Step37 const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.size(); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const Coefficient<dim> coefficient; std::vector<double> coefficient_values (n_q_points); @@ -881,7 +890,7 @@ namespace Step37 const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.size(); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const Coefficient<dim> coefficient; std::vector<double> coefficient_values (n_q_points); FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); @@ -975,7 +984,7 @@ namespace Step37 typedef PreconditionChebyshev<LevelMatrixType,Vector<double> > SMOOTHER; MGSmootherPrecondition<LevelMatrixType, SMOOTHER, Vector<double> > - 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/step-38.cc b/deal.II/examples/step-38/step-38.cc index e9891e7d4a..d1bcf3bc98 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} @@ -374,7 +384,7 @@ namespace Step38 Vector<double> cell_rhs (dofs_per_cell); std::vector<double> rhs_values(n_q_points); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const RightHandSide<spacedim> rhs; @@ -415,7 +425,7 @@ namespace Step38 } } - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (mapping, dof_handler, 0, diff --git a/deal.II/examples/step-39/step-39.cc b/deal.II/examples/step-39/step-39.cc index c1544a4d5c..1067a95822 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<dim> &dinfo, - typename MeshWorker::IntegrationInfo<dim> &info) const; + typename MeshWorker::IntegrationInfo<dim> &info) const; void boundary(MeshWorker::DoFInfo<dim> &dinfo, - typename MeshWorker::IntegrationInfo<dim> &info) const; + typename MeshWorker::IntegrationInfo<dim> &info) const; void face(MeshWorker::DoFInfo<dim> &dinfo1, - MeshWorker::DoFInfo<dim> &dinfo2, - typename MeshWorker::IntegrationInfo<dim> &info1, - typename MeshWorker::IntegrationInfo<dim> &info2) const; + MeshWorker::DoFInfo<dim> &dinfo2, + typename MeshWorker::IntegrationInfo<dim> &info1, + typename MeshWorker::IntegrationInfo<dim> &info2) const; }; @@ -153,9 +163,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo<dim> &dinfo, typename MeshWorker::IntegrationInfo<dim> &info) const; void boundary(MeshWorker::DoFInfo<dim> &dinfo, typename MeshWorker::IntegrationInfo<dim> &info) const; void face(MeshWorker::DoFInfo<dim> &dinfo1, - MeshWorker::DoFInfo<dim> &dinfo2, - typename MeshWorker::IntegrationInfo<dim> &info1, - typename MeshWorker::IntegrationInfo<dim> &info2) const; + MeshWorker::DoFInfo<dim> &dinfo2, + typename MeshWorker::IntegrationInfo<dim> &info1, + typename MeshWorker::IntegrationInfo<dim> &info2) const; }; @@ -202,9 +212,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo<dim> &dinfo, typename MeshWorker::IntegrationInfo<dim> &info) const; void boundary(MeshWorker::DoFInfo<dim> &dinfo, typename MeshWorker::IntegrationInfo<dim> &info) const; void face(MeshWorker::DoFInfo<dim> &dinfo1, - MeshWorker::DoFInfo<dim> &dinfo2, - typename MeshWorker::IntegrationInfo<dim> &info1, - typename MeshWorker::IntegrationInfo<dim> &info2) const; + MeshWorker::DoFInfo<dim> &dinfo2, + typename MeshWorker::IntegrationInfo<dim> &info1, + typename MeshWorker::IntegrationInfo<dim> &info2) const; }; @@ -298,9 +308,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo<dim> &dinfo, typename MeshWorker::IntegrationInfo<dim> &info) const; void boundary(MeshWorker::DoFInfo<dim> &dinfo, typename MeshWorker::IntegrationInfo<dim> &info) const; void face(MeshWorker::DoFInfo<dim> &dinfo1, - MeshWorker::DoFInfo<dim> &dinfo2, - typename MeshWorker::IntegrationInfo<dim> &info1, - typename MeshWorker::IntegrationInfo<dim> &info2) const; + MeshWorker::DoFInfo<dim> &dinfo2, + typename MeshWorker::IntegrationInfo<dim> &info1, + typename MeshWorker::IntegrationInfo<dim> &info2) const; }; // Here we have the integration on cells. There is currently no good @@ -614,7 +624,7 @@ namespace Step39 MeshWorker::Assembler::MGMatrixSimple<SparseMatrix<double> > assembler; assembler.initialize(mg_matrix); assembler.initialize_fluxes(mg_matrix_dg_up, mg_matrix_dg_down); - + MatrixIntegrator<dim> integrator; // Here is the other difference to the previous function: we run over all // cells, not only the active ones. And we use <tt>mg_dof_handler</tt>, diff --git a/deal.II/examples/step-4/step-4.cc b/deal.II/examples/step-4/step-4.cc index 7aa256fa80..8dc0d0a529 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} @@ -320,7 +330,7 @@ void Step4<dim>::assemble_system () FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // Next, we again have to loop over all cells and assemble local // contributions. Note, that a cell is a quadrilateral in two space @@ -400,7 +410,7 @@ void Step4<dim>::assemble_system () // task, we only have to replace the ZeroFunction used there by an object of // the class which describes the boundary values we would like to use // (i.e. the <code>BoundaryValues</code> class declared above): - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, BoundaryValues<dim>(), 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 <i>is</i> 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 <code>unsigned +int</code>, 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/step-40.cc b/deal.II/examples/step-40/step-40.cc index 5b9d32310c..d50694e9f9 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 - 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. +// +// --------------------------------------------------------------------- -/* $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. */ +/* + * 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/function.h> +#include <deal.II/base/timer.h> + +#include <deal.II/lac/generic_linear_algebra.h> + +#define USE_PETSC_LA + +namespace LA +{ +#ifdef USE_PETSC_LA + using namespace dealii::LinearAlgebraPETSc; +#else + using namespace dealii::LinearAlgebraTrilinos; +#endif +} + #include <deal.II/lac/vector.h> #include <deal.II/lac/full_matrix.h> #include <deal.II/lac/solver_cg.h> @@ -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<dim> triangulation; + parallel::distributed::Triangulation<dim> triangulation; - DoFHandler<dim> dof_handler; - FE_Q<dim> fe; + DoFHandler<dim> dof_handler; + FE_Q<dim> 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,6 +234,8 @@ namespace Step40 template <int dim> void LaplaceProblem<dim>::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, @@ -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 <int dim> void LaplaceProblem<dim>::assemble_system () { + TimerOutput::Scope t(computing_timer, "assembly"); + const QGauss<dim> quadrature_formula(3); FEValues<dim> fe_values (fe, quadrature_formula, @@ -347,7 +375,7 @@ namespace Step40 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -428,20 +456,23 @@ namespace Step40 template <int dim> void LaplaceProblem<dim>::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; - // Ask for a symmetric preconditioner by setting the first parameter in - // AdditionalData to true. - PETScWrappers::PreconditionBoomerAMG - preconditioner(system_matrix, - PETScWrappers::PreconditionBoomerAMG::AdditionalData(true)); + LA::MPI::PreconditionAMG::AdditionalData data; + +#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 <int dim> void LaplaceProblem<dim>::refine_grid () { + TimerOutput::Scope t(computing_timer, "refine"); + Vector<float> estimated_error_per_cell (triangulation.n_active_cells()); KellyErrorEstimator<dim>::estimate (dof_handler, QGauss<dim-1>(3), @@ -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 (); } + } } diff --git a/deal.II/examples/step-41/step-41.cc b/deal.II/examples/step-41/step-41.cc index 699b98c897..80ac9f3305 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} @@ -293,7 +303,7 @@ namespace Step41 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); TrilinosWrappers::Vector cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -370,7 +380,7 @@ namespace Step41 const unsigned int n_q_points = quadrature_formula.size(); FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 54de0ab8f4..0ac5426c5c 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -1,14 +1,23 @@ -/* $Id$ */ -/* 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 copyrightG 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. +// +// --------------------------------------------------------------------- + +/* + * Author: Wolfgang Bangerth, University of Heidelberg, 1999 + */ + // @sect3{Include files} @@ -100,32 +109,34 @@ namespace Step42 template <int dim> class Input { - public: - Input (const char* _name) : + public: + Input (const char *_name) : name (_name), mpi_communicator (MPI_COMM_WORLD), pcout (std::cout, - (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), + (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), obstacle_data (0), hx (0), hy (0), nx (0), ny (0) - {read_obstacle (name);} + { + read_obstacle (name); + } - double hv (int i, int j); + double hv (int i, int j); - double obstacle_function (double x,double y); + double obstacle_function (double x,double y); - void read_obstacle (const char* name); + void read_obstacle (const char *name); - private: - const char* name; - MPI_Comm mpi_communicator; - ConditionalOStream pcout; - std::vector<double> obstacle_data; - double hx, hy; - int nx, ny; + private: + const char *name; + MPI_Comm mpi_communicator; + ConditionalOStream pcout; + std::vector<double> obstacle_data; + double hx, hy; + int nx, ny; }; // This function is used in obstacle_function () @@ -212,7 +223,7 @@ namespace Step42 // obstacle datas and stores them in the std::vector // obstacle_data. It will be used only in run (). template <int dim> - void Input<dim>::read_obstacle (const char* name) + void Input<dim>::read_obstacle (const char *name) { std::ifstream f(name); @@ -222,9 +233,9 @@ namespace Step42 for (int k=0; k<nx*ny; k++) { - double val; - f >> val; - obstacle_data.push_back(val); + double val; + f >> val; + obstacle_data.push_back(val); } hx = 1.0/(nx - 1); @@ -253,18 +264,21 @@ namespace Step42 MPI_Comm _mpi_communicator, ConditionalOStream _pcout); - void plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, + 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, + 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<dim> &fe_values, const unsigned int shape_func, const unsigned int q_point) const; - void set_sigma_0 (double sigma_hlp) {sigma_0 = sigma_hlp;} + void set_sigma_0 (double sigma_hlp) + { + sigma_0 = sigma_hlp; + } private: SymmetricTensor<4,dim> stress_strain_tensor_mu; @@ -324,11 +338,11 @@ namespace Step42 // Also we sum up the elastic and the plastic quadrature // points. template <int dim> - void ConstitutiveLaw<dim>::plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, + void ConstitutiveLaw<dim>::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) + unsigned int &elast_points, + unsigned int &plast_points, + double &yield) { if (dim == 3) { @@ -359,9 +373,9 @@ namespace Step42 // This function returns the linearized stress strain tensor. // It contains the derivative of the nonlinear constitutive law. template <int dim> - void ConstitutiveLaw<dim>::linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, - SymmetricTensor<4,dim> &stress_strain_tensor, - const SymmetricTensor<2,dim> &strain_tensor) + void ConstitutiveLaw<dim>::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) { @@ -485,7 +499,7 @@ namespace Step42 Function<dim>(dim), input_obstacle_copy(_input), use_read_obstacle(_use_read_obstacle) - {} + {} virtual double value (const Point<dim> &p, const unsigned int component = 0) const; @@ -495,7 +509,7 @@ namespace Step42 private: std_cxx1x::shared_ptr<Input<dim> > const &input_obstacle_copy; - bool use_read_obstacle; + bool use_read_obstacle; }; template <int dim> @@ -510,10 +524,10 @@ namespace Step42 return_value = p(1); 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 (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; } return return_value; } @@ -703,7 +717,7 @@ namespace Step42 computing_timer.exit_section("Setup: distribute DoFs"); } - // Setup of the hanging nodes and the Dirichlet constraints. + // Setup of the hanging nodes and the Dirichlet constraints. { constraints_hanging_nodes.clear (); constraints_hanging_nodes.reinit (locally_relevant_dofs); @@ -721,7 +735,7 @@ namespace Step42 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); @@ -732,7 +746,7 @@ namespace Step42 active_set.set_size (locally_relevant_dofs.size ()); } - // Here we setup sparsity pattern. + // Here we setup sparsity pattern. { computing_timer.enter_section("Setup: matrix"); TrilinosWrappers::SparsityPattern sp (locally_owned_dofs, @@ -745,12 +759,12 @@ namespace Step42 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; + // 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), @@ -758,10 +772,10 @@ namespace Step42 for (unsigned int j=start; j<end; j++) diag_mass_matrix_vector (j) = mass_matrix.diag_element (j); number_iterations = 0; - + diag_mass_matrix_vector.compress (VectorOperation::insert); - // remove the mass matrix entries from the matrix: + // remove the mass matrix entries from the matrix: mass_matrix = 0; computing_timer.exit_section("Setup: matrix"); @@ -799,7 +813,7 @@ namespace Step42 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -922,7 +936,7 @@ namespace Step42 Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const FEValuesExtractors::Vector displacement (0); @@ -1018,7 +1032,7 @@ namespace Step42 template <int dim> void PlasticityContactProblem<dim>::assemble_mass_matrix_diagonal (TrilinosWrappers::SparseMatrix &mass_matrix) { - QTrapez<dim-1> face_quadrature_formula; + QTrapez<dim-1> face_quadrature_formula; FEFaceValues<dim> fe_values_face (fe, face_quadrature_formula, update_values | @@ -1031,9 +1045,9 @@ namespace Step42 FullMatrix<double> 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; + ones[i] = 1.0; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const FEValuesExtractors::Vector displacement (0); @@ -1053,7 +1067,7 @@ namespace Step42 for (unsigned int q_point=0; q_point<n_face_q_points; ++q_point) for (unsigned int i=0; i<dofs_per_cell; ++i) cell_matrix(i,i) += (fe_values_face[displacement].value (i, q_point) * - ones * + ones * fe_values_face.JxW (q_point)); cell->get_dof_indices (local_dof_indices); @@ -1271,8 +1285,8 @@ namespace Step42 SolverControl solver_control (system_matrix_newton.m(), solver_tolerance); SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control, mem, - SolverBicgstab<TrilinosWrappers::MPI::Vector>:: - AdditionalData(false, 1.e-10)); + SolverBicgstab<TrilinosWrappers::MPI::Vector>:: + AdditionalData(false, 1.e-10)); solver.solve(system_matrix_newton, distributed_solution, system_rhs_newton, preconditioner_u); @@ -1397,9 +1411,9 @@ namespace Step42 computing_timer.exit_section("Residual and lambda"); pcout << " Residual of the non-contact part of the system: " << resid - << std::endl - << " with a damping parameter alpha = " << a - << std::endl; + << std::endl + << " with a damping parameter alpha = " << a + << std::endl; // The previous iteration of step 0 is the solution of an elastic problem. // So a linear combination of a plastic and an elastic solution makes no sense @@ -1416,7 +1430,7 @@ namespace Step42 int is_my_set_changed = (active_set == active_set_old)?0:1; int num_changed = Utilities::MPI::sum(is_my_set_changed, MPI_COMM_WORLD); if (num_changed==0 && resid < 1e-8) - break; + break; active_set_old = active_set; } @@ -1431,7 +1445,7 @@ namespace Step42 template <int dim> void PlasticityContactProblem<dim>::refine_grid () { - Vector<float> estimated_error_per_cell (triangulation.n_active_cells()); + Vector<float> estimated_error_per_cell (triangulation.n_active_cells()); KellyErrorEstimator<dim>::estimate (dof_handler, QGauss<dim-1>(3), typename FunctionMap<dim>::type(), @@ -1546,13 +1560,13 @@ namespace Step42 template <int dim> void PlasticityContactProblem<dim>::run () { - use_read_obstacle = false; - if (use_read_obstacle) - { - pcout << "Read the obstacle from a file." << std::endl; - input_obstacle.reset (new Input<dim>("obstacle_file.pbm")); - pcout << "Obstacle is available now." << std::endl; - } + use_read_obstacle = false; + if (use_read_obstacle) + { + pcout << "Read the obstacle from a file." << std::endl; + input_obstacle.reset (new Input<dim>("obstacle_file.pbm")); + pcout << "Obstacle is available now." << std::endl; + } const unsigned int n_cycles = 6; for (cycle=0; cycle<n_cycles; ++cycle) @@ -1568,10 +1582,10 @@ namespace Step42 } else { - computing_timer.enter_section("Setup: refine mesh"); - soltrans.reset (new parallel::distributed::SolutionTransfer<dim,TrilinosWrappers::MPI::Vector>(dof_handler)); - refine_grid (); - computing_timer.exit_section("Setup: refine mesh"); + computing_timer.enter_section("Setup: refine mesh"); + soltrans.reset (new parallel::distributed::SolutionTransfer<dim,TrilinosWrappers::MPI::Vector>(dof_handler)); + refine_grid (); + computing_timer.exit_section("Setup: refine mesh"); } setup_system (); @@ -1580,8 +1594,8 @@ namespace Step42 { TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton); distributed_solution = solution; - soltrans->interpolate(distributed_solution); - solution = distributed_solution; + soltrans->interpolate(distributed_solution); + solution = distributed_solution; } computing_timer.exit_section("Setup"); @@ -1618,7 +1632,7 @@ int main (int argc, char *argv[]) int _n_refinements_global = 3; if (argc == 2) - _n_refinements_global = atoi(argv[1]); + _n_refinements_global = atoi(argv[1]); PlasticityContactProblem<3> laplace_problem_3d (_n_refinements_global); laplace_problem_3d.run (); diff --git a/deal.II/examples/step-43/doc/intro.dox b/deal.II/examples/step-43/doc/intro.dox index f0532e4bd1..446dd335c0 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 &amp; 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. <br> An h-adaptive operator splitting method for two-phase flow in 3D heterogeneous porous media. -<br> <i>Submitted</i>, 2012. +<br> SIAM Journal on Scientific Computing, vol. 35 (2013), pp. B149-B175 <li> M. Kronbichler, T. Heister, and W. Bangerth <br> High Accuracy Mantle Convection Simulation through Modern Numerical Methods. -<br> <i>Submitted to Geophysics Journal International</i>, 2011. +<br> Geophysics Journal International, vol. 191 (2012), pp. 12-29 <li> F Brezzi and M Fortin. diff --git a/deal.II/examples/step-43/step-43.cc b/deal.II/examples/step-43/step-43.cc index 4086020fd7..0e32b6ef66 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 - 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. +// +// --------------------------------------------------------------------- -/* $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. */ +/* + * Authors: Chih-Che Chueh, University of Victoria, 2010 + * Wolfgang Bangerth, Texas A&M University, 2010 + */ // @sect3{Include files} @@ -500,10 +509,10 @@ namespace Step43 const FEValues<dim> &darcy_fe_values, const double global_max_u_F_prime, const double global_S_variation, - const std::vector<unsigned int> &local_dof_indices); + const std::vector<types::global_dof_index> &local_dof_indices); void assemble_saturation_rhs_boundary_term (const FEFaceValues<dim> &saturation_fe_face_values, const FEFaceValues<dim> &darcy_fe_face_values, - const std::vector<unsigned int> &local_dof_indices); + const std::vector<types::global_dof_index> &local_dof_indices); void solve (); void refine_mesh (const unsigned int min_grid_level, const unsigned int max_grid_level); @@ -709,7 +718,7 @@ namespace Step43 } - std::vector<unsigned int> darcy_dofs_per_block (2); + std::vector<types::global_dof_index> darcy_dofs_per_block (2); DoFTools::count_dofs_per_block (darcy_dof_handler, darcy_dofs_per_block, darcy_block_component); const unsigned int n_u = darcy_dofs_per_block[0], n_p = darcy_dofs_per_block[1], @@ -893,7 +902,7 @@ namespace Step43 std::vector<double> old_saturation_values (n_q_points); FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<Tensor<1,dim> > phi_u (dofs_per_cell); std::vector<Tensor<1,dim> > grad_phi_p (dofs_per_cell); @@ -1038,7 +1047,7 @@ namespace Step43 FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const PressureRightHandSide<dim> pressure_right_hand_side; const PressureBoundaryValues<dim> pressure_boundary_values; @@ -1235,7 +1244,7 @@ namespace Step43 FullMatrix<double> local_matrix (dofs_per_cell, dofs_per_cell); Vector<double> local_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator cell = saturation_dof_handler.begin_active(), @@ -1310,7 +1319,7 @@ namespace Step43 update_values); const unsigned int dofs_per_cell = saturation_dof_handler.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const double global_max_u_F_prime = get_max_u_F_prime (); const std::pair<double,double> global_S_range = get_extrapolated_saturation_range (); @@ -1367,7 +1376,7 @@ namespace Step43 const FEValues<dim> &darcy_fe_values, const double global_max_u_F_prime, const double global_S_variation, - const std::vector<unsigned int> &local_dof_indices) + const std::vector<types::global_dof_index> &local_dof_indices) { const unsigned int dofs_per_cell = saturation_fe_values.dofs_per_cell; const unsigned int n_q_points = saturation_fe_values.n_quadrature_points; @@ -1440,7 +1449,7 @@ namespace Step43 TwoPhaseFlowProblem<dim>:: assemble_saturation_rhs_boundary_term (const FEFaceValues<dim> &saturation_fe_face_values, const FEFaceValues<dim> &darcy_fe_face_values, - const std::vector<unsigned int> &local_dof_indices) + const std::vector<types::global_dof_index> &local_dof_indices) { const unsigned int dofs_per_cell = saturation_fe_face_values.dofs_per_cell; const unsigned int n_face_q_points = saturation_fe_face_values.n_quadrature_points; @@ -1771,9 +1780,9 @@ namespace Step43 Vector<double> joint_solution (joint_dof_handler.n_dofs()); { - std::vector<unsigned int> local_joint_dof_indices (joint_fe.dofs_per_cell); - std::vector<unsigned int> local_darcy_dof_indices (darcy_fe.dofs_per_cell); - std::vector<unsigned int> local_saturation_dof_indices (saturation_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_joint_dof_indices (joint_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_darcy_dof_indices (darcy_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_saturation_dof_indices (saturation_fe.dofs_per_cell); typename DoFHandler<dim>::active_cell_iterator joint_cell = joint_dof_handler.begin_active(), diff --git a/deal.II/examples/step-44/step-44.cc b/deal.II/examples/step-44/step-44.cc index e1f3495346..18079d1da0 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 @@ -996,10 +1008,10 @@ namespace Step44 J_dof = 2 }; - std::vector<unsigned int> dofs_per_block; - std::vector<unsigned int> element_indices_u; - std::vector<unsigned int> element_indices_p; - std::vector<unsigned int> element_indices_J; + std::vector<types::global_dof_index> dofs_per_block; + std::vector<types::global_dof_index> element_indices_u; + std::vector<types::global_dof_index> element_indices_p; + std::vector<types::global_dof_index> element_indices_J; // Rules for Gauss-quadrature on both the cell and faces. The number of // quadrature points on both cells and faces is recorded. @@ -1209,7 +1221,7 @@ namespace Step44 struct Solid<dim>::PerTaskData_K { FullMatrix<double> cell_matrix; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; PerTaskData_K(const unsigned int dofs_per_cell) : @@ -1290,7 +1302,7 @@ namespace Step44 struct Solid<dim>::PerTaskData_RHS { Vector<double> cell_rhs; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; PerTaskData_RHS(const unsigned int dofs_per_cell) : @@ -1372,7 +1384,7 @@ namespace Step44 struct Solid<dim>::PerTaskData_SC { FullMatrix<double> cell_matrix; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; FullMatrix<double> k_orig; FullMatrix<double> k_pu; @@ -1567,9 +1579,9 @@ namespace Step44 // Setup the sparsity pattern and tangent matrix tangent_matrix.clear(); { - const unsigned int n_dofs_u = dofs_per_block[u_dof]; - const unsigned int n_dofs_p = dofs_per_block[p_dof]; - const unsigned int n_dofs_J = dofs_per_block[J_dof]; + const types::global_dof_index n_dofs_u = dofs_per_block[u_dof]; + const types::global_dof_index n_dofs_p = dofs_per_block[p_dof]; + const types::global_dof_index n_dofs_J = dofs_per_block[J_dof]; BlockCompressedSimpleSparsityPattern csp(n_blocks, n_blocks); @@ -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 f876aa75ed..040d713eb6 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} @@ -316,7 +325,7 @@ namespace Step45 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const RightHandSide right_hand_side; diff --git a/deal.II/examples/step-46/step-46.cc b/deal.II/examples/step-46/step-46.cc index ffd556b8f5..d3fb0d92bb 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} @@ -400,7 +409,7 @@ namespace Step46 // solid. The following piece of code was already presented in the // introduction: { - std::vector<unsigned int> local_face_dof_indices (stokes_fe.dofs_per_face); + std::vector<types::global_dof_index> local_face_dof_indices (stokes_fe.dofs_per_face); for (typename hp::DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(); cell != dof_handler.end(); ++cell) @@ -544,8 +553,8 @@ namespace Step46 stokes_dofs_per_cell); Vector<double> local_rhs; - std::vector<unsigned int> local_dof_indices; - std::vector<unsigned int> neighbor_dof_indices (stokes_dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices; + std::vector<types::global_dof_index> neighbor_dof_indices (stokes_dofs_per_cell); const RightHandSide<dim> right_hand_side; diff --git a/deal.II/examples/step-47/step-47.cc b/deal.II/examples/step-47/step-47.cc index 8d24f894f6..fa212abae8 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 <deal.II/base/quadrature_lib.h> @@ -280,7 +289,7 @@ namespace Step47 FullMatrix<double> cell_matrix; Vector<double> cell_rhs; - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; const Coefficient<dim> coefficient; std::vector<double> coefficient_values (n_q_points); @@ -424,7 +433,7 @@ namespace Step47 } - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, ZeroFunction<dim>(2), diff --git a/deal.II/examples/step-48/step-48.cc b/deal.II/examples/step-48/step-48.cc index 79250490ed..a37cc84d43 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. @@ -280,7 +288,7 @@ namespace Step48 void make_grid_and_dofs (); void oldstyle_operation (); void assemble_system (); - void output_results (const unsigned int timestep_number) const; + void output_results (const unsigned int timestep_number); #ifdef DEAL_II_WITH_P4EST parallel::distributed::Triangulation<dim> triangulation; @@ -422,31 +430,34 @@ namespace Step48 // This function prints the norm of the solution and writes the solution // vector to a file. The norm is standard (except for the fact that we need // to be sure to only count norms on locally owned cells), and the second is - // similar to what we did in step-40. However, we first need to generate an - // appropriate vector for output: The ones we used during time stepping - // contained information about ghosts dofs that one needs write access to - // during the loops over cell. However, that is not the same as needed when - // outputting. So we first initialize a vector with locally relevant degrees - // of freedom by copying the solution (note how we use the function @p - // copy_from to transfer data between vectors with the same local range, but - // different layouts of ghosts). Then, we import the values on the ghost - // DoFs and then distribute the constraints (as constraints are zero in the - // vectors during loop over all cells). + // similar to what we did in step-40. Note that we can use the same vector + // for output as we used for computation: The vectors in the matrix-free + // framework always provide full information on all locally owned cells + // (this is what is needed in the local evaluations, too), including ghost + // vector entries on these cells. This is the only data that is needed in + // the integrate_difference function as well as in DataOut. We only need to + // make sure that we tell the vector to update its ghost values before we + // read them. This is a feature present only in the + // parallel::distributed::Vector class. Distributed vectors with PETSc and + // Trilinos, on the other hand, need to be copied to special vectors + // including ghost values (see the relevant section in step-40). If we + // wanted to access all degrees of freedom on ghost cells, too (e.g. when + // computing error estimators that use the jump of solution over cell + // boundaries), we would need more information and create a vector + // initialized with locally relevant dofs just as in step-40. Observe also + // that we need to distribute constraints for output - they are not filled + // during computations (rather, they are distributed on the fly in the + // matrix-free method read_dof_values). template <int dim> void - SineGordonProblem<dim>::output_results (const unsigned int timestep_number) const + SineGordonProblem<dim>::output_results (const unsigned int timestep_number) { - parallel::distributed::Vector<double> locally_relevant_solution; - locally_relevant_solution.reinit (dof_handler.locally_owned_dofs(), - locally_relevant_dofs, - MPI_COMM_WORLD); - locally_relevant_solution.copy_from (solution); - locally_relevant_solution.update_ghost_values (); - constraints.distribute (locally_relevant_solution); + constraints.distribute (solution); Vector<float> norm_per_cell (triangulation.n_active_cells()); + solution.update_ghost_values(); VectorTools::integrate_difference (dof_handler, - locally_relevant_solution, + solution, ZeroFunction<dim>(), norm_per_cell, QGauss<dim>(fe_degree+1), @@ -463,15 +474,15 @@ namespace Step48 DataOut<dim> data_out; data_out.attach_dof_handler (dof_handler); - data_out.add_data_vector (locally_relevant_solution, "solution"); + data_out.add_data_vector (solution, "solution"); data_out.build_patches (); const std::string filename = "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) @@ -501,10 +512,10 @@ namespace Step48 // the finest mesh size. The finest mesh size is computed as the diameter of // the last cell in the triangulation, which is the last cell on the finest // level of the mesh. This is only possible for Cartesian meshes, otherwise, - // one needs to loop over all cells). Note that we need to query all the + // one needs to loop over all cells. Note that we need to query all the // processors for their finest cell since the not all processors might hold // a region where the mesh is at the finest level. Then, we readjust the - // time step a little to hit the final time exactly if necessary. + // time step a little to hit the final time exactly. template <int dim> void SineGordonProblem<dim>::run () @@ -555,15 +566,15 @@ namespace Step48 // // Note how this shift is implemented: We simply call the swap method on // the two vectors which swaps only some pointers without the need to copy - // data around. Obviously, this is a more efficient way to move data - // around. Let us see what happens in more detail: First, we exchange - // <code>old_solution</code> with <code>old_old_solution</code>, which - // means that <code>old_old_solution</code> gets - // <code>old_solution</code>, which is what we expect. Similarly, - // <code>old_solution</code> gets the content from <code>solution</code> - // in the next step. Afterward, <code>solution</code> holds - // <code>old_old_solution</code>, but that will be overwritten during this - // step. + // data around. Obviously, this is a more efficient way to update the + // vectors during time stepping. Let us see what happens in more detail: + // First, we exchange <code>old_solution</code> with + // <code>old_old_solution</code>, which means that + // <code>old_old_solution</code> gets <code>old_solution</code>, which is + // what we expect. Similarly, <code>old_solution</code> gets the content + // from <code>solution</code> in the next step. Afterward, + // <code>solution</code> holds <code>old_old_solution</code>, but that + // will be overwritten during this step. unsigned int timestep_number = 1; Timer timer; diff --git a/deal.II/examples/step-49/step-49.cc b/deal.II/examples/step-49/step-49.cc index 2592717ce2..f3042fd32b 100644 --- a/deal.II/examples/step-49/step-49.cc +++ b/deal.II/examples/step-49/step-49.cc @@ -1,11 +1,21 @@ -/* $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. +// --------------------------------------------------------------------- +// $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: 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<int dim> void mesh_info(const Triangulation<dim> &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<dim> &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 0430781c5c..acaa49edd1 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} @@ -304,7 +314,7 @@ void Step5<dim>::assemble_system () FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // Here is one difference: for this program, we will again use a constant // right hand side function and zero boundary values, but a variable @@ -387,7 +397,7 @@ void Step5<dim>::assemble_system () } // With the matrix so built, we use zero boundary values again: - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, ZeroFunction<dim>(), @@ -533,7 +543,7 @@ void Step5<dim>::output_results (const unsigned int cycle) const // The second to last thing in this program is the definition of the // <code>run()</code> 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/step-50.cc b/deal.II/examples/step-50/step-50.cc index abca04f105..b76f929eee 100644 --- a/deal.II/examples/step-50/step-50.cc +++ b/deal.II/examples/step-50/step-50.cc @@ -1,15 +1,25 @@ -/* 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. */ +// --------------------------------------------------------------------- +// $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 multi-grid. work in progress! @@ -137,6 +147,8 @@ namespace Step50 matrix_t system_matrix; + IndexSet locally_relevant_set; + // We need an additional object for the // hanging nodes constraints. They are // handed to the transfer object in the @@ -285,7 +297,10 @@ namespace Step50 fe (degree), mg_dof_handler (triangulation), degree(degree) - {} + { + if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)!=0) + deallog.depth_console(0); + } @@ -298,21 +313,6 @@ namespace Step50 template <int dim> void LaplaceProblem<dim>::setup_system () { - std::string filename = "grid-" - + Utilities::int_to_string(triangulation.n_levels(), 2) - + "-" - + Utilities::int_to_string (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD), 3) - + ".svg"; - - std::ofstream out (filename.c_str()); - GridOut grid_out; - GridOutFlags::Svg svg_flags; - svg_flags.polar_angle = 60; - svg_flags.label_level_subdomain_id = true; - svg_flags.convert_level_number_to_height = true; - grid_out.set_flags(svg_flags); - grid_out.write_svg (triangulation, out); - mg_dof_handler.distribute_dofs (fe); mg_dof_handler.distribute_mg_dofs (fe); @@ -324,11 +324,14 @@ namespace Step50 deallog << "Number of degrees of freedom: " << mg_dof_handler.n_dofs(); - for (unsigned int l=0; l<triangulation.n_levels(); ++l) + for (unsigned int l=0; l<triangulation.n_global_levels(); ++l) deallog << " " << 'L' << l << ": " << mg_dof_handler.n_dofs(l); deallog << std::endl; + DoFTools::extract_locally_relevant_dofs (mg_dof_handler, + locally_relevant_set); + //solution.reinit (mg_dof_handler.n_dofs()); //system_rhs.reinit (mg_dof_handler.n_dofs()); @@ -355,15 +358,15 @@ namespace Step50 // correctly into the global linear system // right away, without the need for a later // clean-up stage: - constraints.clear (); - hanging_node_constraints.clear (); + constraints.reinit (locally_relevant_set); + hanging_node_constraints.reinit (locally_relevant_set); DoFTools::make_hanging_node_constraints (mg_dof_handler, hanging_node_constraints); DoFTools::make_hanging_node_constraints (mg_dof_handler, constraints); typename FunctionMap<dim>::type dirichlet_boundary; ZeroFunction<dim> homogeneous_dirichlet_bc (1); dirichlet_boundary[0] = &homogeneous_dirichlet_bc; - VectorTools::interpolate_boundary_values (static_cast<const DoFHandler<dim>&>(mg_dof_handler), + VectorTools::interpolate_boundary_values (mg_dof_handler, dirichlet_boundary, constraints); constraints.close (); @@ -397,7 +400,7 @@ namespace Step50 // SparseMatrix classes, since they have to // release their SparsityPattern before the // can be destroyed upon resizing. - const unsigned int n_levels = triangulation.n_levels(); + const unsigned int n_levels = triangulation.n_global_levels(); mg_interface_matrices.resize(0, n_levels-1); mg_interface_matrices.clear (); @@ -438,9 +441,14 @@ namespace Step50 MGTools::make_sparsity_pattern(mg_dof_handler, csp, level); mg_matrices[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level), - mg_dof_handler.locally_owned_mg_dofs(level), - csp, - MPI_COMM_WORLD, true); + mg_dof_handler.locally_owned_mg_dofs(level), + csp, + MPI_COMM_WORLD, true); + + mg_interface_matrices[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level), + mg_dof_handler.locally_owned_mg_dofs(level), + csp, + MPI_COMM_WORLD, true); } } @@ -516,6 +524,9 @@ namespace Step50 local_dof_indices, system_matrix, system_rhs); } + + system_matrix.compress(VectorOperation::add); + system_rhs.compress(VectorOperation::add); } @@ -555,67 +566,49 @@ namespace Step50 const Coefficient<dim> coefficient; std::vector<double> 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 - // <code>setup_system</code> - // 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 <code>setup_system</code> 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 <code>MGConstraints</code> - // already computed the information for us - // when we called initialize in <code>setup_system()</code>. + // 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 <code>MGConstraints</code> already computed the + // information for us when we called initialize in + // <code>setup_system()</code>. std::vector<std::vector<bool> > interface_dofs = mg_constrained_dofs.get_refinement_edge_indices (); std::vector<std::vector<bool> > 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 <code>MGConstraints</code> - // knows it. So we simply ask for them by calling - // <code>get_boundary_indices ()</code>. - // 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 + // <code>MGConstraints</code> knows it. So we simply ask for them + // by calling <code>get_boundary_indices ()</code>. 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<ConstraintMatrix> boundary_constraints (triangulation.n_levels()); - std::vector<ConstraintMatrix> boundary_interface_constraints (triangulation.n_levels()); - for (unsigned int level=0; level<triangulation.n_levels(); ++level) + std::vector<ConstraintMatrix> boundary_constraints (triangulation.n_global_levels()); + std::vector<ConstraintMatrix> boundary_interface_constraints (triangulation.n_global_levels()); + for (unsigned int level=0; level<triangulation.n_global_levels(); ++level) { boundary_constraints[level].add_lines (interface_dofs[level]); boundary_constraints[level].add_lines (mg_constrained_dofs.get_boundary_indices()[level]); @@ -626,20 +619,14 @@ namespace Step50 boundary_interface_constraints[level].close (); } - // Now that we're done with most of our - // preliminaries, let's start the - // integration loop. It looks mostly like - // the loop in - // <code>assemble_system</code>, 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 + // <code>assemble_system</code>, 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<dim>::cell_iterator cell = mg_dof_handler.begin(), endc = mg_dof_handler.end(); @@ -660,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 - // <code>boundary_constraints</code> - // 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 + // <code>boundary_constraints</code> 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 <code>mg_matrices</code> - // 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 + // <code>mg_matrices</code> 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 - // <code>mg_interface_matrices</code> - // object. The - // <code>boundary_interface_constraints</code> - // 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 + // <code>mg_interface_matrices</code> object. The + // <code>boundary_interface_constraints</code> 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 <code>solve()</code> - // 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 <code>solve()</code> function) be able to just pass + // the transpose matrix where necessary. for (unsigned int i=0; i<dofs_per_cell; ++i) for (unsigned int j=0; j<dofs_per_cell; ++j) if ( !(interface_dofs[cell->level()][local_dof_indices[i]]==true && @@ -750,61 +712,56 @@ namespace Step50 local_dof_indices, mg_interface_matrices[cell->level()]); } + + for (unsigned int i=0; i<triangulation.n_global_levels(); ++i) + { + mg_matrices[i].compress(VectorOperation::add); + mg_interface_matrices[i].compress(VectorOperation::add); + } } // @sect4{LaplaceProblem::solve} - // This is the other function that is - // significantly different in support of the - // multigrid solver (or, in fact, the - // preconditioner for which we use the - // multigrid method). + // This is the other function that is significantly different in + // support of the multigrid solver (or, in fact, the preconditioner + // for which we use the multigrid method). // - // Let us start out by setting up two of the - // components of multilevel methods: transfer - // operators between levels, and a solver on - // the coarsest level. In finite element - // methods, the transfer operators are - // derived from the finite element function - // spaces involved and can often be computed - // in a generic way independent of the - // problem under consideration. In that case, - // we can use the MGTransferPrebuilt class - // that, given the constraints on the global - // level and an MGDoFHandler object computes - // the matrices corresponding to these - // transfer operators. + // Let us start out by setting up two of the components of + // multilevel methods: transfer operators between levels, and a + // solver on the coarsest level. In finite element methods, the + // transfer operators are derived from the finite element function + // spaces involved and can often be computed in a generic way + // independent of the problem under consideration. In that case, we + // can use the MGTransferPrebuilt class that, given the constraints + // on the global level and an MGDoFHandler object computes the + // matrices corresponding to these transfer operators. // - // The second part of the following lines - // deals with the coarse grid solver. Since - // our coarse grid is very coarse indeed, we - // decide for a direct solver (a Householder - // decomposition of the coarsest level - // matrix), even if its implementation is not - // particularly sophisticated. If our coarse - // mesh had many more cells than the five we - // have here, something better suited would - // obviously be necessary here. + // The second part of the following lines deals with the coarse grid + // solver. Since our coarse grid is very coarse indeed, we decide + // for a direct solver (a Householder decomposition of the coarsest + // level matrix), even if its implementation is not particularly + // sophisticated. If our coarse mesh had many more cells than the + // five we have here, something better suited would obviously be + // necessary here. template <int dim> void LaplaceProblem<dim>::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<vector_t> 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 - // <code>MGConstraints</code> 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 egdes. The + // <code>MGConstraints</code> knows about that so pass it as an + // argument. mg_transfer.build_matrices(mg_dof_handler); - matrix_t coarse_matrix; - coarse_matrix.copy_from (mg_matrices[0]); + matrix_t &coarse_matrix = mg_matrices[0]; + //coarse_matrix.copy_from (mg_matrices[0]); //MGCoarseGridHouseholder<double,vector_t> coarse_grid_solver; //coarse_grid_solver.initialize (coarse_matrix); @@ -815,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 <code>typedef</code> 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 <code>typedef</code> 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 <code>initialize()</code> 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 - // <code>set_steps()</code> 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 - // <code>mg_smoother</code> object. + // The last step is to initialize the smoother object with our + // level matrices and to set some smoothing parameters. The + // <code>initialize()</code> 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 + // <code>set_steps()</code> 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 <code>mg_smoother</code> + // object. // // The last step results from the fact that // we use the SOR method as a smoother - @@ -857,11 +803,11 @@ namespace Step50 // preconditioner make sure that we get a // symmetric operator even for nonsymmetric // smoothers: - typedef TrilinosWrappers::PreconditionSOR Smoother; + typedef TrilinosWrappers::PreconditionJacobi Smoother; MGSmootherPrecondition<matrix_t, Smoother, vector_t> mg_smoother; mg_smoother.initialize(mg_matrices); mg_smoother.set_steps(2); - mg_smoother.set_symmetric(true); + //mg_smoother.set_symmetric(false); // The next preparatory step is that we // must wrap our level and interface @@ -889,6 +835,7 @@ namespace Step50 mg_transfer, mg_smoother, mg_smoother); + //mg.set_debug(6); mg.set_edge_matrices(mg_interface_down, mg_interface_up); PreconditionMG<dim, vector_t, MGTransferPrebuilt<vector_t> > @@ -897,13 +844,35 @@ namespace Step50 // With all this together, we can finally // get about solving the linear system in // the usual way: - SolverControl solver_control (1000, 1e-12); + SolverControl solver_control (500, 1e-8*system_rhs.l2_norm(), false); SolverCG<vector_t> cg (solver_control); solution = 0; - cg.solve (system_matrix, solution, system_rhs, - preconditioner); + 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); + } + else + { + cg.solve (system_matrix, solution, system_rhs, + preconditioner); + } + constraints.distribute (solution); } @@ -932,14 +901,19 @@ namespace Step50 { Vector<float> estimated_error_per_cell (triangulation.n_active_cells()); + TrilinosWrappers::MPI::Vector temp_solution; + temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD); + temp_solution = solution; + KellyErrorEstimator<dim>::estimate (static_cast<DoFHandler<dim>&>(mg_dof_handler), QGauss<dim-1>(3), typename FunctionMap<dim>::type(), - solution, + 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 (); } @@ -950,17 +924,58 @@ namespace Step50 { DataOut<dim> data_out; - data_out.attach_dof_handler (mg_dof_handler); - data_out.add_data_vector (solution, "solution"); - data_out.build_patches (); + TrilinosWrappers::MPI::Vector temp_solution; + temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD); + temp_solution = solution; + - std::ostringstream filename; - filename << "solution-" - << cycle - << ".vtk"; + TrilinosWrappers::MPI::Vector temp = solution; + system_matrix.residual(temp,solution,system_rhs); + TrilinosWrappers::MPI::Vector res_ghosted = temp_solution; + res_ghosted = temp; - std::ofstream output (filename.str().c_str()); - data_out.write_vtk (output); + data_out.attach_dof_handler (mg_dof_handler); + data_out.add_data_vector (temp_solution, "solution"); + data_out.add_data_vector (res_ghosted, "res"); + Vector<float> 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.build_patches (3); + + const std::string filename = ("solution-" + + Utilities::int_to_string (cycle, 5) + + "." + + Utilities::int_to_string + (triangulation.locally_owned_subdomain(), 4) + + ".vtu"); + std::ofstream output (filename.c_str()); + data_out.write_vtu (output); + + if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) + { + std::vector<std::string> filenames; + for (unsigned int i=0; i<Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD); ++i) + filenames.push_back (std::string("solution-") + + Utilities::int_to_string (cycle, 5) + + "." + + Utilities::int_to_string(i, 4) + + ".vtu"); + const std::string + pvtu_master_filename = ("solution-" + + Utilities::int_to_string (cycle, 5) + + ".pvtu"); + std::ofstream pvtu_master (pvtu_master_filename.c_str()); + data_out.write_pvtu_record (pvtu_master, filenames); + + const std::string + visit_master_filename = ("solution-" + + Utilities::int_to_string (cycle, 5) + + ".visit"); + std::ofstream visit_master (visit_master_filename.c_str()); + data_out.write_visit_record (visit_master, filenames); + } } @@ -977,7 +992,7 @@ namespace Step50 template <int dim> void LaplaceProblem<dim>::run () { - for (unsigned int cycle=0; cycle<8; ++cycle) + for (unsigned int cycle=0; cycle<13; ++cycle) { deallog << "Cycle " << cycle << ':' << std::endl; @@ -985,17 +1000,13 @@ namespace Step50 { GridGenerator::hyper_cube (triangulation); - // static const HyperBallBoundary<dim> boundary; - // triangulation.set_boundary (0, boundary); - - triangulation.refine_global (2); + triangulation.refine_global (3); } else refine_grid (); - deallog << " Number of active cells: " - << triangulation.n_active_cells() + << triangulation.n_global_active_cells() << std::endl; setup_system (); @@ -1003,9 +1014,9 @@ namespace Step50 deallog << " Number of degrees of freedom: " << mg_dof_handler.n_dofs() << " (by level: "; - for (unsigned int level=0; level<triangulation.n_levels(); ++level) + for (unsigned int level=0; level<triangulation.n_global_levels(); ++level) deallog << mg_dof_handler.n_dofs(level) - << (level == triangulation.n_levels()-1 + << (level == triangulation.n_global_levels()-1 ? ")" : ", "); deallog << std::endl; diff --git a/deal.II/examples/step-6/step-6.cc b/deal.II/examples/step-6/step-6.cc index 7a5ab14778..ea45447cb6 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} @@ -397,7 +407,7 @@ void Step6<dim>::assemble_system () FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); const Coefficient<dim> coefficient; std::vector<double> coefficient_values (n_q_points); diff --git a/deal.II/examples/step-7/step-7.cc b/deal.II/examples/step-7/step-7.cc index 8e0d0bde14..ff5a243964 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 <int dim> Tensor<1,dim> Solution<dim>::gradient (const Point<dim> &p, @@ -563,7 +573,7 @@ namespace Step7 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // Then we need objects which can evaluate the values, gradients, etc of // the shape functions at the quadrature points. While it seems that it @@ -722,7 +732,7 @@ namespace Step7 hanging_node_constraints.condense (system_matrix); hanging_node_constraints.condense (system_rhs); - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, Solution<dim>(), diff --git a/deal.II/examples/step-8/step-8.cc b/deal.II/examples/step-8/step-8.cc index 2b75487b3e..b63fa0db1a 100644 --- a/deal.II/examples/step-8/step-8.cc +++ b/deal.II/examples/step-8/step-8.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} @@ -380,7 +390,7 @@ namespace Step8 FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); Vector<double> cell_rhs (dofs_per_cell); - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // As was shown in previous examples as well, we need a place where to // store the values of the coefficients at all the quadrature points on a @@ -548,7 +558,7 @@ namespace Step8 // object would represent a scalar function. Since the solution vector has // <code>dim</code> components, we need to pass <code>dim</code> as number // of components to the zero function as well. - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; VectorTools::interpolate_boundary_values (dof_handler, 0, ZeroFunction<dim>(dim), diff --git a/deal.II/examples/step-9/step-9.cc b/deal.II/examples/step-9/step-9.cc index 9a9bef8698..26df070fef 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: @@ -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 // <code>Function</code> 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 @@ -510,11 +520,11 @@ namespace Step9 // configured for multi-threading, 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 <code>MultithreadInfo</code> class contains a // read-write variable <code>n_default_threads</code> which is set to // <code>n_cpus</code> by default, but can be set to another value. This @@ -576,7 +586,7 @@ namespace Step9 // differ (<code>begin_active</code> returns an // <code>active_iterator</code>, while <code>end</code> returns a // <code>raw_iterator</code>), 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<dim>::active_cell_iterator active_cell_iterator; std::vector<std::pair<active_cell_iterator,active_cell_iterator> > @@ -611,8 +621,8 @@ 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 - // <code>joint_all</code> function in the <code>ThreadGroup</code> + // assembled. Waiting for all the threads to finish can be done using the + // <code>join_all</code> function in the <code>ThreadGroup</code> // container, which just calls <code>join</code> on each of the thread // objects it stores. // @@ -621,7 +631,7 @@ namespace Step9 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); @@ -685,7 +695,7 @@ namespace Step9 // ... an array to hold the global indices of the degrees of freedom of // the cell on which we are presently working... - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); // ... and array in which the values of right hand side, advection // direction, and boundary values will be stored, for cell and face @@ -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 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. ## -## <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> -## -##### +## --------------------------------------------------------------------- # # 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 <deal.II/algorithms/newton.h> 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 <deal.II/algorithms/operator.h> 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 <deal.II/algorithms/theta_timestepping.h> 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 9e21898d66..43d4365906 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012, 2013 by the deal.II authors // // TODO: Header // @@ -22,6 +22,16 @@ #define DEAL_II_NAMESPACE_CLOSE } +/*********************************************** + * Configured in setup_cached_variables.cmake: * + ***********************************************/ + +#cmakedefine DEAL_II_WITH_64BIT_INDICES +#ifdef DEAL_II_WITH_64BIT_INDICES +# define DEAL_II_USE_LARGE_INDEX_TYPE +#endif + + /************************************** * Configured in setup_deal_ii.cmake: * **************************************/ @@ -409,7 +419,8 @@ # define DEAL_II_USE_MT #endif -/* Defined if multi-threading is to be achieved by using the POSIX functions +/** + * Defined if multi-threading is to be achieved by using the POSIX functions */ #cmakedefine DEAL_II_USE_MT_POSIX 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 <tt>n cells</tt> or <tt>n dofs</tt> 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..b054a3a822 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 @@ -1274,66 +1279,66 @@ 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. <tt>height_vector==0</tt>, if - * there is any data vector. If there - * is no data vector, no height - * information is generated. - */ - unsigned int height_vector; + 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. <tt>height_vector==0</tt>, if + * there is any data vector. If there + * is no data vector, no height + * information is generated. + */ + unsigned int height_vector; - /* - * Angles for the perspective view - */ - int azimuth_angle, polar_angle; - - unsigned int line_thickness; + /* + * Angles for the perspective view + */ + int azimuth_angle, polar_angle; - /* - * Draw a margin of 5% around the plotted area - */ - bool margin; + unsigned int line_thickness; - /* - * Draw a colorbar encoding the cell coloring - */ - bool draw_colorbar; + /* + * Draw a margin of 5% around the plotted area + */ + bool margin; - /* - * 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); + /* + * Draw a colorbar encoding the cell coloring + */ + bool draw_colorbar; - /** - * 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 <tt>std::map</tt> 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: + /* + * 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 <tt>std::map</tt> 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: }; @@ -1491,7 +1496,7 @@ public: vtu, /** - * Output in + * Output in * SVG format. */ svg, @@ -1865,23 +1870,23 @@ public: const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &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 +1898,7 @@ public: const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &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 @@ -2124,19 +2129,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. */ - 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); /** * Function to compute the gradient parameters for @@ -2676,7 +2681,7 @@ public: * in SVG format. See * DataOutBase::write_svg. */ - void write_svg(std::ostream &out) const; + void write_svg(std::ostream &out) const; /** * Obtain data through get_patches() diff --git a/deal.II/include/deal.II/base/derivative_form.h b/deal.II/include/deal.II/base/derivative_form.h index 40d75b649b..313c343759 100644 --- a/deal.II/include/deal.II/base/derivative_form.h +++ b/deal.II/include/deal.II/base/derivative_form.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__derivative_form_h #define __deal2__derivative_form_h @@ -344,7 +360,7 @@ DerivativeForm<order,dim,spacedim>::covariant_form() const Tensor<2,dim> DF_t (dealii::transpose(invert( (Tensor<2,dim>)(*this) ))); DerivativeForm<1,dim, spacedim> result = DF_t; - return(result); + return (result); } else { diff --git a/deal.II/include/deal.II/base/event.h b/deal.II/include/deal.II/base/event.h index 7d1b92cb6a..4ceeed33ec 100644 --- a/deal.II/include/deal.II/base/event.h +++ b/deal.II/include/deal.II/base/event.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__event_h #define __deal2__event_h diff --git a/deal.II/include/deal.II/base/exceptions.h b/deal.II/include/deal.II/base/exceptions.h index 94867d5767..ffea72d31a 100644 --- a/deal.II/include/deal.II/base/exceptions.h +++ b/deal.II/include/deal.II/base/exceptions.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $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. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any 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__exceptions_h #define __deal2__exceptions_h @@ -79,7 +84,7 @@ public: /** * Print more specific information about the exception which - * occured. Overload this function in your own exception classes. + * occurred. Overload this function in your own exception classes. */ virtual void print_info (std::ostream &out) const; @@ -148,7 +153,7 @@ namespace deal_II_exceptions * processes is redirected to the same console window. In this case, * it is convenient to set as additional name the name of the host on * which the program runs, so that one can see in which instance of the - * program the exception occured. + * program the exception occurred. * * The string pointed to by the argument is copied, so doesn't need to be * stored after the call to this function. @@ -677,6 +682,16 @@ namespace StandardExceptions << "Index " << arg1 << " is not in [" << arg2 << "," << arg3 << "["); + /** + * This generic exception will allow(enforce) the user to specify + * the type of indices which adds type safety to the program. + */ + template<typename T> + DeclException3 (ExcIndexRangeType, + T,T,T, + << "Index " << arg1 << " is not in [" << arg2 << "," + << arg3 << "["); + /** * A number is too small. */ @@ -685,6 +700,15 @@ namespace StandardExceptions << "Number " << arg1 << " must be larger or equal " << arg2); + /** + * A generic exception definition for the ExcLowerRange above. + */ + template<typename T> + DeclException2 (ExcLowerRangeType, + T, T, + << "Number " << arg1 << " must be larger or equal " + << arg2); + /** * This exception indicates that the first argument should be an * integer multiple of the second, but is not. @@ -805,6 +829,9 @@ namespace StandardExceptions #define AssertIndexRange(index,range) Assert((index) < (range), \ ExcIndexRange((index),0,(range))) +#define AssertGlobalIndexRange(index,range) Assert((index) < (range), \ + ExcIndexRange<types::global_dof_index>((index),0,(range))) + using namespace StandardExceptions; DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/base/flow_function.h b/deal.II/include/deal.II/base/flow_function.h index 7c5671e79a..3f6c58547f 100644 --- a/deal.II/include/deal.II/base/flow_function.h +++ b/deal.II/include/deal.II/base/flow_function.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__flow_function_h #define __deal2__flow_function_h diff --git a/deal.II/include/deal.II/base/function.h b/deal.II/include/deal.II/base/function.h index fafa9ded88..616f6de210 100644 --- a/deal.II/include/deal.II/base/function.h +++ b/deal.II/include/deal.II/base/function.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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__function_h #define __deal2__function_h @@ -114,11 +119,8 @@ class Function : public FunctionTime, { public: /** - * Export the value of the - * template parameter as a static - * member constant. Sometimes - * useful for some expression - * template programming. + * Export the value of the template parameter as a static member + * constant. Sometimes useful for some expression template programming. */ static const unsigned int dimension = dim; @@ -128,20 +130,15 @@ public: const unsigned int n_components; /** - * Constructor. May take an - * initial value for the number - * of components (which defaults - * to one, i.e. a scalar - * function), and the time - * variable, which defaults to - * zero. + * Constructor. May take an initial value for the number of components + * (which defaults to one, i.e. a scalar function), and the time + * variable, which defaults to zero. */ Function (const unsigned int n_components = 1, const double initial_time = 0.0); /** - * Virtual destructor; absolutely - * necessary in this case. + * Virtual destructor; absolutely necessary in this case. * * This destructor is declared pure virtual, such that objects of this class * cannot be created. Since all the other virtual functions have a @@ -158,220 +155,160 @@ public: * the abstractness of any derived class even if they do not have an * explicitly declared destructor. * - * Nonetheless, since derived - * classes want to call the - * destructor of a base class, - * this destructor is implemented - * (despite it being pure + * Nonetheless, since derived classes want to call the destructor of a + * base class, this destructor is implemented (despite it being pure * virtual). */ virtual ~Function () = 0; /** - * Assignment operator. This is - * here only so that you can have - * objects of derived classes in - * containers, or assign them - * otherwise. It will raise an - * exception if the object from - * which you assign has a - * different number of components - * than the one being assigned - * to. + * Assignment operator. This is here only so that you can have objects of + * derived classes in containers, or assign them otherwise. It will raise + * an exception if the object from which you assign has a different + * number of components than the one being assigned to. */ Function &operator= (const Function &f); /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the + * Return the value of the function at the given point. Unless there is + * only one component (i.e. the function is scalar), you should state the + * component you want to have evaluated; it defaults to zero, i.e. the * first component. */ virtual double value (const Point<dim> &p, const unsigned int component = 0) const; /** - * Return all components of a - * vector-valued function at a - * given point. + * Return all components of a vector-valued function at a given point. * - * <tt>values</tt> shall have the right - * size beforehand, - * i.e. #n_components. + * <tt>values</tt> shall have the right size beforehand, i.e. + * #n_components. */ virtual void vector_value (const Point<dim> &p, Vector<double> &values) const; /** - * Set <tt>values</tt> to the point - * values of the specified - * component of the function at - * the <tt>points</tt>. It is assumed - * that <tt>values</tt> already has the - * right size, i.e. the same - * size as the <tt>points</tt> array. + * Set <tt>values</tt> to the point values of the specified component of + * the function at the <tt>points</tt>. It is assumed that + * <tt>values</tt> already has the right size, i.e. the same size as the + * <tt>points</tt> array. * - * Be default, this function - * repeatedly calls value() for - * each point separately, to - * fill the output array. + * Be default, this function repeatedly calls value() for each point + * separately, to fill the output array. */ virtual void value_list (const std::vector<Point<dim> > &points, std::vector<double> &values, const unsigned int component = 0) const; /** - * Set <tt>values</tt> to the point - * values of the function at the - * <tt>points</tt>. It is assumed that - * <tt>values</tt> already has the right - * size, i.e. the same size as - * the <tt>points</tt> array, and that - * all elements be vectors with - * the same number of components - * as this function has. + * Set <tt>values</tt> to the point values of the function at the + * <tt>points</tt>. It is assumed that <tt>values</tt> already has the + * right size, i.e. the same size as the <tt>points</tt> array, and that + * all elements be vectors with the same number of components as this + * function has. * - * Be default, this function - * repeatedly calls vector_value() for - * each point separately, to - * fill the output array. + * Be default, this function repeatedly calls vector_value() for each + * point separately, to fill the output array. */ virtual void vector_value_list (const std::vector<Point<dim> > &points, std::vector<Vector<double> > &values) const; /** - * For each component of the - * function, fill a vector of - * values, one for each point. + * For each component of the function, fill a vector of values, one for + * each point. * - * The default implementation of - * this function in Function calls - * value_list() for each - * component. In order to improve - * performance, this can be - * reimplemented in derived - * classes to speed up performance. + * The default implementation of this function in Function calls + * value_list() for each component. In order to improve performance, this + * can be reimplemented in derived classes to speed up performance. */ virtual void vector_values (const std::vector<Point<dim> > &points, std::vector<std::vector<double> > &values) const; /** - * Return the gradient of the - * specified component of the - * function at the given point. + * Return the gradient of the specified component of the function at the + * given point. */ virtual Tensor<1,dim> gradient (const Point<dim> &p, const unsigned int component = 0) const; /** - * Return the gradient of all - * components of the - * function at the given point. + * Return the gradient of all components of the function at the given + * point. */ virtual void vector_gradient (const Point<dim> &p, std::vector<Tensor<1,dim> > &gradients) const; /** - * Set <tt>gradients</tt> to the - * gradients of the specified - * component of the function at - * the <tt>points</tt>. It is assumed - * that <tt>gradients</tt> already has the - * right size, i.e. the same - * size as the <tt>points</tt> array. + * Set <tt>gradients</tt> to the gradients of the specified component of + * the function at the <tt>points</tt>. It is assumed that + * <tt>gradients</tt> already has the right size, i.e. the same size as + * the <tt>points</tt> array. */ virtual void gradient_list (const std::vector<Point<dim> > &points, std::vector<Tensor<1,dim> > &gradients, const unsigned int component = 0) const; /** - * For each component of the - * function, fill a vector of - * gradient values, one for each point. + * For each component of the function, fill a vector of gradient values, + * one for each point. * - * The default implementation of - * this function in Function calls - * value_list() for each - * component. In order to improve - * performance, this can be - * reimplemented in derived - * classes to speed up performance. + * The default implementation of this function in Function calls + * value_list() for each component. In order to improve performance, this + * can be reimplemented in derived classes to speed up performance. */ virtual void vector_gradients (const std::vector<Point<dim> > &points, std::vector<std::vector<Tensor<1,dim> > > &gradients) const; /** - * Set <tt>gradients</tt> to the gradients of - * the function at the <tt>points</tt>, - * for all components. - * It is assumed that <tt>gradients</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> array. + * Set <tt>gradients</tt> to the gradients of the function at the + * <tt>points</tt>, for all components. It is assumed that + * <tt>gradients</tt> already has the right size, i.e. the same size as + * the <tt>points</tt> array. * - * The outer loop over - * <tt>gradients</tt> is over the points - * in the list, the inner loop - * over the different components - * of the function. + * The outer loop over <tt>gradients</tt> is over the points in the list, + * the inner loop over the different components of the function. */ virtual void vector_gradient_list (const std::vector<Point<dim> > &points, std::vector<std::vector<Tensor<1,dim> > > &gradients) const; /** - * Compute the Laplacian of a - * given component at point <tt>p</tt>. + * Compute the Laplacian of a given component at point <tt>p</tt>. */ virtual double laplacian (const Point<dim> &p, const unsigned int component = 0) const; /** - * Compute the Laplacian of all - * components at point <tt>p</tt> and - * store them in <tt>values</tt>. + * Compute the Laplacian of all components at point <tt>p</tt> and store + * them in <tt>values</tt>. */ virtual void vector_laplacian (const Point<dim> &p, Vector<double> &values) const; /** - * Compute the Laplacian of one - * component at a set of points. + * Compute the Laplacian of one component at a set of points. */ virtual void laplacian_list (const std::vector<Point<dim> > &points, std::vector<double> &values, const unsigned int component = 0) const; /** - * Compute the Laplacians of all - * components at a set of points. + * Compute the Laplacians of all components at a set of points. */ virtual void vector_laplacian_list (const std::vector<Point<dim> > &points, std::vector<Vector<double> > &values) const; /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL <tt>std::map</tt> 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 + * <tt>std::map</tt> type with a certain number of elements?), this is + * only an estimate. however often quite close to the true value. */ std::size_t memory_consumption () const; }; + /** * Provide a function which always returns zero. Obviously, also the * derivates of this function are zero. Also, it returns zero on all @@ -390,126 +327,64 @@ class ZeroFunction : public Function<dim> { public: /** - * Constructor. The number of - * components is preset to one. + * Constructor. The number of components is preset to one. */ ZeroFunction (const unsigned int n_components = 1); /** - * Virtual destructor; absolutely - * necessary in this case. + * Virtual destructor; absolutely necessary in this case. + * */ virtual ~ZeroFunction (); - /** - * Return the value of the function - * at the given point for one - * component. - */ virtual double value (const Point<dim> &p, const unsigned int component) const; - /** - * Return the value of the function - * at the given point for all - * components. - */ virtual void vector_value (const Point<dim> &p, Vector<double> &return_value) const; - /** - * Set <tt>values</tt> to the point values - * of the function at the <tt>points</tt>, - * for the given component. - * It is assumed that <tt>values</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> - * array. - */ virtual void value_list (const std::vector<Point<dim> > &points, std::vector<double> &values, const unsigned int component = 0) const; - /** - * Set <tt>values</tt> to the point values - * of the function at the <tt>points</tt>, - * for all components. - * It is assumed that <tt>values</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> - * array. - */ virtual void vector_value_list (const std::vector<Point<dim> > &points, std::vector<Vector<double> > &values) const; - /** - * Return the gradient of the function - * at the given point, for the - * given component. - */ virtual Tensor<1,dim> gradient (const Point<dim> &p, const unsigned int component = 0) const; - /** - * Return the gradient of the - * specified component of the - * function at the given point, - * for all components. - */ virtual void vector_gradient (const Point<dim> &p, std::vector<Tensor<1,dim> > &gradients) const; - /** - * Set <tt>gradients</tt> to the gradients of - * the function at the <tt>points</tt>, - * for the given component. - * It is assumed that <tt>values</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> array. - */ virtual void gradient_list (const std::vector<Point<dim> > &points, std::vector<Tensor<1,dim> > &gradients, const unsigned int component = 0) const; - /** - * Set <tt>gradients</tt> to the gradients of - * the function at the <tt>points</tt>, - * for all components. - * It is assumed that <tt>gradients</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> array. - * - * The outer loop over - * <tt>gradients</tt> is over the points - * in the list, the inner loop - * over the different components - * of the function. - */ virtual void vector_gradient_list (const std::vector<Point<dim> > &points, std::vector<std::vector<Tensor<1,dim> > > &gradients) const; }; + /** * Provide a function which always returns the constant value * handed to the constructor. * - * Obviously, the derivates of this - * function are zero, which is why we derive this class from - * <tt>ZeroFunction</tt>: we then only have to overload the value functions, - * not all the derivatives. In some way, it would be more obvious to - * do the derivation in the opposite direction, i.e. let - * <tt>ZeroFunction</tt> be a more specialized version of <tt>ConstantFunction</tt>; - * however, this would be less efficient, since we could not make - * use of the fact that the function value of the <tt>ZeroFunction</tt> is - * known at compile time and need not be looked up somewhere in - * memory. + * Obviously, the derivates of this function are zero, which is why we + * derive this class from <tt>ZeroFunction</tt>: we then only have to + * overload the value functions, not all the derivatives. In some way, it + * would be more obvious to do the derivation in the opposite direction, + * i.e. let <tt>ZeroFunction</tt> be a more specialized version of + * <tt>ConstantFunction</tt>; however, this would be less efficient, since + * we could not make use of the fact that the function value of the + * <tt>ZeroFunction</tt> is known at compile time and need not be looked up + * somewhere in memory. * * You can pass to the constructor an integer denoting the number of * components this function shall have. It defaults to one. If it is - * greater than one, then the function will return the constant value - * in all its components, which might not be overly useful a feature - * in most cases, however. + * greater than one, then the function will return the constant value in + * all its components, which might not be overly useful a feature in most + * cases, however. * * @ingroup functions * @author Wolfgang Bangerth, 1998, 1999 @@ -519,76 +394,30 @@ class ConstantFunction : public ZeroFunction<dim> { public: /** - * Constructor; takes the constant function - * value as an argument. The number of - * components is preset to one. + * Constructor; takes the constant function value as an argument. The + * number of components is preset to one. */ ConstantFunction (const double value, const unsigned int n_components = 1); /** - * Virtual destructor; absolutely - * necessary in this case. + * Virtual destructor; absolutely necessary in this case. */ virtual ~ConstantFunction (); - /** - * Return the value of the function - * at the given point for one - * component. - */ virtual double value (const Point<dim> &p, const unsigned int component) const; - /** - * Return the value of the function - * at the given point for all - * components. - */ virtual void vector_value (const Point<dim> &p, Vector<double> &return_value) const; - /** - * Set <tt>values</tt> to the point values - * of the function at the <tt>points</tt>, - * for the given component. - * It is assumed that <tt>values</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> - * array. - */ virtual void value_list (const std::vector<Point<dim> > &points, std::vector<double> &values, const unsigned int component = 0) const; - /** - * Set <tt>values</tt> to the point values - * of the function at the <tt>points</tt>, - * for all components. - * It is assumed that <tt>values</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> - * array. - */ virtual void vector_value_list (const std::vector<Point<dim> > &points, std::vector<Vector<double> > &values) const; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL <tt>std::map</tt> type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ std::size_t memory_consumption () const; protected: @@ -602,15 +431,14 @@ protected: /** * This is a constant vector-valued function, in which one or more - * components of the vector have a constant value and all other - * components are zero. It is especially useful as a weight function - * for VectorTools::integrate_difference, where it allows to - * integrate only one or a few vector components, rather than the - * entire vector-valued solution. In other words, it acts as a - * component mask with a single component selected (see the - * @ref GlossComponentMask "the glossary entry on component masks"). - * See the step-20 - * tutorial program for a detailed explanation and a use case. + * components of the vector have a constant value and all other components + * are zero. It is especially useful as a weight function for + * VectorTools::integrate_difference, where it allows to integrate only one + * or a few vector components, rather than the entire vector-valued + * solution. In other words, it acts as a component mask with a single + * component selected (see the @ref GlossComponentMask "the glossary entry + * on component masks"). See the step-20 tutorial program for a detailed + * explanation and a use case. * * @ingroup functions * @author Guido Kanschat, 2000, Wolfgang Bangerth 2006 @@ -620,120 +448,92 @@ class ComponentSelectFunction : public ConstantFunction<dim> { public: /** - * Constructor if only a single - * component shall be - * non-zero. Arguments denote the - * component selected, the value - * for that component and the - * total number of vector - * components. + * Constructor if only a single component shall be non-zero. Arguments + * denote the component selected, the value for that component and the + * total number of vector components. */ ComponentSelectFunction (const unsigned int selected, const double value, const unsigned int n_components); /** - * Constructor. As before, but - * the value for the selected - * component is assumed to be - * one. In essence, this function - * then works as a mask. + * Constructor. As before, but the value for the selected component is + * assumed to be one. In essence, this function then works as a mask. */ ComponentSelectFunction (const unsigned int selected, const unsigned int n_components); /** - * Constructor if multiple - * components shall have - * non-zero, unit values - * (i.e. this should be a mask - * for multiple components). The - * first argument denotes a - * half-open interval of - * components (for example - * std::pair(0,dim) for the first - * dim components), and the - * second argument is the total - * number of vector components. + * Constructor if multiple components shall have non-zero, unit values + * (i.e. this should be a mask for multiple components). The first + * argument denotes a half-open interval of components (for example + * std::pair(0,dim) for the first dim components), and the second + * argument is the total number of vector components. */ ComponentSelectFunction (const std::pair<unsigned int, unsigned int> &selected, const unsigned int n_components); /** - * Return the value of the function - * at the given point for all + * Return the value of the function at the given point for all * components. */ virtual void vector_value (const Point<dim> &p, Vector<double> &return_value) const; /** - * Set <tt>values</tt> to the point values - * of the function at the <tt>points</tt>, - * for all components. - * It is assumed that <tt>values</tt> - * already has the right size, i.e. - * the same size as the <tt>points</tt> - * array. + * Set <tt>values</tt> to the point values of the function at the + * <tt>points</tt>, for all components. It is assumed that + * <tt>values</tt> already has the right size, i.e. the same size as the + * <tt>points</tt> array. */ virtual void vector_value_list (const std::vector<Point<dim> > &points, std::vector<Vector<double> > &values) const; /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL <tt>std::map</tt> 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 + * <tt>std::map</tt> type with a certain number of elements?), this is + * only an estimate. however often quite close to the true value. */ std::size_t memory_consumption () const; protected: /** - * Half-open interval of the - * indices of selected - * components. + * Half-open interval of the indices of selected components. */ const std::pair<unsigned int,unsigned int> selected_components; }; + /** * This class provides a way to convert a scalar function of the kind * @code * double foo (const Point<dim> &); * @endcode - * into an object of type Function@<dim@>. - * Since the argument returns a scalar, the result is clearly a - * Function object for which <code>function.n_components==1</code>. - * The class works by storing a pointer to the given function and - * every time <code>function.value(p,component)</code> is called, - * calls <code>foo(p)</code> and returns the corresponding value. It - * also makes sure that <code>component</code> is in fact zero, as needs - * be for scalar functions. + * into an object of type Function@<dim@>. Since the argument returns a + * scalar, the result is clearly a Function object for which + * <code>function.n_components==1</code>. The class works by storing a + * pointer to the given function and every time + * <code>function.value(p,component)</code> is called, calls + * <code>foo(p)</code> and returns the corresponding value. It also makes + * sure that <code>component</code> is in fact zero, as needs be for scalar + * functions. * * The class provides an easy way to turn a simple global function into * something that has the required Function@<dim@> interface for operations - * like VectorTools::interpolate_boundary_values() etc., and thereby - * allows for simpler experimenting without having to write all the - * boiler plate code of declaring a class that is derived from Function - * and implementing the Function::value() function. + * like VectorTools::interpolate_boundary_values() etc., and thereby allows + * for simpler experimenting without having to write all the boiler plate + * code of declaring a class that is derived from Function and implementing + * the Function::value() function. * * The class gains additional expressvive power because the argument it * takes does not have to be a pointer to an actual function. Rather, it is - * a function object, i.e., it can also be the result of call to - * std::bind (or boost::bind) or some other object that can be called with - * a single argument. For example, if you need a Function object that - * returns the norm of a point, you could write it like so: + * a function object, i.e., it can also be the result of call to std::bind + * (or boost::bind) or some other object that can be called with a single + * argument. For example, if you need a Function object that returns the + * norm of a point, you could write it like so: * @code * template <int dim> * class Norm : public Function<dim> { @@ -747,8 +547,8 @@ protected: * * Norm<2> my_norm_object; * @endcode - * and then pass the <code>my_norm_object</code> around, or you could write it - * like so: + * and then pass the <code>my_norm_object</code> around, or you could write + * it like so: * @code * ScalarFunctionFromFunctionObject<dim> my_norm_object (&Point<dim>::norm); * @endcode @@ -788,18 +588,14 @@ class ScalarFunctionFromFunctionObject : public Function<dim> { public: /** - * Given a function object that takes a Point and returns a double - * value, convert this into an object that matches the Function<dim> - * interface. + * Given a function object that takes a Point and returns a double value, + * convert this into an object that matches the Function<dim> interface. */ ScalarFunctionFromFunctionObject (const std_cxx1x::function<double (const Point<dim> &)> &function_object); /** - * Return the value of the - * function at the given - * point. Returns the value the - * function given to the constructor - * produces for this point. + * Return the value of the function at the given point. Returns the value + * the function given to the constructor produces for this point. */ virtual double value (const Point<dim> &p, const unsigned int component = 0) const; @@ -813,24 +609,25 @@ private: }; + /** - * This class is similar to the ScalarFunctionFromFunctionObject class in that it - * allows for the easy conversion of a function object to something that - * satisfies the interface of the Function base class. The difference is - * that here, the given function object is still a scalar function - * (i.e. it has a single value at each space point) but that the Function - * object generated is vector valued. The number of vector components - * is specified in the constructor, where one also selectes a single - * one of these vector components that should be filled by the passed - * object. The result is a vector Function object that returns zero in - * each component except the single selected one where it returns the - * value returned by the given as the first argument to the constructor. + * This class is similar to the ScalarFunctionFromFunctionObject class in + * that it allows for the easy conversion of a function object to something + * that satisfies the interface of the Function base class. The difference + * is that here, the given function object is still a scalar function (i.e. + * it has a single value at each space point) but that the Function object + * generated is vector valued. The number of vector components is specified + * in the constructor, where one also selectes a single one of these vector + * components that should be filled by the passed object. The result is a + * vector Function object that returns zero in each component except the + * single selected one where it returns the value returned by the given as + * the first argument to the constructor. * - * @note In the above discussion, note the difference between the - * (scalar) "function object" (i.e., a C++ object <code>x</code> that can - * be called as in <code>x(p)</code>) and the capitalized (vector valued) - * "Function object" (i.e., an object of a class that is derived from - * the Function base class). + * @note In the above discussion, note the difference between the (scalar) + * "function object" (i.e., a C++ object <code>x</code> that can be called + * as in <code>x(p)</code>) and the capitalized (vector valued) "Function + * object" (i.e., an object of a class that is derived from the Function + * base class). * * To be more concrete, let us consider the following example: * @code @@ -838,12 +635,12 @@ private: * VectorFunctionFromScalarFunctionObject<2> * component_mask (&one, 1, 3); * @endcode - * Here, <code>component_mask</code> then represents a Function object - * that for every point returns the vector $(0, 1, 0)^T$, i.e. a mask - * function that could, for example, be passed to VectorTools::integrate_difference(). - * This effect can also be achieved using the ComponentSelectFunction - * class but is obviously easily extended to functions that are - * non-constant in their one component. + * Here, <code>component_mask</code> then represents a Function object that + * for every point returns the vector $(0, 1, 0)^T$, i.e. a mask function + * that could, for example, be passed to + * VectorTools::integrate_difference(). This effect can also be achieved + * using the ComponentSelectFunction class but is obviously easily extended + * to functions that are non-constant in their one component. * * @author Wolfgang Bangerth, 2011 */ @@ -868,23 +665,17 @@ public: const unsigned int n_components); /** - * Return the value of the - * function at the given - * point. Returns the value the - * function given to the constructor - * produces for this point. + * Return the value of the function at the given point. Returns the value + * the function given to the constructor produces for this point. */ virtual double value (const Point<dim> &p, const unsigned int component = 0) const; /** - * Return all components of a - * vector-valued function at a - * given point. + * Return all components of a vector-valued function at a given point. * - * <tt>values</tt> shall have the right - * size beforehand, - * i.e. #n_components. + * <tt>values</tt> shall have the right size beforehand, i.e. + * #n_components. */ virtual void vector_value (const Point<dim> &p, Vector<double> &values) const; @@ -897,22 +688,22 @@ private: const std_cxx1x::function<double (const Point<dim> &)> function_object; /** - * The vector component whose value is to be filled by the - * given scalar function. + * The vector component whose value is to be filled by the given scalar + * function. */ const unsigned int selected_component; }; /** - * This class is built as a means of translating - * the <code>Tensor<1,dim> </code> values produced by objects of type - * TensorFunction and returning them as a multiple - * component version of the same thing as a Vector for use in, for example, - * the VectorTools::interpolate or the many other functions taking Function objects. - * It allows the user to place the desired components into an <tt>n_components</tt> - * long vector starting at the <tt>selected_component</tt> location in that vector and have all other - * components be 0. + * This class is built as a means of translating the <code>Tensor<1,dim> + * </code> values produced by objects of type TensorFunction and returning + * them as a multiple component version of the same thing as a Vector for + * use in, for example, the VectorTools::interpolate or the many other + * functions taking Function objects. It allows the user to place the + * desired components into an <tt>n_components</tt> long vector starting at + * the <tt>selected_component</tt> location in that vector and have all + * other components be 0. * * For example: Say you created a class called * @code @@ -923,11 +714,12 @@ private: * RightHandSide<1,dim> rhs; * @endcode * of that class which you want to interpolate onto your mesh using the - * VectorTools::interpolate function, but the finite element you use for the DoFHandler - * object has 3 copies of a finite element with <tt>dim</tt> components, for a total of 3*dim - * components. To interpolate onto that DoFHandler, you need an object of type Function - * that has 3*dim vector components. Creating such an object from the existing <code>rhs</code> - * object is done using this piece of code: + * VectorTools::interpolate function, but the finite element you use for + * the DoFHandler object has 3 copies of a finite element with + * <tt>dim</tt> components, for a total of 3*dim components. To + * interpolate onto that DoFHandler, you need an object of type Function + * that has 3*dim vector components. Creating such an object from the + * existing <code>rhs</code> object is done using this piece of code: * @code * RighHandSide<1,dim> rhs; * VectorFunctionFromTensorFunction<dim> rhs_vector_function (rhs, 0, 3*dim); @@ -942,77 +734,70 @@ class VectorFunctionFromTensorFunction : public Function<dim> { public: /** - * Given a TensorFunction object that takes a <tt>Point</tt> and returns a <tt>Tensor<1,dim></tt> - * value, convert this into an object that matches the Function@<dim@> - * interface. + * Given a TensorFunction object that takes a <tt>Point</tt> and returns + * a <tt>Tensor<1,dim></tt> value, convert this into an object that + * matches the Function@<dim@> interface. * - * By default, create a Vector object of the same size as <tt>tensor_function</tt> - * returns, i.e., with <tt>dim</tt> components. + * By default, create a Vector object of the same size as + * <tt>tensor_function</tt> returns, i.e., with <tt>dim</tt> components. * * @param tensor_function The TensorFunction that will form one component * of the resulting Vector Function object. * @param n_components The total number of vector components of the * resulting TensorFunction object. * @param selected_component The first component that should be - * filled by the first argument. This should be such that the entire tensor_function - * fits inside the <tt>n_component</tt> length return vector. + * filled by the first argument. This should be such that the entire + * tensor_function fits inside the <tt>n_component</tt> length return + * vector. */ VectorFunctionFromTensorFunction (const TensorFunction<1,dim> &tensor_function, const unsigned int selected_component=0, const unsigned int n_components=dim); /** - * This destructor is defined as - * virtual so as to coincide with all - * other aspects of class. + * This destructor is defined as virtual so as to coincide with all other + * aspects of class. */ virtual ~VectorFunctionFromTensorFunction(); /** - * Return a single component of a - * vector-valued function at a - * given point. + * Return a single component of a vector-valued function at a given + * point. */ virtual double value (const Point<dim> &p, const unsigned int component = 0) const; /** - * Return all components of a - * vector-valued function at a - * given point. + * Return all components of a vector-valued function at a given point. * - * <tt>values</tt> shall have the right - * size beforehand, - * i.e. #n_components. + * <tt>values</tt> shall have the right size beforehand, i.e. + * #n_components. */ virtual void vector_value (const Point<dim> &p, Vector<double> &values) const; /** - * Return all components of a - * vector-valued function at a - * list of points. + * Return all components of a vector-valued function at a list of points. * - * <tt>value_list</tt> shall be the same - * size as <tt>points</tt> and each element - * of the vector will be passed to - * vector_value() to evaluate - * the function + * <tt>value_list</tt> shall be the same size as <tt>points</tt> and each + * element of the vector will be passed to vector_value() to evaluate the + * function */ virtual void vector_value_list (const std::vector<Point<dim> > &points, std::vector<Vector<double> > &value_list) const; private: /** - * The TensorFunction object which we call when this class's vector_value() - * or vector_value_list() functions are called. + * The TensorFunction object which we call when this class's + * vector_value() or vector_value_list() functions are called. **/ - const TensorFunction<1,dim> & tensor_function; + const TensorFunction<1,dim> &tensor_function; /** - * The first vector component whose value is to be filled by the - * given TensorFunction. The values will be placed in components - * selected_component to selected_component+dim-1 for a <tt>TensorFunction<1,dim></tt> object. + * The first vector component whose value is to be filled by the given + * TensorFunction. The values will be placed in components + * selected_component to selected_component+dim-1 for a + * <tt>TensorFunction<1,dim></tt> object. */ const unsigned int selected_component; }; diff --git a/deal.II/include/deal.II/base/function_bessel.h b/deal.II/include/deal.II/base/function_bessel.h index 0b7f3c144a..269b908e59 100644 --- a/deal.II/include/deal.II/base/function_bessel.h +++ b/deal.II/include/deal.II/base/function_bessel.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__function_bessel_h #define __deal2__function_bessel_h diff --git a/deal.II/include/deal.II/base/function_derivative.h b/deal.II/include/deal.II/base/function_derivative.h index 03400629d8..a918b1bb61 100644 --- a/deal.II/include/deal.II/base/function_derivative.h +++ b/deal.II/include/deal.II/base/function_derivative.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__function_derivative_h #define __deal2__function_derivative_h diff --git a/deal.II/include/deal.II/base/function_lib.h b/deal.II/include/deal.II/base/function_lib.h index 26bd37c952..5e49212269 100644 --- a/deal.II/include/deal.II/base/function_lib.h +++ b/deal.II/include/deal.II/base/function_lib.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__function_lib_h #define __deal2__function_lib_h diff --git a/deal.II/include/deal.II/base/function_parser.h b/deal.II/include/deal.II/base/function_parser.h index 7002002685..0fff67c271 100644 --- a/deal.II/include/deal.II/base/function_parser.h +++ b/deal.II/include/deal.II/base/function_parser.h @@ -1,15 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- #ifndef __deal2__function_parser_h #define __deal2__function_parser_h diff --git a/deal.II/include/deal.II/base/function_time.h b/deal.II/include/deal.II/base/function_time.h index 62fbb75cd9..3615f51f73 100644 --- a/deal.II/include/deal.II/base/function_time.h +++ b/deal.II/include/deal.II/base/function_time.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__function_time_h #define __deal2__function_time_h diff --git a/deal.II/include/deal.II/base/geometry_info.h b/deal.II/include/deal.II/base/geometry_info.h index b2d09128bc..4704ebfdf6 100644 --- a/deal.II/include/deal.II/base/geometry_info.h +++ b/deal.II/include/deal.II/base/geometry_info.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 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__geometry_info_h #define __deal2__geometry_info_h @@ -1208,8 +1213,8 @@ struct GeometryInfo<0> * from one cell, whereas it is according to the standard looking at it from the * neighboring cell sharing that particular face. In order to cope with this, * two flags <tt>face_flip</tt> and <tt>face_rotation</tt> are available, to - * represent rotations by 90 and 180 degree, respectively. Setting both flags - * accumulates to a rotation of 270 degrees (all counterclockwise). You can ask + * represent rotations by 180 and 90 degree, respectively. Setting both flags + * amounts to a rotation of 270 degrees (all counterclockwise). You can ask * the cell for these flags like for the <tt>face_orientation</tt>. In order to * enable rotated faces, even lines can deviate from their standard direction in * 3d. This information is available as the <tt>line_orientation</tt> flag for diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index aff873cba7..b5b439d990 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -1,21 +1,25 @@ -//--------------------------------------------------------------------------- -// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__index_set_h #define __deal2__index_set_h #include <deal.II/base/config.h> #include <deal.II/base/utilities.h> #include <deal.II/base/exceptions.h> - #include <vector> #include <algorithm> @@ -27,7 +31,9 @@ #include <mpi.h> #else typedef int MPI_Comm; -#define MPI_COMM_WORLD 0 +# ifndef MPI_COMM_WORLD +# define MPI_COMM_WORLD 0 +# endif #endif DEAL_II_NAMESPACE_OPEN @@ -64,7 +70,7 @@ public: * overall size of the index * range. */ - explicit IndexSet (const unsigned int size); + explicit IndexSet (const types::global_dof_index size); /** * Remove all indices from this @@ -84,7 +90,7 @@ public: * This can be achieved by calling * clear(), for example. */ - void set_size (const unsigned int size); + void set_size (const types::global_dof_index size); /** * Return the size of the index @@ -96,7 +102,7 @@ public: * set. The latter information is * returned by n_elements(). */ - unsigned int size () const; + types::global_dof_index size () const; /** * Add the half-open range @@ -104,14 +110,14 @@ public: * the set of indices represented * by this class. */ - void add_range (const unsigned int begin, - const unsigned int end); + void add_range (const types::global_dof_index begin, + const types::global_dof_index end); /** * Add an individual index to the * set of indices. */ - void add_index (const unsigned int index); + void add_index (const types::global_dof_index index); /** * Add a whole set of indices @@ -128,15 +134,30 @@ public: * Add the given IndexSet @p other to the * current one, constructing the union of * *this and @p other. + * + * If the @p offset argument is nonzero, then every + * index in @p other is shifted by @p offset before being + * added to the current index set. This allows to construct, + * for example, one index set from several others that are + * supposed to represent index sets corresponding to + * different ranges (e.g., when constructing the set of + * nonzero entries of a block vector from the sets of nonzero + * elements of the individual blocks of a vector). + * + * This function will generate an exception if any of the + * (possibly shifted) indices of the @p other index set + * lie outside the range <code>[0,size())</code> represented + * by the current object. */ - void add_indices(const IndexSet &other); + void add_indices(const IndexSet &other, + const unsigned int offset = 0); /** * Return whether the specified * index is an element of the * index set. */ - bool is_element (const unsigned int index) const; + bool is_element (const types::global_dof_index index) const; /** * Return whether the index set @@ -151,7 +172,7 @@ public: * Return the number of elements * stored in this index set. */ - unsigned int n_elements () const; + types::global_dof_index n_elements () const; /** * Return the global index of the local @@ -160,7 +181,7 @@ public: * local_index obviously needs to be less * than n_elements(). */ - unsigned int nth_index_in_set (const unsigned int local_index) const; + types::global_dof_index nth_index_in_set (const unsigned int local_index) const; /** * Return the how-manyth element of this @@ -172,7 +193,7 @@ public: * a member of this index set, i.e. if * is_element(global_index) is false. */ - unsigned int index_within_set (const unsigned int global_index) const; + types::global_dof_index index_within_set (const types::global_dof_index global_index) const; /** * Each index set can be @@ -255,8 +276,8 @@ public: * a <i>window</i> through which we see the set represented * by the current object. */ - IndexSet get_view (const unsigned int begin, - const unsigned int end) const; + IndexSet get_view (const types::global_dof_index begin, + const types::global_dof_index end) const; /** @@ -273,7 +294,7 @@ public: * Fills the given vector with all * indices contained in this IndexSet. */ - void fill_index_vector(std::vector<unsigned int> &indices) const; + void fill_index_vector(std::vector<types::global_dof_index> &indices) const; /** * Fill the given vector with either @@ -408,7 +429,7 @@ public: */ std::size_t memory_consumption () const; - DeclException1 (ExcIndexNotPresent, int, + DeclException1 (ExcIndexNotPresent, types::global_dof_index, << "The global index " << arg1 << " is not an element of this set."); @@ -437,10 +458,10 @@ private: */ struct Range { - unsigned int begin; - unsigned int end; + types::global_dof_index begin; + types::global_dof_index end; - unsigned int nth_index_in_set; + types::global_dof_index nth_index_in_set; /** * Default constructor. Since there is no useful choice for @@ -459,8 +480,8 @@ private: * @param i1 Left end point of the interval. * @param i2 First index greater than the last index of the indicated range. **/ - Range (const unsigned int i1, - const unsigned int i2); + Range (const types::global_dof_index i1, + const types::global_dof_index i2); friend inline bool operator< (const Range &range_1, @@ -544,7 +565,7 @@ private: * set have to have a smaller * number than this value. */ - unsigned int index_space_size; + types::global_dof_index index_space_size; /** * This integer caches the index of the @@ -561,7 +582,7 @@ private: * owned range), whereas there are only a * few other elements (ghosts). */ - mutable unsigned int largest_range; + mutable types::global_dof_index largest_range; /** * Actually perform the compress() @@ -602,14 +623,14 @@ IndexSet complete_index_set (const unsigned int N) inline IndexSet::Range::Range () : - begin(numbers::invalid_unsigned_int), - end(numbers::invalid_unsigned_int) + begin(numbers::invalid_dof_index), + end(numbers::invalid_dof_index) {} inline -IndexSet::Range::Range (const unsigned int i1, - const unsigned int i2) +IndexSet::Range::Range (const types::global_dof_index i1, + const types::global_dof_index i2) : begin(i1), end(i2) @@ -627,7 +648,7 @@ IndexSet::IndexSet () inline -IndexSet::IndexSet (const unsigned int size) +IndexSet::IndexSet (const types::global_dof_index size) : is_compressed (true), index_space_size (size), @@ -648,7 +669,7 @@ IndexSet::clear () inline void -IndexSet::set_size (const unsigned int sz) +IndexSet::set_size (const types::global_dof_index sz) { Assert (ranges.empty(), ExcMessage ("This function can only be called if the current " @@ -660,7 +681,7 @@ IndexSet::set_size (const unsigned int sz) inline -unsigned int +types::global_dof_index IndexSet::size () const { return index_space_size; @@ -682,17 +703,17 @@ IndexSet::compress () const inline void -IndexSet::add_range (const unsigned int begin, - const unsigned int end) +IndexSet::add_range (const types::global_dof_index begin, + const types::global_dof_index end) { Assert ((begin < index_space_size) || ((begin == index_space_size) && (end == index_space_size)), - ExcIndexRange (begin, 0, index_space_size)); + ExcIndexRangeType<types::global_dof_index> (begin, 0, index_space_size)); Assert (end <= index_space_size, - ExcIndexRange (end, 0, index_space_size+1)); + ExcIndexRangeType<types::global_dof_index> (end, 0, index_space_size+1)); Assert (begin <= end, - ExcIndexRange (begin, 0, end)); + ExcIndexRangeType<types::global_dof_index> (begin, 0, end)); if (begin != end) { @@ -716,10 +737,10 @@ IndexSet::add_range (const unsigned int begin, inline void -IndexSet::add_index (const unsigned int index) +IndexSet::add_index (const types::global_dof_index index) { Assert (index < index_space_size, - ExcIndexRange (index, 0, index_space_size)); + ExcIndexRangeType<types::global_dof_index> (index, 0, index_space_size)); const Range new_range(index, index+1); if (ranges.size() == 0 || index > ranges.back().end) @@ -748,8 +769,8 @@ IndexSet::add_indices (const ForwardIterator &begin, // range for (ForwardIterator p=begin; p!=end;) { - const unsigned int begin_index = *p; - unsigned int end_index = begin_index + 1; + const types::global_dof_index begin_index = *p; + types::global_dof_index end_index = begin_index + 1; ForwardIterator q = p; ++q; while ((q != end) && (*q == end_index)) @@ -767,16 +788,17 @@ IndexSet::add_indices (const ForwardIterator &begin, inline void -IndexSet::add_indices(const IndexSet &other) +IndexSet::add_indices(const IndexSet &other, + const unsigned int offset) { - if (this == &other) + if ((this == &other) && (offset == 0)) return; for (std::vector<Range>::iterator range = other.ranges.begin(); range != other.ranges.end(); ++range) { - add_range(range->begin, range->end); + add_range(range->begin+offset, range->end+offset); } compress(); @@ -786,7 +808,7 @@ IndexSet::add_indices(const IndexSet &other) inline bool -IndexSet::is_element (const unsigned int index) const +IndexSet::is_element (const types::global_dof_index index) const { if (ranges.empty() == false) { @@ -864,14 +886,14 @@ IndexSet::is_contiguous () const inline -unsigned int +types::global_dof_index IndexSet::n_elements () const { // make sure we have // non-overlapping ranges compress (); - unsigned int v = 0; + types::global_dof_index v = 0; if (!ranges.empty()) { Range &r = ranges.back(); @@ -879,7 +901,7 @@ IndexSet::n_elements () const } #ifdef DEBUG - unsigned int s = 0; + types::global_dof_index s = 0; for (std::vector<Range>::iterator range = ranges.begin(); range != ranges.end(); ++range) @@ -893,13 +915,13 @@ IndexSet::n_elements () const inline -unsigned int +types::global_dof_index IndexSet::nth_index_in_set (const unsigned int n) const { // to make this call thread-safe, compress() // must not be called through this function Assert (is_compressed == true, ExcMessage ("IndexSet must be compressed.")); - Assert (n < n_elements(), ExcIndexRange (n, 0, n_elements())); + Assert (n < n_elements(), ExcIndexRangeType<types::global_dof_index> (n, 0, n_elements())); // first check whether the index is in the // largest range @@ -937,21 +959,21 @@ IndexSet::nth_index_in_set (const unsigned int n) const else { Assert (false, ExcInternalError()); - return numbers::invalid_unsigned_int; + return numbers::invalid_dof_index; } } inline -unsigned int -IndexSet::index_within_set (const unsigned int n) const +types::global_dof_index +IndexSet::index_within_set (const types::global_dof_index n) const { // to make this call thread-safe, compress() // must not be called through this function Assert (is_compressed == true, ExcMessage ("IndexSet must be compressed.")); Assert (is_element(n) == true, ExcIndexNotPresent (n)); - Assert (n < size(), ExcIndexRange (n, 0, size())); + Assert (n < size(), ExcIndexRangeType<types::global_dof_index> (n, 0, size())); // check whether the index is in the largest // range. use the result to perform a @@ -1033,7 +1055,7 @@ IndexSet::fill_binary_vector (Vector &vector) const for (std::vector<Range>::iterator it = ranges.begin(); it != ranges.end(); ++it) - for (unsigned int i=it->begin; i<it->end; ++i) + for (types::global_dof_index i=it->begin; i<it->end; ++i) vector[i] = 1; } diff --git a/deal.II/include/deal.II/base/job_identifier.h b/deal.II/include/deal.II/base/job_identifier.h index d39688e652..0a0a557a68 100644 --- a/deal.II/include/deal.II/base/job_identifier.h +++ b/deal.II/include/deal.II/base/job_identifier.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__job_identifier_h #define __deal2__job_identifier_h diff --git a/deal.II/include/deal.II/base/logstream.h b/deal.II/include/deal.II/base/logstream.h index 98617b69a8..8afb3ea2cb 100644 --- a/deal.II/include/deal.II/base/logstream.h +++ b/deal.II/include/deal.II/base/logstream.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 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__logstream_h #define __deal2__logstream_h @@ -171,8 +176,11 @@ public: /** * Enable output to a second stream <tt>o</tt>. + * + * The optional argument @p print_job_id specifies whether */ - void attach (std::ostream &o); + void attach (std::ostream &o, + const bool print_job_id = true); /** @@ -567,7 +575,7 @@ LogStream::get_stream() // note that in all of this we need not worry about thread-safety // because we operate on a thread-local object and by definition // there can only be one access at a time - if (outstreams.get() == 0) + if (outstreams.get().get() == 0) { outstreams.get().reset (new std::ostringstream); outstreams.get()->setf(std::ios::showpoint | std::ios::left); diff --git a/deal.II/include/deal.II/base/memory_consumption.h b/deal.II/include/deal.II/base/memory_consumption.h index 619e3ba5d9..f5add851ca 100644 --- a/deal.II/include/deal.II/base/memory_consumption.h +++ b/deal.II/include/deal.II/base/memory_consumption.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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__memory_consumption_h #define __deal2__memory_consumption_h @@ -152,6 +157,14 @@ namespace MemoryConsumption inline std::size_t memory_consumption (const unsigned int); + /** + * Determine the amount of memory + * in bytes consumed by a <tt>unsigned long long int</tt> + * variable. + */ + inline + std::size_t memory_consumption (const unsigned long long int); + /** * Determine the amount of memory * in bytes consumed by a <tt>float</tt> @@ -470,6 +483,14 @@ namespace MemoryConsumption + inline + std::size_t memory_consumption (const unsigned long long int) + { + return sizeof(unsigned long long int); + } + + + inline std::size_t memory_consumption (const float) { @@ -514,7 +535,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector<T> &v) { std::size_t mem = sizeof(std::vector<T>); - const unsigned int n = v.size(); + const unsigned int n = static_cast<unsigned int>(v.size()); for (unsigned int i=0; i<n; ++i) mem += memory_consumption(v[i]); mem += (v.capacity() - n)*sizeof(T); diff --git a/deal.II/include/deal.II/base/mg_level_object.h b/deal.II/include/deal.II/base/mg_level_object.h index eca7a5f534..cbd7a30574 100644 --- a/deal.II/include/deal.II/base/mg_level_object.h +++ b/deal.II/include/deal.II/base/mg_level_object.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 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_level_object_h #define __deal2__mg_level_object_h diff --git a/deal.II/include/deal.II/base/mpi.h b/deal.II/include/deal.II/base/mpi.h index 4887776510..cb88fcc2ec 100644 --- a/deal.II/include/deal.II/base/mpi.h +++ b/deal.II/include/deal.II/base/mpi.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012 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__mpi_h #define __deal2__mpi_h @@ -377,8 +381,8 @@ namespace Utilities * Called by the constructors. */ void do_init(int &argc, - char ** &argv, - unsigned int max_num_threads); + char ** &argv, + unsigned int max_num_threads); }; namespace internal @@ -412,6 +416,12 @@ namespace Utilities } + inline MPI_Datatype mpi_type_id (const unsigned long long int *) + { + return MPI_UNSIGNED_LONG_LONG; + } + + inline MPI_Datatype mpi_type_id (const float *) { return MPI_FLOAT; diff --git a/deal.II/include/deal.II/base/multithread_info.h b/deal.II/include/deal.II/base/multithread_info.h index 181926b82f..3b72975556 100644 --- a/deal.II/include/deal.II/base/multithread_info.h +++ b/deal.II/include/deal.II/base/multithread_info.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__multithread_info_h #define __deal2__multithread_info_h //--------------------------------------------------------------------------- @@ -37,7 +42,7 @@ DEAL_II_NAMESPACE_OPEN * To set n_default_threads add the following at the start of your main(): * <code> * multithread_info.n_default_threads=1; - * </code> + * </code> * * @ingroup threads * @author Thomas Richter, Wolfgang Bangerth, 2000 diff --git a/deal.II/include/deal.II/base/named_data.h b/deal.II/include/deal.II/base/named_data.h index 6d4c7b3af1..d177e6a1a1 100644 --- a/deal.II/include/deal.II/base/named_data.h +++ b/deal.II/include/deal.II/base/named_data.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__named_data_h #define __deal2__named_data_h diff --git a/deal.II/include/deal.II/base/numbers.h b/deal.II/include/deal.II/base/numbers.h index 482719b75f..ae0f861106 100644 --- a/deal.II/include/deal.II/base/numbers.h +++ b/deal.II/include/deal.II/base/numbers.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__numbers_h #define __deal2__numbers_h diff --git a/deal.II/include/deal.II/base/parallel.h b/deal.II/include/deal.II/base/parallel.h index 3ffdda181b..819d60f296 100644 --- a/deal.II/include/deal.II/base/parallel.h +++ b/deal.II/include/deal.II/base/parallel.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__parallel_h #define __deal2__parallel_h diff --git a/deal.II/include/deal.II/base/parameter_handler.h b/deal.II/include/deal.II/base/parameter_handler.h index bf9aad7c0e..f6bfc184de 100644 --- a/deal.II/include/deal.II/base/parameter_handler.h +++ b/deal.II/include/deal.II/base/parameter_handler.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__parameter_handler_h #define __deal2__parameter_handler_h @@ -55,241 +60,147 @@ namespace Patterns { /** - * Base class to declare common - * interface. The purpose of this - * class is mostly to define the - * interface of patterns, and to - * force derived classes to have a - * <tt>clone</tt> function. It is thus, - * in the languages of the "Design - * Patterns" book (Gamma et al.), a - * "prototype". + * Base class to declare common interface. The purpose of this class is + * mostly to define the interface of patterns, and to force derived + * classes to have a <tt>clone</tt> function. It is thus, in the + * languages of the "Design Patterns" book (Gamma et al.), a "prototype". */ class PatternBase { public: /** - * Make destructor of this and all - * derived classes virtual. + * Make destructor of this and all derived classes virtual. */ virtual ~PatternBase (); /** - * Return <tt>true</tt> if the given string - * matches the pattern. + * Return <tt>true</tt> if the given string matches the pattern. */ virtual bool match (const std::string &test_string) const = 0; /** - * Return a string describing the - * pattern. + * Return a string describing the pattern. */ virtual std::string description () const = 0; /** - * Return a pointer to an - * exact copy of the - * object. This is necessary - * since we want to store - * objects of this type in - * containers, were we need - * to copy objects without - * knowledge of their actual - * data type (we only have - * pointers to the base - * class). + * Return a pointer to an exact copy of the object. This is necessary + * since we want to store objects of this type in containers, were we + * need to copy objects without knowledge of their actual data type (we + * only have pointers to the base class). * - * Ownership of the objects - * returned by this function - * is passed to the caller of - * this function. + * Ownership of the objects returned by this function is passed to the + * caller of this function. */ virtual PatternBase *clone () const = 0; /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. To - * avoid unnecessary - * overhead, we do not force - * derived classes to provide - * this function as a virtual - * overloaded one, but rather - * try to cast the present - * object to one of the known - * derived classes and if - * that fails then take the - * size of this base class - * instead and add 32 byte - * (this value is arbitrary, - * it should account for - * virtual function tables, - * and some possible data - * elements). Since there are - * usually not many thousands - * of objects of this type - * around, and since the - * memory_consumption - * mechanism is used to find - * out where memory in the - * range of many megabytes - * is, this seems like a + * Determine an estimate for the memory consumption (in bytes) of this + * object. To avoid unnecessary overhead, we do not force derived + * classes to provide this function as a virtual overloaded one, but + * rather try to cast the present object to one of the known derived + * classes and if that fails then take the size of this base class + * instead and add 32 byte (this value is arbitrary, it should account + * for virtual function tables, and some possible data elements). Since + * there are usually not many thousands of objects of this type around, + * and since the memory_consumption mechanism is used to find out where + * memory in the range of many megabytes is, this seems like a * reasonable approximation. * - * On the other hand, if you - * know that your class - * deviates from this - * assumption significantly, - * you can still overload - * this function. + * On the other hand, if you know that your class deviates from this + * assumption significantly, you can still overload this function. */ virtual std::size_t memory_consumption () const; }; /** - * Returns pointer to the correct - * derived class based on description. + * Returns pointer to the correct derived class based on description. */ PatternBase *pattern_factory (const std::string &description); /** - * Test for the string being an - * integer. If bounds are given - * to the constructor, then the - * integer given also needs to be - * within the interval specified - * by these bounds. Note that - * unlike common convention in - * the C++ standard library, both - * bounds of this interval are - * inclusive; the reason is that - * in practice in most cases, one - * needs closed intervals, but - * these can only be realized - * with inclusive bounds for - * non-integer values. We thus - * stay consistent by always - * using closed intervals. + * Test for the string being an integer. If bounds are given to the + * constructor, then the integer given also needs to be within the + * interval specified by these bounds. Note that unlike common convention + * in the C++ standard library, both bounds of this interval are + * inclusive; the reason is that in practice in most cases, one needs + * closed intervals, but these can only be realized with inclusive bounds + * for non-integer values. We thus stay consistent by always using closed + * intervals. * - * If the upper bound given to - * the constructor is smaller - * than the lower bound, then the - * infinite interval is implied, - * i.e. every integer is allowed. + * If the upper bound given to the constructor is smaller than the lower + * bound, then the infinite interval is implied, i.e. every integer is + * allowed. * - * Giving bounds may be useful if - * for example a value can only - * be positive and less than a - * reasonable upper bound (for - * example the number of - * refinement steps to be - * performed), or in many other - * cases. + * Giving bounds may be useful if for example a value can only be + * positive and less than a reasonable upper bound (for example the + * number of refinement steps to be performed), or in many other cases. */ class Integer : public PatternBase { public: /** - * Minimal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. + * Minimal integer value. If the numeric_limits class is available use + * this information to obtain the extremal values, otherwise set it so + * that this class understands that all values are allowed. */ static const int min_int_value; /** - * Maximal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. + * Maximal integer value. If the numeric_limits class is available use + * this information to obtain the extremal values, otherwise set it so + * that this class understands that all values are allowed. */ static const int max_int_value; /** - * Constructor. Bounds can be - * specified within which a - * valid parameter has to - * be. If the upper bound is - * smaller than the lower - * bound, then the infinite - * interval is meant. The - * default values are chosen - * such that no bounds are - * enforced on parameters. + * Constructor. Bounds can be specified within which a valid parameter + * has to be. If the upper bound is smaller than the lower bound, then + * the infinite interval is meant. The default values are chosen such + * that no bounds are enforced on parameters. */ Integer (const int lower_bound = min_int_value, const int upper_bound = max_int_value); /** - * Return <tt>true</tt> if the - * string is an integer and - * its value is within the - * specified range. + * Return <tt>true</tt> if the string is an integer and its value is + * within the specified range. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. If bounds were - * specified to the - * constructor, then include - * them into this - * description. + * Return a description of the pattern that valid strings are expected + * to match. If bounds were specified to the constructor, then include + * them into this description. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static Integer *create (const std::string &description); private: /** - * Value of the lower - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or larger, if the - * bounds of the interval for - * a valid range. + * Value of the lower bound. A number that satisfies the @ref match + * operation of this class must be equal to this value or larger, if + * the bounds of the interval for a valid range. */ const int lower_bound; /** - * Value of the upper - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or less, if the - * bounds of the interval for - * a valid range. + * Value of the upper bound. A number that satisfies the @ref match + * operation of this class must be equal to this value or less, if the + * bounds of the interval for a valid range. */ const int upper_bound; @@ -300,144 +211,90 @@ namespace Patterns }; /** - * Test for the string being a - * <tt>double</tt>. If bounds are - * given to the constructor, then - * the integer given also needs - * to be within the interval - * specified by these - * bounds. Note that unlike - * common convention in the C++ - * standard library, both bounds - * of this interval are - * inclusive; the reason is that - * in practice in most cases, one - * needs closed intervals, but - * these can only be realized - * with inclusive bounds for - * non-integer values. We thus - * stay consistent by always - * using closed intervals. + * Test for the string being a <tt>double</tt>. If bounds are given to + * the constructor, then the integer given also needs to be within the + * interval specified by these bounds. Note that unlike common convention + * in the C++ standard library, both bounds of this interval are + * inclusive; the reason is that in practice in most cases, one needs + * closed intervals, but these can only be realized with inclusive bounds + * for non-integer values. We thus stay consistent by always using closed + * intervals. * - * If the upper bound given to - * the constructor is smaller - * than the lower bound, then the - * infinite interval is implied, - * i.e. every integer is allowed. + * If the upper bound given to the constructor is smaller than the lower + * bound, then the infinite interval is implied, i.e. every integer is + * allowed. * - * Giving bounds may be useful if - * for example a value can only - * be positive and less than a - * reasonable upper bound (for - * example damping parameters are - * frequently only reasonable if - * between zero and one), or in - * many other cases. + * Giving bounds may be useful if for example a value can only be + * positive and less than a reasonable upper bound (for example damping + * parameters are frequently only reasonable if between zero and one), or + * in many other cases. */ class Double : public PatternBase { public: /** - * Minimal double value. If the - * <tt>std::numeric_limits</tt> - * class is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. + * Minimal double value. If the <tt>std::numeric_limits</tt> class is + * available use this information to obtain the extremal values, + * otherwise set it so that this class understands that all values are + * allowed. */ static const double min_double_value; /** - * Maximal double value. If the - * numeric_limits class is - * available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. + * Maximal double value. If the numeric_limits class is available use + * this information to obtain the extremal values, otherwise set it so + * that this class understands that all values are allowed. */ static const double max_double_value; /** - * Constructor. Bounds can be - * specified within which a - * valid parameter has to - * be. If the upper bound is - * smaller than the lower - * bound, then the infinite - * interval is meant. The - * default values are chosen - * such that no bounds are - * enforced on parameters. + * Constructor. Bounds can be specified within which a valid parameter + * has to be. If the upper bound is smaller than the lower bound, then + * the infinite interval is meant. The default values are chosen such + * that no bounds are enforced on parameters. */ Double (const double lower_bound = min_double_value, const double upper_bound = max_double_value); /** - * Return <tt>true</tt> if the - * string is a number and its - * value is within the - * specified range. + * Return <tt>true</tt> if the string is a number and its value is + * within the specified range. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. If bounds were - * specified to the - * constructor, then include - * them into this - * description. + * Return a description of the pattern that valid strings are expected + * to match. If bounds were specified to the constructor, then include + * them into this description. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static Double *create (const std::string &description); private: /** - * Value of the lower - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or larger, if the - * bounds of the interval for - * a valid range. + * Value of the lower bound. A number that satisfies the @ref match + * operation of this class must be equal to this value or larger, if + * the bounds of the interval for a valid range. */ const double lower_bound; /** - * Value of the upper - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or less, if the - * bounds of the interval for - * a valid range. + * Value of the upper bound. A number that satisfies the @ref match + * operation of this class must be equal to this value or less, if the + * bounds of the interval for a valid range. */ const double upper_bound; @@ -448,83 +305,59 @@ namespace Patterns }; /** - * Test for the string being one - * of a sequence of values given - * like a regular expression. For - * example, if the string given - * to the constructor is - * <tt>"red|blue|black"</tt>, then the - * @ref match function returns - * <tt>true</tt> exactly if the string - * is either "red" or "blue" or - * "black". Spaces around the - * pipe signs do not matter and - * are eliminated. + * Test for the string being one of a sequence of values given like a + * regular expression. For example, if the string given to the + * constructor is <tt>"red|blue|black"</tt>, then the @ref match function + * returns <tt>true</tt> exactly if the string is either "red" or "blue" + * or "black". Spaces around the pipe signs do not matter and are + * eliminated. */ class Selection : public PatternBase { public: /** - * Constructor. Take the - * given parameter as the - * specification of valid + * Constructor. Take the given parameter as the specification of valid * strings. */ Selection (const std::string &seq); /** - * Return <tt>true</tt> if the - * string is an element of - * the description list - * passed to the constructor. + * Return <tt>true</tt> if the string is an element of the description + * list passed to the constructor. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * list of valid strings - * passed to the constructor. + * Return a description of the pattern that valid strings are expected + * to match. Here, this is the list of valid strings passed to the + * constructor. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. + * Determine an estimate for the memory consumption (in bytes) of this + * object. */ std::size_t memory_consumption () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static Selection *create (const std::string &description); private: /** - * List of valid strings as - * passed to the - * constructor. We don't make - * this string constant, as - * we process it somewhat in - * the constructor. + * List of valid strings as passed to the constructor. We don't make + * this string constant, as we process it somewhat in the constructor. */ std::string sequence; @@ -536,40 +369,28 @@ namespace Patterns /** - * This pattern matches a list of - * comma-separated values each of which - * have to match a pattern given to the - * constructor. With two additional - * parameters, the number of elements this - * list has to have can be specified. If - * none is specified, the list may have - * zero or more entries. + * This pattern matches a list of comma-separated values each of which + * have to match a pattern given to the constructor. With two additional + * parameters, the number of elements this list has to have can be + * specified. If none is specified, the list may have zero or more + * entries. */ class List : public PatternBase { public: /** - * Maximal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. + * Maximal integer value. If the numeric_limits class is available use + * this information to obtain the extremal values, otherwise set it so + * that this class understands that all values are allowed. */ static const unsigned int max_int_value; /** - * Constructor. Take the - * given parameter as the - * specification of valid + * Constructor. Take the given parameter as the specification of valid * elements of the list. * - * The two other arguments can - * be used to denote minimal - * and maximal allowable - * lengths of the list. + * The two other arguments can be used to denote minimal and maximal + * allowable lengths of the list. */ List (const PatternBase &base_pattern, const unsigned int min_elements = 0, @@ -582,45 +403,34 @@ namespace Patterns /** * Return <tt>true</tt> if the - * string is a comma-separated - * list of strings each of - * which match the pattern - * given to the constructor. + * string is a comma-separated list of strings each of which match the + * pattern given to the constructor. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. + * Return a description of the pattern that valid strings are expected + * to match. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static List *create (const std::string &description); /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. + * Determine an estimate for the memory consumption (in bytes) of this + * object. */ std::size_t memory_consumption () const; @@ -637,21 +447,17 @@ namespace Patterns //@} private: /** - * Copy of the pattern that - * each element of the list has - * to satisfy. + * Copy of the pattern that each element of the list has to satisfy. */ PatternBase *pattern; /** - * Minimum number of elements - * the list must have. + * Minimum number of elements the list must have. */ const unsigned int min_elements; /** - * Maximum number of elements - * the list must have. + * Maximum number of elements the list must have. */ const unsigned int max_elements; @@ -663,47 +469,33 @@ namespace Patterns /** - * This pattern matches a list of - * comma-separated values each of which - * denotes a pair of key and value. Both key and value - * have to match a pattern given to the - * constructor. For each entry of the map, - * parameters have to be entered in the form - * <code>key: value</code>. In other words, a - * map is described in the form + * This pattern matches a list of comma-separated values each of which + * denotes a pair of key and value. Both key and value have to match a + * pattern given to the constructor. For each entry of the map, + * parameters have to be entered in the form <code>key: value</code>. In + * other words, a map is described in the form * <code>key1: value1, key2: value2, key3: value3, ...</code>. * - * With two additional - * parameters, the number of elements this - * list has to have can be specified. If - * none is specified, the map may have - * zero or more entries. + * With two additional parameters, the number of elements this list has + * to have can be specified. If none is specified, the map may have zero + * or more entries. */ class Map : public PatternBase { public: /** - * Maximal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. + * Maximal integer value. If the numeric_limits class is available use + * this information to obtain the extremal values, otherwise set it so + * that this class understands that all values are allowed. */ static const unsigned int max_int_value; /** - * Constructor. Take the - * given parameter as the - * specification of valid + * Constructor. Take the given parameter as the specification of valid * elements of the list. * - * The two other arguments can - * be used to denote minimal - * and maximal allowable - * lengths of the list. + * The two other arguments can be used to denote minimal and maximal + * allowable lengths of the list. */ Map (const PatternBase &key_pattern, const PatternBase &value_pattern, @@ -716,46 +508,34 @@ namespace Patterns virtual ~Map (); /** - * Return <tt>true</tt> if the - * string is a comma-separated - * list of strings each of - * which match the pattern - * given to the constructor. + * Return <tt>true</tt> if the string is a comma-separated list of + * strings each of which match the pattern given to the constructor. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. + * Return a description of the pattern that valid strings are expected + * to match. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static Map *create (const std::string &description); /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. + * Determine an estimate for the memory consumption (in bytes) of this + * object. */ std::size_t memory_consumption () const; @@ -772,22 +552,19 @@ namespace Patterns //@} private: /** - * Copy of the patterns that - * each key and each value of the map has - * to satisfy. + * Copy of the patterns that each key and each value of the map has to + * satisfy. */ PatternBase *key_pattern; PatternBase *value_pattern; /** - * Minimum number of elements - * the list must have. + * Minimum number of elements the list must have. */ const unsigned int min_elements; /** - * Maximum number of elements - * the list must have. + * Maximum number of elements the list must have. */ const unsigned int max_elements; @@ -799,80 +576,55 @@ namespace Patterns /** - * This class is much like the - * Selection class, but it - * allows the input to be a - * comma-separated list of values - * which each have to be given in - * the constructor - * argument. Alternatively, it - * could be viewed as a - * specialization of the List - * class. For example, if the - * string to the constructor was - * <tt>"ucd|gmv|eps"</tt>, then the - * following would be legal input: - * <tt>eps</tt>, <tt>gmv</tt>. You may give an - * arbitrarily long list of values, - * where there may be as many - * spaces around commas as you - * like. However, commas are not - * allowed inside the values given + * This class is much like the Selection class, but it allows the input + * to be a comma-separated list of values which each have to be given in + * the constructor argument. Alternatively, it could be viewed as a + * specialization of the List class. For example, if the string to the + * constructor was <tt>"ucd|gmv|eps"</tt>, then the following would be + * legal input: <tt>eps</tt>, <tt>gmv</tt>. You may give an arbitrarily + * long list of values, where there may be as many spaces around commas + * as you like. However, commas are not allowed inside the values given * to the constructor. */ class MultipleSelection : public PatternBase { public: /** - * Constructor. Take the - * given parameter as the - * specification of valid + * Constructor. Take the given parameter as the specification of valid * strings. */ MultipleSelection (const std::string &seq); /** - * Return <tt>true</tt> if the - * string is an element of - * the description list - * passed to the constructor. + * Return <tt>true</tt> if the string is an element of the description + * list passed to the constructor. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * list of valid strings - * passed to the constructor. + * Return a description of the pattern that valid strings are expected + * to match. Here, this is the list of valid strings passed to the + * constructor. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static MultipleSelection *create (const std::string &description); /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. + * Determine an estimate for the memory consumption (in bytes) of this + * object. */ std::size_t memory_consumption () const; @@ -889,12 +641,8 @@ namespace Patterns //@} private: /** - * List of valid strings as - * passed to the - * constructor. We don't make - * this string constant, as - * we process it somewhat in - * the constructor. + * List of valid strings as passed to the constructor. We don't make + * this string constant, as we process it somewhat in the constructor. */ std::string sequence; @@ -905,10 +653,8 @@ namespace Patterns }; /** - * Test for the string being - * either "true" or "false". This - * is mapped to the Selection - * class. + * Test for the string being either "true" or "false". This is mapped to + * the Selection class. */ class Bool : public Selection { @@ -919,30 +665,22 @@ namespace Patterns Bool (); /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. + * Return a description of the pattern that valid strings are expected + * to match. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static Bool *create (const std::string &description); @@ -954,54 +692,40 @@ namespace Patterns }; /** - * Always returns <tt>true</tt> when testing a - * string. + * Always returns <tt>true</tt> when testing a string. */ class Anything : public PatternBase { public: /** - * Constructor. (Allow for at - * least one non-virtual - * function in this class, as - * otherwise sometimes no - * virtual table is emitted.) + * Constructor. (Allow for at least one non-virtual function in this + * class, as otherwise sometimes no virtual table is emitted.) */ Anything (); /** - * Return <tt>true</tt> if the - * string matches its - * constraints, i.e. always. + * Return <tt>true</tt> if the string matches its constraints, i.e. + * always. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * string <tt>"[Anything]"</tt>. + * Return a description of the pattern that valid strings are expected + * to match. Here, this is the string <tt>"[Anything]"</tt>. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static Anything *create (const std::string &description); @@ -1014,70 +738,51 @@ namespace Patterns /** - * A pattern that can be used to indicate - * when a parameter is intended to be the - * name of a file. By itself, this class - * does not check whether the string that - * is given in a parameter file actually - * corresponds to an existing file (it - * could, for example, be the name of a - * file to which you want to write - * output). Functionally, the class is - * therefore equivalent to the Anything - * class. However, it allows to specify the - * <i>intent</i> of a parameter. The flag - * given to the constructor also allows to - * specify whether the file is supposed to - * be an input or output file. + * A pattern that can be used to indicate when a parameter is intended to + * be the name of a file. By itself, this class does not check whether + * the string that is given in a parameter file actually corresponds to + * an existing file (it could, for example, be the name of a file to + * which you want to write output). Functionally, the class is therefore + * equivalent to the Anything class. However, it allows to specify the + * <i>intent</i> of a parameter. The flag given to the constructor also + * allows to specify whether the file is supposed to be an input or + * output file. * - * The reason for the existence of this - * class is to support graphical user - * interfaces for editing parameter - * files. These may open a file selection - * dialog if the filename is supposed to - * represent an input file. + * The reason for the existence of this class is to support graphical + * user interfaces for editing parameter files. These may open a file + * selection dialog if the filename is supposed to represent an input + * file. */ class FileName : public PatternBase { public: /** - * Files can be used for input - * or output. This can be - * specified in the constructor - * by choosing the flag <tt>type</tt>. + * Files can be used for input or output. This can be specified in the + * constructor by choosing the flag <tt>type</tt>. */ enum FileType {input = 0, output = 1}; /** - * Constructor. The type of the file - * can be specified by choosing the + * Constructor. The type of the file can be specified by choosing the * flag. */ FileName (const FileType type = input); /** - * Return <tt>true</tt> if the - * string matches its - * constraints, i.e. always. + * Return <tt>true</tt> if the string matches its constraints, i.e. + * always. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * string <tt>"[Filename]"</tt>. + * Return a description of the pattern that valid strings are expected + * to match. Here, this is the string <tt>"[Filename]"</tt>. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; @@ -1088,11 +793,9 @@ namespace Patterns FileType file_type; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static FileName *create (const std::string &description); @@ -1105,22 +808,16 @@ namespace Patterns /** - * A pattern that can be used to indicate - * when a parameter is intended to be the - * name of a directory. By itself, this - * class does not check whether the string - * that is given in a parameter file - * actually corresponds to an existing - * directory. Functionally, the class is - * therefore equivalent to the Anything - * class. However, it allows to specify the - * <i>intent</i> of a parameter. + * A pattern that can be used to indicate when a parameter is intended to + * be the name of a directory. By itself, this class does not check + * whether the string that is given in a parameter file actually + * corresponds to an existing directory. Functionally, the class is + * therefore equivalent to the Anything class. However, it allows to + * specify the <i>intent</i> of a parameter. * - * The reason for the existence of this - * class is to support graphical user - * interfaces for editing parameter - * files. These may open a file selection - * dialog to select or create a directory. + * The reason for the existence of this class is to support graphical + * user interfaces for editing parameter files. These may open a file + * selection dialog to select or create a directory. */ class DirectoryName : public PatternBase { @@ -1131,38 +828,28 @@ namespace Patterns DirectoryName (); /** - * Return <tt>true</tt> if the - * string matches its - * constraints, i.e. always. + * Return <tt>true</tt> if the string matches its constraints, i.e. + * always. */ virtual bool match (const std::string &test_string) const; /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * string <tt>"[Filename]"</tt>. + * Return a description of the pattern that valid strings are expected + * to match. Here, this is the string <tt>"[Filename]"</tt>. */ virtual std::string description () const; /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this + * Return a copy of the present object, which is newly allocated on the + * heap. Ownership of that object is transferred to the caller of this * function. */ virtual PatternBase *clone () const; /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. + * Creates new object if the start of description matches + * description_init. Ownership of that object is transferred to the + * caller of this function. */ static DirectoryName *create (const std::string &description); @@ -1176,10 +863,11 @@ namespace Patterns /** - * The ParameterHandler class provides a standard interface to an input file - * which provides at run-time for program parameters such as time step - * sizes, geometries, right hand sides etc. The input for the program is - * given in files, streams or strings in memory using text like + * The ParameterHandler class provides a standard interface to an input + * file which provides at run-time for program parameters such as time + * step sizes, geometries, right hand sides etc. The input for the + * program is given in files, streams or strings in memory using text + * like * @code * set Time step size = 0.3 * set Geometry = [0,1]x[0,3] @@ -1187,16 +875,15 @@ namespace Patterns * Input may be sorted into subsection trees in order to give the input a * logical structure. * - * The ParameterHandler class is discussed in detail in the @ref - * step_19 "step-19" example program, and is used in more realistic - * situations in step-29, step-33 - * and step-34. + * The ParameterHandler class is discussed in detail in the @ref step_19 + * "step-19" example program, and is used in more realistic situations in + * step-29, step-33 and step-34. * * <h3>Declaring entries</h3> * - * In order to use the facilities of a ParameterHandler object, one first has - * to make known the different entries the input file may or may not contain. This - * is done in the following way: + * In order to use the facilities of a ParameterHandler object, one first + * has to make known the different entries the input file may or may not + * contain. This is done in the following way: * * @code * ... @@ -1210,26 +897,24 @@ namespace Patterns * Patterns::Anything()); * ... * @endcode - * Each entry is declared using the function declare_entry(). The - * first parameter is the name of the entry (in short: the - * entry). The second is the default answer to be taken in case the - * entry is not specified in the input file. The third parameter is - * a regular expression which the input (and the default answer) has - * to match. Several such regular expressions are defined in - * Patterns. This parameter can be omitted, in which case it - * will default to Patterns::Anything, i.e. a pattern that + * Each entry is declared using the function declare_entry(). The first + * parameter is the name of the entry (in short: the entry). The second + * is the default answer to be taken in case the entry is not specified + * in the input file. The third parameter is a regular expression which + * the input (and the default answer) has to match. Several such regular + * expressions are defined in Patterns. This parameter can be omitted, in + * which case it will default to Patterns::Anything, i.e. a pattern that * matches every input string. The fourth parameter can be used to * document the intent or expected format of an entry; its value is - * printed as a comment when writing all entries of a - * ParameterHandler object using the print_parameters() - * function to allow for easier understanding of a parameter - * file. It can be omitted as well, in which case no such - * documentation will be printed. - * - * Entries may be located in subsections which form a kind of input tree. For example - * input parameters for linear solver routines should be classified in a subsection - * named <tt>Linear solver</tt> or any other suitable name. This is accomplished in the - * following way: + * printed as a comment when writing all entries of a ParameterHandler + * object using the print_parameters() function to allow for easier + * understanding of a parameter file. It can be omitted as well, in which + * case no such documentation will be printed. + * + * Entries may be located in subsections which form a kind of input tree. + * For example input parameters for linear solver routines should be + * classified in a subsection named <tt>Linear solver</tt> or any other + * suitable name. This is accomplished in the following way: * @code * ... * LinEq eq; @@ -1252,9 +937,10 @@ namespace Patterns * } * @endcode * - * Subsections may be nested. For example a nonlinear solver may have a linear solver - * as member object. Then the function call tree would be something like (if the class - * <tt>NonLinEq</tt> has a member variables <tt>eq</tt> of type <tt>LinEq</tt>): + * Subsections may be nested. For example a nonlinear solver may have a + * linear solver as member object. Then the function call tree would be + * something like (if the class <tt>NonLinEq</tt> has a member variables + * <tt>eq</tt> of type <tt>LinEq</tt>): * @code * void NonLinEq::declare_parameters (ParameterHandler &prm) { * prm.enter_subsection ("Nonlinear solver"); @@ -1268,15 +954,15 @@ namespace Patterns * } * @endcode * - * For class member functions which declare the different entries we propose - * to use the common name <tt>declare_parameters</tt>. In normal cases this - * method can be <tt>static</tt> since the entries will not depend on any - * previous knowledge. Classes for which entries should logically be grouped - * into subsections should declare these subsections themselves. If a class - * has two or more member variables of the same type both of which should - * have their own parameters, this parent class' method - * <tt>declare_parameters</tt> is responsible to group them into different - * subsections: + * For class member functions which declare the different entries we + * propose to use the common name <tt>declare_parameters</tt>. In normal + * cases this method can be <tt>static</tt> since the entries will not + * depend on any previous knowledge. Classes for which entries should + * logically be grouped into subsections should declare these subsections + * themselves. If a class has two or more member variables of the same + * type both of which should have their own parameters, this parent + * class' method <tt>declare_parameters</tt> is responsible to group them + * into different subsections: * @code * void NonLinEq::declare_parameters (ParameterHandler &prm) { * prm.enter_subsection ("Nonlinear solver"); @@ -1313,27 +999,30 @@ namespace Patterns * end * ... # other stuff * @endcode - * The words <tt>subsection</tt>, <tt>set</tt> and <tt>end</tt> may be either written in lowercase or uppercase - * letters. Leading and trailing whitespace is removed, multiple whitespace is condensed into - * only one. Since the latter applies also to the name of an entry, an entry name will not - * be recognized if in the declaration multiple whitespace is used. + * The words <tt>subsection</tt>, <tt>set</tt> and <tt>end</tt> may be + * either written in lowercase or uppercase letters. Leading and trailing + * whitespace is removed, multiple whitespace is condensed into only one. + * Since the latter applies also to the name of an entry, an entry name + * will not be recognized if in the declaration multiple whitespace is + * used. * - * In entry names and values the following characters are not allowed: <tt>\#</tt>, <tt>{</tt>, - * <tt>}</tt>, <tt>|</tt>. Their use is reserved for the MultipleParameterLoop class. + * In entry names and values the following characters are not allowed: + * <tt>\#</tt>, <tt>{</tt>, <tt>}</tt>, <tt>|</tt>. Their use is reserved + * for the MultipleParameterLoop class. * * Comments starting with \# are skipped. * - * We propose to use the following - * scheme to name entries: start the first word with a capital letter and use lowercase - * letters further on. The same applies to the possible entry values to the right of the + * We propose to use the following scheme to name entries: start the + * first word with a capital letter and use lowercase letters further on. + * The same applies to the possible entry values to the right of the * <tt>=</tt> sign. * * * <h3>Reading data from input sources</h3> * - * In order to read input you can use three possibilities: reading from an - * <tt>std::istream</tt> object, reading from a file of which the name is - * given and reading from a string in memory in which the lines are + * In order to read input you can use three possibilities: reading from + * an <tt>std::istream</tt> object, reading from a file of which the name + * is given and reading from a string in memory in which the lines are * separated by <tt>@\n</tt> characters. These possibilities are used as * follows: * @code @@ -1349,40 +1038,42 @@ namespace Patterns * prm.read_input_from_string (in); * ... * @endcode - * You can use several sources of input successively. Entries which are changed more than - * once will be overwritten every time they are used. + * You can use several sources of input successively. Entries which are + * changed more than once will be overwritten every time they are used. * * You should not try to declare entries using declare_entry() and * enter_subsection() with as yet unknown subsection names after * using read_input(). The results in this case are unspecified. * - * If an error occurs upon reading the input, error messages are written to - * <tt>std::cerr</tt> and the reader function returns with a return value of - * <code>false</code>. This is opposed to almost all other functions in - * deal.II, which would normally throw an exception if an error occurs; this - * difference in behavior is a relic of the fact that this class predates - * deal.II and had previously been written for a different project. + * If an error occurs upon reading the input, error messages are written + * to <tt>std::cerr</tt> and the reader function returns with a return + * value of <code>false</code>. This is opposed to almost all other + * functions in deal.II, which would normally throw an exception if an + * error occurs; this difference in behavior is a relic of the fact that + * this class predates deal.II and had previously been written for a + * different project. * * * <h3>Using the %ParameterHandler Graphical User Interface</h3> * * An alternative to using the hand-written input files shown above is to - * use the graphical user interface (GUI) that accompanies this class. For - * this, you first need to write a description of all the parameters, their - * default values, patterns and documentation strings into a file in a - * format that the GUI can understand; this is done using the - * ParameterHandler::print_parameters() function with ParameterHandler::XML - * as second argument, as discussed in more detail below in the - * <i>Representation of Parameters</i> section. This file can then be loaded - * using the executable for the GUI, which should be located in - * <code>lib/bin/dealii_parameter_gui</code> of your deal.II installation, - * assuming that you have a sufficiently recent version of the <a - * href="http://qt.nokia.com/">Qt toolkit</a> installed. + * use the graphical user interface (GUI) that accompanies this class. + * For this, you first need to write a description of all the parameters, + * their default values, patterns and documentation strings into a file + * in a format that the GUI can understand; this is done using the + * ParameterHandler::print_parameters() function with + * ParameterHandler::XML as second argument, as discussed in more detail + * below in the <i>Representation of Parameters</i> section. This file + * can then be loaded using the executable for the GUI, which should be + * located in <code>lib/bin/dealii_parameter_gui</code> of your deal.II + * installation, assuming that you have a sufficiently recent version of + * the <a href="http://qt.nokia.com/">Qt toolkit</a> installed. * * Once loaded, the GUI displays subsections and individual parameters in * tree form (see also the discussion in the <i>Representation of - * Parameters</i> section below). Here is a screen shot with some - * sub-sections expanded and one parameter selected for editing: + * Parameters</i> section below). Here is a screen shot + * with some sub-sections expanded and one parameter selected for + * editing: * * @image html parameter_gui.png "Parameter GUI" * @@ -1403,54 +1094,61 @@ namespace Patterns * prm.leave_subsection (); * } * @endcode - * get() returns the value of the given entry. If the entry was not specified in the input - * source(s), the default value is returned. You have to enter and leave subsections - * exactly as you did when declaring subsection. You may chose the order in which to - * transverse the subsection tree. - * - * It is guaranteed that only entries matching the given regular expression are returned, - * i.e. an input entry value which does not match the regular expression is not stored. - * - * You can use get() to retrieve the parameter in text form, get_integer() to get an integer - * or get_double() to get a double. You can also use get_bool(). - * It will cause an internal error if the string could not be - * converted to an integer, double or a bool. This should, though, not - * happen if you correctly specified the regular expression for this entry; you should not - * try to get out an integer or a double from an entry for which no according regular - * expression was set. The internal error is raised through the Assert() macro family - * which only works in debug mode. + * get() returns the value of the given entry. If the entry was not + * specified in the input source(s), the default value is returned. You + * have to enter and leave subsections exactly as you did when declaring + * subsection. You may chose the order in which to transverse the + * subsection tree. + * + * It is guaranteed that only entries matching the given regular + * expression are returned, i.e. an input entry value which does not + * match the regular expression is not stored. + * + * You can use get() to retrieve the parameter in text form, + * get_integer() to get an integer or get_double() to get a double. You + * can also use get_bool(). It will cause an internal error if the string + * could not be converted to an integer, double or a bool. This should, + * though, not happen if you correctly specified the regular expression + * for this entry; you should not try to get out an integer or a double + * from an entry for which no according regular expression was set. The + * internal error is raised through the Assert() macro family which only + * works in debug mode. * * If you want to print out all user selectable features, use the - * print_parameters() function. It is generally a good idea to print all parameters - * at the beginning of a log file, since this way input and output are together in - * one file which makes matching at a later time easier. Additionally, the function - * also print those entries which have not been modified in the input file und are - * thus set to default values; since default values may change in the process of - * program development, you cannot know the values of parameters not specified in the - * input file. + * print_parameters() function. It is generally a good idea to print all + * parameters at the beginning of a log file, since this way input and + * output are together in one file which makes matching at a later time + * easier. Additionally, the function also print those entries which have + * not been modified in the input file und are thus set to default + * values; since default values may change in the process of program + * development, you cannot know the values of parameters not specified in + * the input file. * * * <h3>Style guide for data retrieval</h3> * - * We propose that every class which gets data out of a - * ParameterHandler object provides a function named - * <tt>get_parameters</tt>. This should be declared - * <tt>virtual</tt>. <tt>get_parameters</tt> functions in derived classes - * should call the <tt>BaseClass::get_parameters</tt> function. + * We propose that every class which gets data out of a ParameterHandler + * object provides a function named <tt>get_parameters</tt>. This should + * be declared <tt>virtual</tt>. <tt>get_parameters</tt> functions in + * derived classes should call the <tt>BaseClass::get_parameters</tt> + * function. * * * <h3>Experience with large parameter lists</h3> * - * Experience has shown that in programs defining larger numbers of parameters (more than, - * say, fifty) it is advantageous to define an additional class holding these parameters. - * This class is more like a C-style structure, having a large number of variables, - * usually public. It then has at least two functions, which declare and parse the - * parameters. In the main program, the main class has an object of this parameter class - * and delegates declaration and parsing of parameters to this object. + * Experience has shown that in programs defining larger numbers of + * parameters (more than, say, fifty) it is advantageous to define an + * additional class holding these parameters. This class is more like a + * C-style structure, having a large number of variables, usually public. + * It then has at least two functions, which declare and parse the + * parameters. In the main program, the main class has an object of this + * parameter class and delegates declaration and parsing of parameters to + * this object. * - * The advantage of this approach is that you can keep out the technical details - * (declaration and parsing) out of the main class and additionally don't clutter - * up your main class with dozens or more variables denoting the parameters. + * The advantage of this approach is that you can keep out the technical + * details (declaration and parsing) out of the main class and + * additionally don't clutter up your main class with dozens or more + * variables denoting the parameters. * * * @@ -1701,9 +1399,9 @@ namespace Patterns * prm.leave_subsection (); * @endcode * - * We can think of the parameters so arranged as a file system in which every - * parameter is a directory. The name of this directory is the name of the - * parameter, and in this directory lie files that describe the + * We can think of the parameters so arranged as a file system in which + * every parameter is a directory. The name of this directory is the name + * of the parameter, and in this directory lie files that describe the * parameter. These files are: * - <code>value</code>: The content of this file is the current value of this * parameter; initially, the content of the file equals the default value of @@ -1720,13 +1418,13 @@ namespace Patterns * With the exception of the <code>value</code> file, the contents of files * are never changed after declaration of a parameter. * - * Alternatively, a directory in this file system may not have a file called - * <code>value</code> in it. In that case, the directory represents a - * subsection as declared above, and the directory's name will correspond to - * the name of the subsection. It will then have no files in it at all, but - * it may have further directories in it: some of these directories will be - * parameters (indicates by the presence of files) or further nested - * subsections. + * Alternatively, a directory in this file system may not have a file + * called <code>value</code> in it. In that case, the directory + * represents a subsection as declared above, and the directory's name + * will correspond to the name of the subsection. It will then have no + * files in it at all, but it may have further directories in it: some of + * these directories will be parameters (indicates by the presence of + * files) or further nested subsections. * * Given this explanation, the code above will lead to a hierarchical * representation of data that looks like this (the content of files is @@ -1791,74 +1489,57 @@ class ParameterHandler : public Subscriptor { private: /** - * Inhibit automatic - * CopyConstructor. + * Inhibit automatic CopyConstructor. */ ParameterHandler (const ParameterHandler &); /** - * Inhibit automatic - * assignment operator. + * Inhibit automatic assignment operator. */ ParameterHandler &operator= (const ParameterHandler &); public: /** - * List of possible output - * formats. + * List of possible output formats. * - * The formats down the list with - * prefix <em>Short</em> and bit - * 6 and 7 set reproduce the old - * behavior of not writing - * comments or original values to - * the files. + * The formats down the list with prefix <em>Short</em> and bit 6 and 7 + * set reproduce the old behavior of not writing comments or original + * values to the files. */ enum OutputStyle { /** - * Write human readable - * output suitable to be - * read by ParameterHandler + * Write human readable output suitable to be read by ParameterHandler * again. */ Text = 1, /** - * Write parameters as a - * LaTeX table. + * Write parameters as a LaTeX table. */ LaTeX = 2, /** - * Write out declared parameters - * with description and possible - * values. + * Write out declared parameters with description and possible values. */ Description = 3, /** - * Write out everything as - * an <a href="http://en.wikipedia.org/wiki/XML">XML</a> - * file. + * Write out everything as an <a + * href="http://en.wikipedia.org/wiki/XML">XML</a> file. * - * See the general - * documentation of this - * class for an example of + * See the general documentation of this class for an example of * output. */ XML = 4, /** - * Write out everything as - * a <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> - * file. + * Write out everything as a <a + * href="http://en.wikipedia.org/wiki/JSON">JSON</a> file. */ JSON = 5, /** - * Write input for - * ParameterHandler without - * comments or changed - * default values. + * Write input for ParameterHandler without comments or changed default + * values. */ ShortText = 193 }; @@ -1871,73 +1552,51 @@ public: ParameterHandler (); /** - * Destructor. Declare this only - * to have a virtual destructor, - * which is safer as we have - * virtual functions. It - * actually does nothing + * Destructor. Declare this only to have a virtual destructor, which is + * safer as we have virtual functions. It actually does nothing * spectacular. */ virtual ~ParameterHandler (); /** - * Read input from a stream until - * stream returns <tt>eof</tt> - * condition or error. + * Read input from a stream until stream returns <tt>eof</tt> condition + * or error. * - * Return whether the read was - * successful. + * Return whether the read was successful. */ virtual bool read_input (std::istream &input); /** - * Read input from a file the - * name of which is given. The - * PathSearch class "PARAMETERS" - * is used to find the file. + * Read input from a file the name of which is given. The PathSearch + * class "PARAMETERS" is used to find the file. * - * Return whether the read was - * successful. + * Return whether the read was successful. * - * Unless <tt>optional</tt> is - * <tt>true</tt>, this function - * will automatically generate - * the requested file with - * default values if the file did - * not exist. This file will not - * contain additional comments if - * <tt>write_stripped_file</tt> - * is <tt>true</tt>. + * Unless <tt>optional</tt> is <tt>true</tt>, this function will + * automatically generate the requested file with default values if the + * file did not exist. This file will not contain additional comments if + * <tt>write_stripped_file</tt> is <tt>true</tt>. */ virtual bool read_input (const std::string &filename, const bool optional = false, const bool write_stripped_file = false); /** - * Read input from a string in - * memory. The lines in memory - * have to be separated by <tt>@\n</tt> - * characters. + * Read input from a string in memory. The lines in memory have to be + * separated by <tt>@\n</tt> characters. * - * Return whether the read was - * successful. + * Return whether the read was successful. */ virtual bool read_input_from_string (const char *s); /** - * Read a parameter file in XML - * format. This could be from a file - * originally written by the - * print_parameters() function using the - * XML output style and then modified by - * hand as necessary; or from a file - * written using this method and then - * modified by the graphical parameter - * GUI (see the general documentation of - * this class). + * Read a parameter file in XML format. This could be from a file + * originally written by the print_parameters() function using the XML + * output style and then modified by hand as necessary; or from a file + * written using this method and then modified by the graphical parameter + * GUI (see the general documentation of this class). * - * Return whether the read was - * successful. + * Return whether the read was successful. */ virtual bool read_input_from_xml (std::istream &input); @@ -1948,30 +1607,17 @@ public: /** - * Declare a new entry with name - * <tt>entry</tt>, default and for - * which any input has to match - * the <tt>pattern</tt> (default: any - * pattern). + * Declare a new entry with name <tt>entry</tt>, default and for which + * any input has to match the <tt>pattern</tt> (default: any pattern). * - * The last parameter defaulting - * to an empty string is used to - * add a documenting text to each - * entry which will be printed as - * a comment when this class is - * asked to write out all - * declarations to a stream using - * the print_parameters() - * function. + * The last parameter defaulting to an empty string is used to add a + * documenting text to each entry which will be printed as a comment when + * this class is asked to write out all declarations to a stream using + * the print_parameters() function. * - * The function generates an - * exception if the default value - * doesn't match the given - * pattern. An entry can be - * declared more than once - * without generating an error, - * for example to override an - * earlier default value. + * The function generates an exception if the default value doesn't match + * the given pattern. An entry can be declared more than once without + * generating an error, for example to override an earlier default value. */ void declare_entry (const std::string &entry, const std::string &default_value, @@ -1979,221 +1625,146 @@ public: const std::string &documentation = std::string()); /** - * Enter a subsection; if not yet - * existent, declare it. + * Enter a subsection; if not yet existent, declare it. */ void enter_subsection (const std::string &subsection); /** - * Leave present subsection. - * Return <tt>false</tt> if there is - * no subsection to leave; <tt>true</tt> - * otherwise. + * Leave present subsection. Return <tt>false</tt> if there is no + * subsection to leave; <tt>true</tt> otherwise. */ bool leave_subsection (); /** - * Return value of entry - * <tt>entry_string</tt>. If the - * entry was changed, then the - * changed value is returned, - * otherwise the default - * value. If the value of an - * undeclared entry is required, - * an exception will be thrown. + * Return value of entry <tt>entry_string</tt>. If the entry was + * changed, then the changed value is returned, otherwise the default + * value. If the value of an undeclared entry is required, an exception + * will be thrown. */ std::string get (const std::string &entry_string) const; /** - * Return value of entry - * <tt>entry_string</tt> as <tt>long - * int</tt>. (A long int is chosen so - * that even very large unsigned values - * can be returned by this function). + * Return value of entry <tt>entry_string</tt> as <tt>long int</tt>. (A + * long int is chosen so that even very large unsigned values can be + * returned by this function). */ long int get_integer (const std::string &entry_string) const; /** - * Return value of entry - * <tt>entry_name</tt> as - * <tt>double</tt>. + * Return value of entry <tt>entry_name</tt> as <tt>double</tt>. */ double get_double (const std::string &entry_name) const; /** - * Return value of entry - * <tt>entry_name</tt> as <tt>bool</tt>. - * The entry may be "true" or "yes" - * for <tt>true</tt>, "false" or - * "no" for <tt>false</tt> respectively. + * Return value of entry <tt>entry_name</tt> as <tt>bool</tt>. The entry + * may be "true" or "yes" for <tt>true</tt>, "false" or "no" for + * <tt>false</tt> respectively. */ bool get_bool (const std::string &entry_name) const; /** - * Change the value presently stored for - * <tt>entry_name</tt> to the one given - * in the second argument. + * Change the value presently stored for <tt>entry_name</tt> to the one + * given in the second argument. * - * The parameter must already exist in - * the present subsection. + * The parameter must already exist in the present subsection. * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * The function throws an exception of type ExcValueDoesNotMatchPattern + * if the new value does not conform to the pattern for this entry. */ void set (const std::string &entry_name, const std::string &new_value); /** - * Same as above, but an overload where - * the second argument is a character - * pointer. This is necessary, since - * otherwise the call to - * <tt>set("abc","def")</code> will be - * mapped to the function taking one - * string and a bool as arguments, which - * is certainly not what is most often - * intended. + * Same as above, but an overload where the second argument is a + * character pointer. This is necessary, since otherwise the call to + * <tt>set("abc","def")</code> will be mapped to the function taking one + * string and a bool as arguments, which is certainly not what is most + * often intended. * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * The function throws an exception of type ExcValueDoesNotMatchPattern + * if the new value does not conform to the pattern for this entry. */ void set (const std::string &entry_name, const char *new_value); /** - * Change the value presently stored for - * <tt>entry_name</tt> to the one given - * in the second argument. + * Change the value presently stored for <tt>entry_name</tt> to the one + * given in the second argument. * - * The parameter must already exist in - * the present subsection. + * The parameter must already exist in the present subsection. * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * The function throws an exception of type ExcValueDoesNotMatchPattern + * if the new value does not conform to the pattern for this entry. */ void set (const std::string &entry_name, const long int &new_value); /** - * Change the value presently stored for - * <tt>entry_name</tt> to the one given - * in the second argument. + * Change the value presently stored for <tt>entry_name</tt> to the one + * given in the second argument. * - * The parameter must already exist in - * the present subsection. + * The parameter must already exist in the present subsection. * - * For internal purposes, the new value - * needs to be converted to a - * string. This is done using 16 digits - * of accuracy, so the set value and the - * one you can get back out using - * get_double() may differ in the 16th + * For internal purposes, the new value needs to be converted to a + * string. This is done using 16 digits of accuracy, so the set value and + * the one you can get back out using get_double() may differ in the 16th * digit. * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * The function throws an exception of type ExcValueDoesNotMatchPattern + * if the new value does not conform to the pattern for this entry. */ void set (const std::string &entry_name, const double &new_value); /** - * Change the value presently stored for - * <tt>entry_name</tt> to the one given - * in the second argument. + * Change the value presently stored for <tt>entry_name</tt> to the one + * given in the second argument. * - * The parameter must already exist in - * the present subsection. + * The parameter must already exist in the present subsection. * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * The function throws an exception of type ExcValueDoesNotMatchPattern + * if the new value does not conform to the pattern for this entry. */ void set (const std::string &entry_name, const bool &new_value); /** - * Print all parameters with the - * given style to - * <tt>out</tt>. Presently only - * <tt>Text</tt> and <tt>LaTeX</tt> are - * implemented. + * Print all parameters with the given style to <tt>out</tt>. Presently + * only <tt>Text</tt> and <tt>LaTeX</tt> are implemented. * - * In <tt>Text</tt> format, the output - * is formatted in such a way - * that it is possible to use it - * for later input again. This is - * most useful to record the - * parameters for a specific run, - * since if you output the - * parameters using this function - * into a log file, you can - * always recover the results by - * simply copying the output to - * your input file. + * In <tt>Text</tt> format, the output is formatted in such a way that it + * is possible to use it for later input again. This is most useful to + * record the parameters for a specific run, since if you output the + * parameters using this function into a log file, you can always recover + * the results by simply copying the output to your input file. * - * Besides the name and value of - * each entry, the output also - * contains the default value of - * entries if it is different - * from the actual value, as well - * as the documenting string - * given to the - * declare_entry() function + * Besides the name and value of each entry, the output also contains the + * default value of entries if it is different from the actual value, as + * well as the documenting string given to the declare_entry() function * if available. * - * In <tt>Text</tt> format, the - * output contains the same information - * but in a format so that the - * resulting file can be input into - * a latex document such as a manual - * for the code for which this object - * handles run-time parameters. - * The various sections of parameters - * are then represented by latex - * section and subsection commands - * as well as by nested enumerations. + * In <tt>Text</tt> format, the output contains the same information but + * in a format so that the resulting file can be input into a latex + * document such as a manual for the code for which this object handles + * run-time parameters. The various sections of parameters are then + * represented by latex section and subsection commands as well as by + * nested enumerations. * - * In addition, all parameter names - * are listed with <code>@\index</code> - * statements in two indices called - * <code>prmindex</code> (where the - * name of each parameter is listed - * in the index) and <code>prmindexfull</code> - * where parameter names are listed - * sorted by the section in which - * they exist. By default, the LaTeX - * program ignores these <code>@\index</code> - * commands, but they can be used to - * generate an index by using the - * following commands in the preamble - * of the latex file: + * In addition, all parameter names are listed with <code>@\index</code> + * statements in two indices called <code>prmindex</code> (where the name + * of each parameter is listed in the index) and + * <code>prmindexfull</code> where parameter names are listed sorted by + * the section in which they exist. By default, the LaTeX program ignores + * these <code>@\index</code> commands, but they can be used to generate + * an index by using the following commands in the preamble of the latex + * file: * @code * \usepackage{imakeidx} * \makeindex[name=prmindex, title=Index of run-time parameter entries] * \makeindex[name=prmindexfull, title=Index of run-time parameters with section names] * @endcode - * and at the end of the file - * this: + * and at the end of the file this: * @code * \printindex[prmindex] * \printindex[prmindexfull] @@ -2203,76 +1774,51 @@ public: const OutputStyle style); /** - * Print out the parameters of - * the present subsection as - * given by the - * <tt>subsection_path</tt> member - * variable. This variable is - * controlled by entering and - * leaving subsections through - * the enter_subsection() and - * leave_subsection() - * functions. + * Print out the parameters of the present subsection as given by the + * <tt>subsection_path</tt> member variable. This variable is controlled + * by entering and leaving subsections through the enter_subsection() and + * leave_subsection() functions. * - * In most cases, you will not - * want to use this function - * directly, but have it called - * recursively by the previous - * function. + * In most cases, you will not want to use this function directly, but + * have it called recursively by the previous function. */ void print_parameters_section (std::ostream &out, const OutputStyle style, const unsigned int indent_level); /** - * Print parameters to a - * logstream. This function - * allows to print all parameters - * into a log-file. Sections - * will be indented in the usual + * Print parameters to a logstream. This function allows to print all + * parameters into a log-file. Sections will be indented in the usual * log-file style. */ void log_parameters (LogStream &out); /** - * Log parameters in the present - * subsection. The subsection is - * determined by the - * <tt>subsection_path</tt> member - * variable. This variable is - * controlled by entering and - * leaving subsections through - * the enter_subsection() and - * leave_subsection() - * functions. + * Log parameters in the present subsection. The subsection is determined + * by the <tt>subsection_path</tt> member variable. This variable is + * controlled by entering and leaving subsections through the + * enter_subsection() and leave_subsection() functions. * - * In most cases, you will not - * want to use this function - * directly, but have it called - * recursively by the previous - * function. + * In most cases, you will not want to use this function directly, but + * have it called recursively by the previous function. */ void log_parameters_section (LogStream &out); /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this + * Determine an estimate for the memory consumption (in bytes) of this * object. */ std::size_t memory_consumption () const; /** - * Write the data of this object to a - * stream for the purpose of + * Write the data of this object to a stream for the purpose of * serialization. */ template <class Archive> void save (Archive &ar, const unsigned int version) const; /** - * Read the data of this object from a - * stream for the purpose of + * Read the data of this object from a stream for the purpose of * serialization. */ template <class Archive> @@ -2320,104 +1866,73 @@ public: //@} private: /** - * The separator used when - * accessing elements of a path - * into the parameter tree. + * The separator used when accessing elements of a path into the + * parameter tree. */ static const char path_separator = '.'; /** - * The complete tree of sections - * and entries. See the general - * documentation of this class - * for a description how data is - * stored in this variable. + * The complete tree of sections and entries. See the general + * documentation of this class for a description how data is stored in + * this variable. * - * The variable is a pointer so - * that we can use an incomplete - * type, rather than having to - * include all of the - * property_tree stuff from - * boost. This works around a - * problem with gcc 4.5. + * The variable is a pointer so that we can use an incomplete type, + * rather than having to include all of the property_tree stuff from + * boost. This works around a problem with gcc 4.5. */ std::auto_ptr<boost::property_tree::ptree> entries; /** - * A list of patterns that are - * used to describe the - * parameters of this object. The - * are indexed by nodes in the - * property tree. + * A list of patterns that are used to describe the parameters of this + * object. The are indexed by nodes in the property tree. */ std::vector<std_cxx1x::shared_ptr<const Patterns::PatternBase> > patterns; /** - * Mangle a string so that it - * doesn't contain any special - * characters or spaces. + * Mangle a string so that it doesn't contain any special characters or + * spaces. */ static std::string mangle (const std::string &s); /** - * Unmangle a string into its - * original form. + * Unmangle a string into its original form. */ static std::string demangle (const std::string &s); /** - * Return whether a given node is - * a parameter node or a - * subsection node. + * Return whether a given node is a parameter node or a subsection node. */ static bool is_parameter_node (const boost::property_tree::ptree &); /** - * Path of presently selected - * subsections; empty list means - * top level + * Path of presently selected subsections; empty list means top level */ std::vector<std::string> subsection_path; /** - * Return the string that - * identifies the current path - * into the property tree. This - * is only a path, i.e. it is not - * terminated by the + * Return the string that identifies the current path into the property + * tree. This is only a path, i.e. it is not terminated by the * path_separator character. */ std::string get_current_path () const; /** - * Given the name of an entry as - * argument, the function - * computes a full path into the - * parameter tree using the - * current subsection. + * Given the name of an entry as argument, the function computes a full + * path into the parameter tree using the current subsection. */ std::string get_current_full_path (const std::string &name) const; /** - * Scan one line of input. - * <tt>lineno</tt> is the number of - * the line presently scanned - * (for the logs if there are - * messages). Return <tt>false</tt> if - * line contained stuff that - * could not be understood, the - * uppermost subsection was to be - * left by an <tt>END</tt> or <tt>end</tt> - * statement, a value for a - * non-declared entry was given - * or the entry value did not - * match the regular - * expression. <tt>true</tt> otherwise. + * Scan one line of input. <tt>lineno</tt> is the number of the line + * presently scanned (for the logs if there are messages). Return + * <tt>false</tt> if line contained stuff that could not be understood, + * the uppermost subsection was to be left by an <tt>END</tt> or + * <tt>end</tt> statement, a value for a non-declared entry was given or + * the entry value did not match the regular expression. <tt>true</tt> + * otherwise. * - * The function modifies its - * argument, but also takes it by - * value, so the caller's - * variable is not changed. + * The function modifies its argument, but also takes it by value, so the + * caller's variable is not changed. */ bool scan_line (std::string line, const unsigned int lineno); @@ -2428,57 +1943,64 @@ private: /** - * The class MultipleParameterLoop offers an easy possibility to test several - * parameter sets during one run of the program. For this it uses the - * ParameterHandler class to read in data in a standardized form, searches for - * variant entry values and performs a loop over all combinations of parameters. + * The class MultipleParameterLoop offers an easy possibility to test + * several parameter sets during one run of the program. For this it uses + * the ParameterHandler class to read in data in a standardized form, + * searches for variant entry values and performs a loop over all + * combinations of parameters. * * Variant entry values are given like this: * @verbatim * set Time step size = { 0.1 | 0.2 | 0.3 } * @endverbatim - * The loop will then perform three runs of the program, one for each value - * of <tt>Time step size</tt>, while all other parameters are as specified or with their - * default value. If there are several variant entry values in the input, a loop is - * performed for each combination of variant values: + * The loop will then perform three runs of the program, one for each + * value of <tt>Time step size</tt>, while all other parameters are as + * specified or with their default value. If there are several variant + * entry values in the input, a loop is performed for each combination of + * variant values: * @verbatim * set Time step size = { 0.1 | 0.2 } * set Solver = { CG | GMRES } * @endverbatim - * will result in four runs of the programs, with time step 0.1 and 0.2 for each - * of the two solvers. + * will result in four runs of the programs, with time step 0.1 and 0.2 + * for each of the two solvers. * - * In addition to variant entries, this class also supports <i>array entries</i> that look like this: + * In addition to variant entries, this class also supports <i>array + * entries</i> that look like this: * @verbatim * set Output file = ofile.{{ 1 | 2 | 3 | 4 }} * @endverbatim - * This indicates that if there are variant entries producing a total of four - * different runs, then we will write their results to the files <tt>ofile.1</tt>, <tt>ofile.2</tt>, - * <tt>ofile.3</tt> and <tt>ofile.4</tt>, respectively. Array entries do not generate multiple - * runs of the main loop themselves, but if there are variant entries, then in - * the <i>n</i>th run of the main loop, also the <i>n</i>th value of an array is returned. - * - * Since the different variants are constructed in the order of declaration, not in - * the order in which the variant entries appear in the input file, it may be - * difficult to guess the mapping between the different variants and the appropriate - * entry in an array. You will have to check the order of declaration, or use - * only one variant entry. - * - * It is guaranteed that only selections which match the regular expression (pattern) given - * upon declaration of an entry are given back to the program. If a variant value - * does not match the regular expression, the default value is stored and an error - * is issued. Before the first run of the loop, all possible values are checked - * for their conformance, so that the error is issued at the very beginning of the + * This indicates that if there are variant entries producing a total of + * four different runs, then we will write their results to the files + * <tt>ofile.1</tt>, <tt>ofile.2</tt>, <tt>ofile.3</tt> and + * <tt>ofile.4</tt>, respectively. Array entries do not generate multiple + * runs of the main loop themselves, but if there are variant entries, + * then in the <i>n</i>th run of the main loop, also the <i>n</i>th value + * of an array is returned. + * + * Since the different variants are constructed in the order of + * declaration, not in the order in which the variant entries appear in + * the input file, it may be difficult to guess the mapping between the + * different variants and the appropriate entry in an array. You will + * have to check the order of declaration, or use only one variant entry. + * + * It is guaranteed that only selections which match the regular + * expression (pattern) given upon declaration of an entry are given back + * to the program. If a variant value does not match the regular + * expression, the default value is stored and an error is issued. Before + * the first run of the loop, all possible values are checked for their + * conformance, so that the error is issued at the very beginning of the * program. * * * <h3>Usage</h3> * - * The usage of this class is similar to the ParameterHandler class. First the - * entries and subsections have to be declared, then a loop is performed in which - * the different parameter sets are set, a new instance of a user class is created - * which is then called. Taking the classes of the example for the - * ParameterHandler class, the extended program would look like this: + * The usage of this class is similar to the ParameterHandler class. + * First the entries and subsections have to be declared, then a loop is + * performed in which the different parameter sets are set, a new + * instance of a user class is created which is then called. Taking the + * classes of the example for the ParameterHandler class, the extended + * program would look like this: * @code * class HelperClass : public MultipleParameterLoop::UserClass { * public: @@ -2525,25 +2047,25 @@ private: * } * @endcode * - * As can be seen, first a new helper class has to be set up. This must contain - * a virtual constructor for a problem class. You can also derive your problem - * class from MultipleParameterLoop::UserClass and let <tt>create_new</tt> clear all - * member variables. If you have access to all inherited member variables in - * some way this is the recommended procedure. A third possibility is to use - * multiple inheritance and derive a helper class from both the - * MultipleParameterLoop::UserClass and the problem class. In any case, - * <tt>create_new</tt> has to provide a clean problem object which is the problem in - * the second and third possibility. - * - * The derived class also - * has to provide for member functions which declare the entries and which run - * the program. Running the program includes getting the parameters out of the - * ParameterHandler object. + * As can be seen, first a new helper class has to be set up. This must + * contain a virtual constructor for a problem class. You can also derive + * your problem class from MultipleParameterLoop::UserClass and let + * <tt>create_new</tt> clear all member variables. If you have access to + * all inherited member variables in some way this is the recommended + * procedure. A third possibility is to use multiple inheritance and + * derive a helper class from both the MultipleParameterLoop::UserClass + * and the problem class. In any case, <tt>create_new</tt> has to provide + * a clean problem object which is the problem in the second and third + * possibility. + * + * The derived class also has to provide for member functions which + * declare the entries and which run the program. Running the program + * includes getting the parameters out of the ParameterHandler object. * * After defining an object of this helper class and an object of the - * MultipleParameterLoop class, the entries have to be declared in the same way - * as for the ParameterHandler class. Then the input has to be read. Finally - * the loop is called. This executes the following steps: + * MultipleParameterLoop class, the entries have to be declared in the + * same way as for the ParameterHandler class. Then the input has to be + * read. Finally the loop is called. This executes the following steps: * @code * for (each combination) * { @@ -2554,9 +2076,9 @@ private: * UserObject.run (*this); * } * @endcode - * <tt>UserObject</tt> is the parameter to the <tt>loop</tt> function. <tt>create_new</tt> is given the number - * of the run (starting from one) to enable naming output files differently for each - * run. + * <tt>UserObject</tt> is the parameter to the <tt>loop</tt> function. + * <tt>create_new</tt> is given the number of the run (starting from one) + * to enable naming output files differently for each run. * * * <h3>Syntax for variant and array entry values</h3> @@ -2574,8 +2096,8 @@ private: * * <h3>Worked example</h3> * - * Given the above extensions to the example program for the ParameterHandler and the - * following input file + * Given the above extensions to the example program for the + * ParameterHandler and the following input file * @verbatim * set Equation 1 = Poisson * set Equation 2 = Navier-Stokes @@ -2630,8 +2152,8 @@ private: * eq1=Poisson, eq2=Navier-Stokes * Matrix1=Sparse, Matrix2=Full * @endverbatim - * Since <tt>create_new</tt> gets the number of the run it would also be possible to output - * the number of the run. + * Since <tt>create_new</tt> gets the number of the run it would also be + * possible to output the number of the run. * * * @ingroup input @@ -2641,37 +2163,32 @@ class MultipleParameterLoop : public ParameterHandler { public: /** - * This is the class the helper class or the - * problem class has to be derived of. + * This is the class the helper class or the problem class has to be + * derived of. */ class UserClass { public: /** - * Destructor. It doesn't actually do - * anything, but is declared to force - * derived classes to have a virtual - * destructor. + * Destructor. It doesn't actually do anything, but is declared to + * force derived classes to have a virtual destructor. */ virtual ~UserClass (); /** - * <tt>create_new</tt> must provide a clean - * object, either by creating a new one - * or by cleaning an old one. + * <tt>create_new</tt> must provide a clean object, either by creating + * a new one or by cleaning an old one. */ virtual void create_new (const unsigned int run_no) = 0; /** - * This should declare parameters and call - * the <tt>declare_parameters</tt> function of the - * problem class. + * This should declare parameters and call the + * <tt>declare_parameters</tt> function of the problem class. */ virtual void declare_parameters (ParameterHandler &prm) = 0; /** - * Get the parameters and run any - * necessary action. + * Get the parameters and run any necessary action. */ virtual void run (ParameterHandler &prm) = 0; }; @@ -2682,10 +2199,9 @@ public: MultipleParameterLoop (); /** - * Destructor. Declare this only to have - * a virtual destructor, which is safer - * as we have virtual functions. - * It actually does nothing spectacular. + * Destructor. Declare this only to have a virtual destructor, which is + * safer as we have virtual functions. It actually does nothing + * spectacular. */ virtual ~MultipleParameterLoop (); @@ -2695,9 +2211,8 @@ public: const bool write_stripped_file = false); /** - * Read input from a string in memory. The - * lines in memory have to be separated by - * <tt>@\n</tt> characters. + * Read input from a string in memory. The lines in memory have to be + * separated by <tt>@\n</tt> characters. */ virtual bool read_input_from_string (const char *s); @@ -2707,9 +2222,7 @@ public: void loop (UserClass &uc); /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this + * Determine an estimate for the memory consumption (in bytes) of this * object. */ std::size_t memory_consumption () const; @@ -2717,17 +2230,14 @@ public: private: /** - * An object in the list of entries with - * multiple values. + * An object in the list of entries with multiple values. */ class Entry { public: /** - * Declare what a multiple entry - * is: a variant * entry (in - * curly braces <tt>{</tt>, <tt>}</tt>) or an - * array (in double curly braces + * Declare what a multiple entry is: a variant * entry (in curly braces + * <tt>{</tt>, <tt>}</tt>) or an array (in double curly braces * <tt>{{</tt>, <tt>}}</tt>). */ enum MultipleEntryType @@ -2741,18 +2251,16 @@ private: Entry () : type (array) {} /** - * Construct an object with given subsection - * path, name and value. The splitting up - * into the different variants is done - * later by <tt>split_different_values</tt>. + * Construct an object with given subsection path, name and value. The + * splitting up into the different variants is done later by + * <tt>split_different_values</tt>. */ Entry (const std::vector<std::string> &Path, const std::string &Name, const std::string &Value); /** - * Split the entry value into the different - * branches. + * Split the entry value into the different branches. */ void split_different_values (); @@ -2772,22 +2280,18 @@ private: std::string entry_value; /** - * List of entry values constructed out of - * what was given in the input file (that - * is stored in EntryValue. + * List of entry values constructed out of what was given in the input + * file (that is stored in EntryValue. */ std::vector<std::string> different_values; /** - * Store whether this entry is a variant - * entry or an array. + * Store whether this entry is a variant entry or an array. */ MultipleEntryType type; /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this + * Determine an estimate for the memory consumption (in bytes) of this * object. */ std::size_t memory_consumption () const; @@ -2799,37 +2303,26 @@ private: std::vector<Entry> multiple_choices; /** - * Number of branches constructed - * from the different - * combinations of the variants. - * This obviously equals the - * number of runs to be - * performed. + * Number of branches constructed from the different combinations of the + * variants. This obviously equals the number of runs to be performed. */ unsigned int n_branches; /** - * Initialize the different - * branches, i.e. construct the - * combinations. + * Initialize the different branches, i.e. construct the combinations. */ void init_branches (); /** - * Traverse the section currently - * set by - * enter_subsection()/leave_subsection() - * and see which of the entries - * are variante/array - * entries. Then fill the - * multiple_choices variable - * using this information. + * Traverse the section currently set by + * enter_subsection()/leave_subsection() and see which of the entries are + * variante/array entries. Then fill the multiple_choices variable using + * this information. */ void init_branches_current_section (); /** - * Transfer the entry values for one run - * to the entry tree. + * Transfer the entry values for one run to the entry tree. */ void fill_entry_values (const unsigned int run_no); }; diff --git a/deal.II/include/deal.II/base/parsed_function.h b/deal.II/include/deal.II/base/parsed_function.h index b0bcf54e04..408ec9ae17 100644 --- a/deal.II/include/deal.II/base/parsed_function.h +++ b/deal.II/include/deal.II/base/parsed_function.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__parsed_function_h #define __deal2__parsed_function_h diff --git a/deal.II/include/deal.II/base/partitioner.h b/deal.II/include/deal.II/base/partitioner.h index 68d4c4d720..977f40a321 100644 --- a/deal.II/include/deal.II/base/partitioner.h +++ b/deal.II/include/deal.II/base/partitioner.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012 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__partitioner_h #define __deal2__partitioner_h @@ -20,6 +24,7 @@ #include <deal.II/base/utilities.h> #include <deal.II/base/memory_consumption.h> +#include <limits> DEAL_II_NAMESPACE_OPEN @@ -204,7 +209,7 @@ namespace Utilities * the individual processor on the ghost * elements present (second entry). */ - const std::vector<std::pair<unsigned int,unsigned int> > & + const std::vector<std::pair<unsigned int, types::global_dof_index> > & ghost_targets() const; /** @@ -215,7 +220,7 @@ namespace Utilities * but tailored to be iterated over, and some * indices may be duplicates. */ - const std::vector<std::pair<unsigned int, unsigned int> > & + const std::vector<std::pair<types::global_dof_index, types::global_dof_index> > & import_indices() const; /** @@ -233,7 +238,7 @@ namespace Utilities * indices that are ghosts on other * processors. */ - const std::vector<std::pair<unsigned int,unsigned int> > & + const std::vector<std::pair<unsigned int, types::global_dof_index> > & import_targets() const; /** @@ -272,7 +277,7 @@ namespace Utilities * Returns the MPI communicator underlying the * partitioner object. */ - const MPI_Comm& get_communicator() const; + const MPI_Comm &get_communicator() const; /** * Computes the memory consumption of this @@ -284,7 +289,8 @@ namespace Utilities * Exception */ DeclException2 (ExcIndexNotPresent, - unsigned int, unsigned int, + types::global_dof_index, + unsigned int, << "Global index " << arg1 << " neither owned nor ghost on proc " << arg2); @@ -325,7 +331,7 @@ namespace Utilities * ghost indices belong to and how many those * indices are */ - std::vector<std::pair<unsigned int,unsigned int> > ghost_targets_data; + std::vector<std::pair<unsigned int, types::global_dof_index> > ghost_targets_data; /** * The set of (local) indices that we are @@ -335,7 +341,7 @@ namespace Utilities * but tailored to be iterated over, and some * indices may be duplicates. */ - std::vector<std::pair<unsigned int, unsigned int> > import_indices_data; + std::vector<std::pair<types::global_dof_index, types::global_dof_index> > import_indices_data; /** * Caches the number of ghost indices. It @@ -349,7 +355,7 @@ namespace Utilities * The set of processors and length of data * field which send us their ghost data */ - std::vector<std::pair<unsigned int,unsigned int> > import_targets_data; + std::vector<std::pair<unsigned int,types::global_dof_index> > import_targets_data; /** * The ID of the current processor in the MPI @@ -405,7 +411,10 @@ namespace Utilities unsigned int Partitioner::local_size () const { - return local_range_data.second - local_range_data.first; + types::global_dof_index size= local_range_data.second - local_range_data.first; + Assert(size<=std::numeric_limits<unsigned int>::max(), + ExcNotImplemented()); + return static_cast<unsigned int>(size); } @@ -441,10 +450,10 @@ namespace Utilities Assert(in_local_range(global_index) || is_ghost_entry (global_index), ExcIndexNotPresent(global_index, my_pid)); if (in_local_range(global_index)) - return global_index - local_range_data.first; + return static_cast<unsigned int>(global_index - local_range_data.first); else if (is_ghost_entry (global_index)) return (local_size() + - ghost_indices_data.index_within_set (global_index)); + static_cast<unsigned int>(ghost_indices_data.index_within_set (global_index))); else // should only end up here in // optimized mode, when we use this @@ -487,7 +496,7 @@ namespace Utilities inline - const std::vector<std::pair<unsigned int,unsigned int> > & + const std::vector<std::pair<unsigned int, types::global_dof_index> > & Partitioner::ghost_targets() const { return ghost_targets_data; @@ -495,7 +504,7 @@ namespace Utilities inline - const std::vector<std::pair<unsigned int, unsigned int> > & + const std::vector<std::pair<types::global_dof_index, types::global_dof_index> > & Partitioner::import_indices() const { return import_indices_data; @@ -513,7 +522,7 @@ namespace Utilities inline - const std::vector<std::pair<unsigned int,unsigned int> > & + const std::vector<std::pair<unsigned int,types::global_dof_index> > & Partitioner::import_targets() const { return import_targets_data; @@ -565,7 +574,7 @@ namespace Utilities inline - const MPI_Comm& + const MPI_Comm & Partitioner::get_communicator() const { return communicator; diff --git a/deal.II/include/deal.II/base/path_search.h b/deal.II/include/deal.II/base/path_search.h index c9c3ea70e3..0f47865a7a 100644 --- a/deal.II/include/deal.II/base/path_search.h +++ b/deal.II/include/deal.II/base/path_search.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 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__path_search_h #define __deal2__path_search_h diff --git a/deal.II/include/deal.II/base/point.h b/deal.II/include/deal.II/base/point.h index c33ea938c8..921fe9e463 100644 --- a/deal.II/include/deal.II/base/point.h +++ b/deal.II/include/deal.II/base/point.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__point_h #define __deal2__point_h diff --git a/deal.II/include/deal.II/base/polynomial.h b/deal.II/include/deal.II/base/polynomial.h index ec33ec38a8..49b75b09c2 100644 --- a/deal.II/include/deal.II/base/polynomial.h +++ b/deal.II/include/deal.II/base/polynomial.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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__polynomial_h #define __deal2__polynomial_h diff --git a/deal.II/include/deal.II/base/polynomial_space.h b/deal.II/include/deal.II/base/polynomial_space.h index 7fa0ca79dc..7865f3f581 100644 --- a/deal.II/include/deal.II/base/polynomial_space.h +++ b/deal.II/include/deal.II/base/polynomial_space.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__polynomial_space_h #define __deal2__polynomial_space_h @@ -44,7 +49,7 @@ DEAL_II_NAMESPACE_OPEN * set_numbering() function. * * The standard ordering of polynomials is that indices for the first - * space dimension vasry fastest and the last space dimension is + * space dimension vary fastest and the last space dimension is * slowest. In particular, if we take for simplicity the vector of * monomials <i>x<sup>0</sup>, x<sup>1</sup>, x<sup>2</sup>,..., * x<sup>n</sup></i>, we get diff --git a/deal.II/include/deal.II/base/polynomials_abf.h b/deal.II/include/deal.II/base/polynomials_abf.h index e211186dfb..9219937e03 100644 --- a/deal.II/include/deal.II/base/polynomials_abf.h +++ b/deal.II/include/deal.II/base/polynomials_abf.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__polynomials_abf_h #define __deal2__polynomials_abf_h diff --git a/deal.II/include/deal.II/base/polynomials_adini.h b/deal.II/include/deal.II/base/polynomials_adini.h index a840d1f5c4..dbff105228 100644 --- a/deal.II/include/deal.II/base/polynomials_adini.h +++ b/deal.II/include/deal.II/base/polynomials_adini.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 __deal2__polynomials_adini_h #define __deal2__polynomials_adini_h diff --git a/deal.II/include/deal.II/base/polynomials_bdm.h b/deal.II/include/deal.II/base/polynomials_bdm.h index 5eb1b18620..83f4bf1bab 100644 --- a/deal.II/include/deal.II/base/polynomials_bdm.h +++ b/deal.II/include/deal.II/base/polynomials_bdm.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 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__polynomials_BDM_h #define __deal2__polynomials_BDM_h diff --git a/deal.II/include/deal.II/base/polynomials_nedelec.h b/deal.II/include/deal.II/base/polynomials_nedelec.h index e571bfb928..7fa2cce6e7 100644 --- a/deal.II/include/deal.II/base/polynomials_nedelec.h +++ b/deal.II/include/deal.II/base/polynomials_nedelec.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__polynomials_nedelec_h #define __deal2__polynomials_nedelec_h diff --git a/deal.II/include/deal.II/base/polynomials_p.h b/deal.II/include/deal.II/base/polynomials_p.h index e7a50068af..1723f120e0 100644 --- a/deal.II/include/deal.II/base/polynomials_p.h +++ b/deal.II/include/deal.II/base/polynomials_p.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 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__polynomials_P_h #define __deal2__polynomials_P_h diff --git a/deal.II/include/deal.II/base/polynomials_piecewise.h b/deal.II/include/deal.II/base/polynomials_piecewise.h index c9e1dbbcaa..8ff4d0b786 100644 --- a/deal.II/include/deal.II/base/polynomials_piecewise.h +++ b/deal.II/include/deal.II/base/polynomials_piecewise.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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__polynomials_piecewise_h #define __deal2__polynomials_piecewise_h @@ -187,7 +192,7 @@ namespace Polynomials y = offset+step+step-x; } else - { + { const number offset = step * interval; if (x<offset || x>offset+step) return 0; diff --git a/deal.II/include/deal.II/base/polynomials_raviart_thomas.h b/deal.II/include/deal.II/base/polynomials_raviart_thomas.h index 9aa9ae4d4b..749aae8bec 100644 --- a/deal.II/include/deal.II/base/polynomials_raviart_thomas.h +++ b/deal.II/include/deal.II/base/polynomials_raviart_thomas.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 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__polynomials_raviart_thomas_h #define __deal2__polynomials_raviart_thomas_h diff --git a/deal.II/include/deal.II/base/qprojector.h b/deal.II/include/deal.II/base/qprojector.h index c89c41ffe7..5831c33fd2 100644 --- a/deal.II/include/deal.II/base/qprojector.h +++ b/deal.II/include/deal.II/base/qprojector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__qprojector_h #define __deal2__qprojector_h diff --git a/deal.II/include/deal.II/base/quadrature.h b/deal.II/include/deal.II/base/quadrature.h index cfe06b50fc..58dd4fbc1d 100644 --- a/deal.II/include/deal.II/base/quadrature.h +++ b/deal.II/include/deal.II/base/quadrature.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__quadrature_h #define __deal2__quadrature_h diff --git a/deal.II/include/deal.II/base/quadrature_lib.h b/deal.II/include/deal.II/base/quadrature_lib.h index b152a99937..f8759a4a9d 100644 --- a/deal.II/include/deal.II/base/quadrature_lib.h +++ b/deal.II/include/deal.II/base/quadrature_lib.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $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. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any 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__quadrature_lib_h #define __deal2__quadrature_lib_h @@ -295,7 +300,7 @@ public: * $[x_0,1]$, the actual location of the * singularity, the scale factor inside * the logarithmic function and a flag - * that decides wether the singularity is + * that decides whether the singularity is * left inside the quadrature formula or * it is factored out, to be included in * the integrand. @@ -334,7 +339,7 @@ protected: * original quadrature, and this process is repeated for the next half * element. * - * Upon construction it is possible to specify wether we want the + * Upon construction it is possible to specify whether we want the * singularity removed, or not. In other words, this quadrature can be * used to integrate $g(x) = 1/R\ f(x)$, or simply $f(x)$, with the $1/R$ * factor already included in the quadrature weights. diff --git a/deal.II/include/deal.II/base/quadrature_selector.h b/deal.II/include/deal.II/base/quadrature_selector.h index be61b286d1..48fe8dffe0 100644 --- a/deal.II/include/deal.II/base/quadrature_selector.h +++ b/deal.II/include/deal.II/base/quadrature_selector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__quadrature_selector_h #define __deal2__quadrature_selector_h diff --git a/deal.II/include/deal.II/base/smartpointer.h b/deal.II/include/deal.II/base/smartpointer.h index b1a1fbfce6..f61e2b3681 100644 --- a/deal.II/include/deal.II/base/smartpointer.h +++ b/deal.II/include/deal.II/base/smartpointer.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__smartpointer_h #define __deal2__smartpointer_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/array.h b/deal.II/include/deal.II/base/std_cxx1x/array.h index b9e7a72f8b..c660d09b54 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/array.h +++ b/deal.II/include/deal.II/base/std_cxx1x/array.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_array_h #define __deal2__std_cxx1x_array_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/bind.h b/deal.II/include/deal.II/base/std_cxx1x/bind.h index 49979bef2e..0c14d2ad0a 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/bind.h +++ b/deal.II/include/deal.II/base/std_cxx1x/bind.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_bind_h #define __deal2__std_cxx1x_bind_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/condition_variable.h b/deal.II/include/deal.II/base/std_cxx1x/condition_variable.h index b439d5c91a..89429ef2fc 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/condition_variable.h +++ b/deal.II/include/deal.II/base/std_cxx1x/condition_variable.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_condition_variable_h #define __deal2__std_cxx1x_condition_variable_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/function.h b/deal.II/include/deal.II/base/std_cxx1x/function.h index 18f807e499..d3e902ff89 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/function.h +++ b/deal.II/include/deal.II/base/std_cxx1x/function.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_function_h #define __deal2__std_cxx1x_function_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/mutex.h b/deal.II/include/deal.II/base/std_cxx1x/mutex.h index df5652a4be..817ebda660 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/mutex.h +++ b/deal.II/include/deal.II/base/std_cxx1x/mutex.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_mutex_h #define __deal2__std_cxx1x_mutex_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/shared_ptr.h b/deal.II/include/deal.II/base/std_cxx1x/shared_ptr.h index d51ccb5a2b..f8a6744ce5 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/shared_ptr.h +++ b/deal.II/include/deal.II/base/std_cxx1x/shared_ptr.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_shared_ptr_h #define __deal2__std_cxx1x_shared_ptr_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/thread.h b/deal.II/include/deal.II/base/std_cxx1x/thread.h index bcbc1c5dfa..6b43b2525a 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/thread.h +++ b/deal.II/include/deal.II/base/std_cxx1x/thread.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_thread_h #define __deal2__std_cxx1x_thread_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/tuple.h b/deal.II/include/deal.II/base/std_cxx1x/tuple.h index 4bcf46951f..0282c112da 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/tuple.h +++ b/deal.II/include/deal.II/base/std_cxx1x/tuple.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_tuple_h #define __deal2__std_cxx1x_tuple_h diff --git a/deal.II/include/deal.II/base/std_cxx1x/type_traits.h b/deal.II/include/deal.II/base/std_cxx1x/type_traits.h index 31bceaaf67..f64cf36d60 100644 --- a/deal.II/include/deal.II/base/std_cxx1x/type_traits.h +++ b/deal.II/include/deal.II/base/std_cxx1x/type_traits.h @@ -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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__std_cxx1x_type_traits_h #define __deal2__std_cxx1x_type_traits_h diff --git a/deal.II/include/deal.II/base/subscriptor.h b/deal.II/include/deal.II/base/subscriptor.h index 0345b95575..a6372e016e 100644 --- a/deal.II/include/deal.II/base/subscriptor.h +++ b/deal.II/include/deal.II/base/subscriptor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any 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__subscriptor_h #define __deal2__subscriptor_h @@ -131,10 +136,10 @@ public: int, char *, std::string &, << "Object of class " << arg2 << " is still used by " << arg1 << " other objects.\n" - << "(Additional information: " << arg3 << ")\n" - << "Note the entry in the Frequently Asked Questions of " - << "deal.II (linked to from http://www.dealii.org/) for " - << "more information on what this error means."); + << "(Additional information: " << arg3 << ")\n" + << "Note the entry in the Frequently Asked Questions of " + << "deal.II (linked to from http://www.dealii.org/) for " + << "more information on what this error means."); /** * A subscriber with the diff --git a/deal.II/include/deal.II/base/symmetric_tensor.h b/deal.II/include/deal.II/base/symmetric_tensor.h index 6f1d47d626..dd79b821d5 100644 --- a/deal.II/include/deal.II/base/symmetric_tensor.h +++ b/deal.II/include/deal.II/base/symmetric_tensor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__symmetric_tensor_h #define __deal2__symmetric_tensor_h diff --git a/deal.II/include/deal.II/base/synchronous_iterator.h b/deal.II/include/deal.II/base/synchronous_iterator.h index 2c47dba5ae..4bc42d379e 100644 --- a/deal.II/include/deal.II/base/synchronous_iterator.h +++ b/deal.II/include/deal.II/base/synchronous_iterator.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__synchronous_iterator_h #define __deal2__synchronous_iterator_h diff --git a/deal.II/include/deal.II/base/table.h b/deal.II/include/deal.II/base/table.h index 83fa744446..4f884dc414 100644 --- a/deal.II/include/deal.II/base/table.h +++ b/deal.II/include/deal.II/base/table.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 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__table_h #define __deal2__table_h @@ -634,15 +639,27 @@ public: operator () (const TableIndices<N> &indices) const; /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. + * Swap the contents of this table and the other table @p v. One could do + * this operation with a temporary variable and copying over the data + * elements, but this function is significantly more efficient since it only + * swaps the pointers to the data of the two vectors and therefore does not + * need to allocate temporary storage and move data around. + * + * This function is analog to the the @p swap function of all C++ standard + * containers. Also, there is a global function <tt>swap(u,v)</tt> that + * simply calls <tt>u.swap(v)</tt>, again in analogy to standard functions. + */ + void swap (TableBase<N,T> &v); + + /** + * Determine an estimate for the memory consumption (in bytes) of this + * object. */ std::size_t memory_consumption () const; /** - * Write or read the data of this object to or - * from a stream for the purpose of serialization. + * Write or read the data of this object to or from a stream for the purpose + * of serialization. */ template <class Archive> void serialize (Archive &ar, const unsigned int version); @@ -2077,6 +2094,17 @@ TableBase<N,T>::fill (const T2 *entries) +template <int N, typename T> +inline +void +TableBase<N,T>::swap (TableBase<N,T> &v) +{ + values.swap(v.values); + std::swap (table_size, v.table_size); +} + + + template <int N, typename T> inline std::size_t @@ -3168,6 +3196,23 @@ Table<7,T>::operator () (const TableIndices<7> &indices) #endif // DOXYGEN + + + +/** + * Global function @p swap which overloads the default implementation + * of the C++ standard library which uses a temporary object. The + * function simply exchanges the data of the two tables. + * + * @author Martin Kronbichler, 2013 + */ +template <int N, typename T> +inline +void swap (TableBase<N,T> &u, TableBase<N,T> &v) +{ + u.swap (v); +} + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/include/deal.II/base/table_handler.h b/deal.II/include/deal.II/base/table_handler.h index c760d35523..0e2aebf0fe 100644 --- a/deal.II/include/deal.II/base/table_handler.h +++ b/deal.II/include/deal.II/base/table_handler.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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__table_handler_h #define __deal2__table_handler_h @@ -120,7 +125,7 @@ namespace internal /** * Abbreviation for the data type stored by this object. */ - typedef boost::variant<int,unsigned int,double,std::string> value_type; + typedef boost::variant<int,unsigned int,unsigned long long int,double,std::string> value_type; /** * Stored value. diff --git a/deal.II/include/deal.II/base/table_indices.h b/deal.II/include/deal.II/base/table_indices.h index 6e4f5414fe..44dd9fd9a6 100644 --- a/deal.II/include/deal.II/base/table_indices.h +++ b/deal.II/include/deal.II/base/table_indices.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__table_indices_h #define __deal2__table_indices_h @@ -42,6 +47,12 @@ public: */ unsigned int operator[] (const unsigned int i) const; + /** + * Write access the value of the + * <tt>i</tt>th index. + */ + unsigned int &operator[] (const unsigned int i); + /** * Compare two index fields for * equality. @@ -142,7 +153,7 @@ public: }; //TODO: Remove the default arguments and trickery below and put all -//the constructors into the class demplate +//the constructors into the class template /** * Array of indices of fixed size used for the TableBase @@ -424,6 +435,14 @@ TableIndicesBase<N>::operator [] (const unsigned int i) const return indices[i]; } +template <int N> +inline +unsigned int & +TableIndicesBase<N>::operator [] (const unsigned int i) +{ + Assert (i < N, ExcIndexRange (i, 0, N)); + return indices[i]; +} template <int N> diff --git a/deal.II/include/deal.II/base/template_constraints.h b/deal.II/include/deal.II/base/template_constraints.h index 368251b61e..f77a552c71 100644 --- a/deal.II/include/deal.II/base/template_constraints.h +++ b/deal.II/include/deal.II/base/template_constraints.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__template_constraints_h #define __deal2__template_constraints_h diff --git a/deal.II/include/deal.II/base/tensor.h b/deal.II/include/deal.II/base/tensor.h index c151cb197f..5ddc7dc752 100644 --- a/deal.II/include/deal.II/base/tensor.h +++ b/deal.II/include/deal.II/base/tensor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 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__tensor_h #define __deal2__tensor_h @@ -71,6 +76,14 @@ public: */ static const unsigned int rank = rank_; + /** + * Number of independent components of a + * tensor of current rank. This is dim times the + * number of independent components of each sub-tensor. + */ + static const unsigned int + n_independent_components = Tensor<rank_-1,dim>::n_independent_components *dim; + /** * Type of stored objects. This * is a tensor of lower rank. @@ -135,6 +148,16 @@ public: */ const Tensor<rank_-1,dim,Number> &operator [] (const unsigned int i) const; + /** + * Read access using TableIndices <tt>indices</tt> + */ + Number operator [](const TableIndices<rank_> &indices) const; + + /** + * Read and write access using TableIndices <tt>indices</tt> + */ + Number &operator [](const TableIndices<rank_> &indices); + /** * Assignment operator. */ @@ -242,6 +265,24 @@ public: template <typename Number2> void unroll (Vector<Number2> &result) const; + /** + * Returns an unrolled index in + * the range [0,dim^rank-1] for the element of the tensor indexed by + * the argument to the function. + */ + static + unsigned int + component_to_unrolled_index(const TableIndices<rank_> &indices); + + /** + * Opposite of component_to_unrolled_index: For an index in the + * range [0,dim^rank-1], return which set of indices it would + * correspond to. + */ + static + TableIndices<rank_> unrolled_to_component_indices(const unsigned int i); + + /** * Reset all values to zero. @@ -379,7 +420,33 @@ Tensor<rank_,dim,Number>::operator[] (const unsigned int i) const return subtensor[i]; } +template <int rank_, int dim, typename Number> +inline +Number +Tensor<rank_,dim,Number>::operator[] (const TableIndices<rank_> &indices) const +{ + const unsigned int inner_ind = indices[0]; + Assert (inner_ind<dim, ExcIndexRange(inner_ind, 0, dim)); + TableIndices<rank_-1> indices1; + for (unsigned int i = 0; i < rank_-1; i++) + indices1[i] = indices[i+1]; + return (subtensor[inner_ind])[indices1]; +} + +template <int rank_, int dim, typename Number> +inline +Number & +Tensor<rank_,dim,Number>::operator[] (const TableIndices<rank_> &indices) +{ + const unsigned int inner_ind = indices[0]; + Assert (inner_ind<dim, ExcIndexRange(inner_ind, 0, dim)); + + TableIndices<rank_-1> indices1; + for (unsigned int i = 0; i < rank_-1; i++) + indices1[i] = indices[i+1]; + return (subtensor[inner_ind])[indices1]; +} template <int rank_, int dim, typename Number> inline @@ -574,6 +641,41 @@ Tensor<rank_, dim, Number>::unroll_recursion (Vector<Number2> &result, } } +template <int rank_, int dim, typename Number> +inline +unsigned int +Tensor<rank_, dim, Number>::component_to_unrolled_index(const TableIndices<rank_> &indices) +{ + TableIndices<rank_-1> indices1; + for (unsigned int i = 0; i < rank_-1; i++) + indices1[i] = indices[i]; + + Assert (indices[rank_-1] < dim, + ExcIndexRange (indices[rank_-1], 0, dim)); + return ( Tensor<rank_-1,dim,Number>::component_to_unrolled_index(indices1) * dim + indices[rank_-1]); +} + +template <int rank_, int dim, typename Number> +inline +TableIndices<rank_> +Tensor<rank_, dim, Number>::unrolled_to_component_indices(const unsigned int i) +{ + Assert (i < n_independent_components, + ExcIndexRange (i, 0, n_independent_components)); + + TableIndices<rank_> indices; + + unsigned int remainder = i; + for (int r=rank_-1; r>=0; --r) + { + indices[r] = (remainder % dim); + remainder /= dim; + } + Assert (remainder == 0, ExcInternalError()); + + return indices; +} + template <int rank_, int dim, typename Number> diff --git a/deal.II/include/deal.II/base/tensor_base.h b/deal.II/include/deal.II/base/tensor_base.h index 6574ddc6f2..94c8e1b3e9 100644 --- a/deal.II/include/deal.II/base/tensor_base.h +++ b/deal.II/include/deal.II/base/tensor_base.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__tensor_base_h #define __deal2__tensor_base_h @@ -21,6 +26,7 @@ #include <deal.II/base/config.h> #include <deal.II/base/exceptions.h> +#include <deal.II/base/table_indices.h> #include <vector> #include <cmath> @@ -348,6 +354,13 @@ public: */ static const unsigned int rank = 1; + /** + * Number of independent components of a + * tensor of rank 1. + */ + static const unsigned int + n_independent_components = dim; + /** * Type of stored objects. This * is a Number for a rank 1 tensor. @@ -427,6 +440,16 @@ public: */ Number &operator [] (const unsigned int index); + /** + * Read access using TableIndices <tt>indices</tt> + */ + Number operator [](const TableIndices<1> &indices) const; + + /** + * Read and write access using TableIndices <tt>indices</tt> + */ + Number &operator [](const TableIndices<1> &indices); + /** * Assignment operator. */ @@ -568,6 +591,31 @@ public: template <typename Number2> void unroll (Vector<Number2> &result) const; + /** + * Returns an unrolled index in + * the range [0,dim-1] for the element of the tensor indexed by + * the argument to the function. + * + * Given that this is a rank-1 object, the returned value + * is simply the value of the only index stored by the argument. + */ + static + unsigned int + component_to_unrolled_index(const TableIndices<1> &indices); + + /** + * Opposite of component_to_unrolled_index: For an index in the + * range [0,dim-1], return which set of indices it would + * correspond to. + * + * Given that this is a rank-1 object, the returned set of indices + * consists of only a single element with value equal to the argument + * to this function. + */ + static + TableIndices<1> unrolled_to_component_indices(const unsigned int i); + + /** * Determine an estimate for * the memory consumption (in @@ -949,6 +997,22 @@ Number &Tensor<1,dim,Number>::operator [] (const unsigned int index) return values[index]; } +template <int dim, typename Number> +inline +Number Tensor<1,dim,Number>::operator [] (const TableIndices<1> &indices) const +{ + Assert (indices[0]<dim, ExcIndexRange (indices[0], 0, dim)); + return values[indices[0]]; +} + +template <int dim, typename Number> +inline +Number &Tensor<1,dim,Number>::operator [] (const TableIndices<1> &indices) +{ + Assert (indices[0]<dim, ExcIndexRange (indices[0], 0, dim)); + return values[indices[0]]; +} + template <> @@ -1187,6 +1251,23 @@ Tensor<1,dim,Number>::unroll_recursion (Vector<Number2> &result, } +template <int dim, typename Number> +inline +unsigned int +Tensor<1, dim, Number>::component_to_unrolled_index (const TableIndices<1> &indices) +{ + return indices[0]; +} + +template <int dim, typename Number> +inline +TableIndices<1> +Tensor<1, dim, Number>::unrolled_to_component_indices (const unsigned int i) +{ + return TableIndices<1>(i); +} + + template <int dim, typename Number> inline diff --git a/deal.II/include/deal.II/base/tensor_function.h b/deal.II/include/deal.II/base/tensor_function.h index b8a7bd7910..aab8d60113 100644 --- a/deal.II/include/deal.II/base/tensor_function.h +++ b/deal.II/include/deal.II/base/tensor_function.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__tensor_function_h #define __deal2__tensor_function_h @@ -57,62 +62,47 @@ class TensorFunction : public FunctionTime, { public: /** - * Define typedefs for the return - * types of the <tt>value</tt> - * functions. + * Define typedefs for the return types of the <tt>value</tt> functions. */ typedef Tensor<rank,dim> value_type; typedef Tensor<rank+1,dim> gradient_type; /** - * Constructor. May take an - * initial value for the time - * variable, which defaults to - * zero. + * Constructor. May take an initial value for the time variable, which + * defaults to zero. */ TensorFunction (const double initial_time = 0.0); /** - * Virtual destructor; absolutely - * necessary in this case, as - * classes are usually not used - * by their true type, but rather - * through pointers to this base - * class. + * Virtual destructor; absolutely necessary in this case, as classes are + * usually not used by their true type, but rather through pointers to + * this base class. */ virtual ~TensorFunction (); /** - * Return the value of the function - * at the given point. + * Return the value of the function at the given point. */ virtual value_type value (const Point<dim> &p) const; /** - * Set <tt>values</tt> to the point - * values of the function at the - * <tt>points</tt>. It is assumed - * that <tt>values</tt> already has - * the right size, i.e. the same - * size as the <tt>points</tt> array. + * Set <tt>values</tt> to the point values of the function at the + * <tt>points</tt>. It is assumed that <tt>values</tt> already has the + * right size, i.e. the same size as the <tt>points</tt> array. */ virtual void value_list (const std::vector<Point<dim> > &points, std::vector<value_type> &values) const; /** - * Return the gradient of the - * function at the given point. + * Return the gradient of the function at the given point. */ virtual gradient_type gradient (const Point<dim> &p) const; /** - * Set <tt>gradients</tt> to the - * gradients of the function at - * the <tt>points</tt>. It is assumed - * that <tt>values</tt> already has - * the right size, i.e. the same - * size as the <tt>points</tt> array. + * Set <tt>gradients</tt> to the gradients of the function at the + * <tt>points</tt>. It is assumed that <tt>values</tt> already has the + * right size, i.e. the same size as the <tt>points</tt> array. */ virtual void gradient_list (const std::vector<Point<dim> > &points, std::vector<gradient_type> &gradients) const; @@ -131,6 +121,68 @@ public: }; + + +/* + * Provide a tensor valued function which always returns a constant tensor + * value. Obviously, all derivates of this function are zero. + * + * @ingroup functions + * @author Matthias Maier, 2013 + */ +template <int rank, int dim> +class ConstantTensorFunction : public TensorFunction<rank, dim> +{ +public: + /** + * Constructor; takes the constant tensor value as an argument. + * The reference value is copied internally. + * + * An initial value for the time variable may be specified, otherwise it + * defaults to zero. + */ + ConstantTensorFunction (const dealii::Tensor<rank, dim> &value, + const double initial_time = 0.0); + + virtual ~ConstantTensorFunction (); + + virtual typename dealii::TensorFunction<rank, dim>::value_type value (const Point<dim> &p) const; + + virtual void value_list (const std::vector<Point<dim> > &points, + std::vector<typename dealii::TensorFunction<rank, dim>::value_type> &values) const; + + virtual typename dealii::TensorFunction<rank, dim>::gradient_type gradient (const Point<dim> &p) const; + + virtual void gradient_list (const std::vector<Point<dim> > &points, + std::vector<typename dealii::TensorFunction<rank, dim>::gradient_type> &gradients) const; + +private: + const dealii::Tensor<rank, dim> _value; +}; + + + +/* + * Provide a tensor valued function which always returns zero. + * Obviously, all derivates of this function are zero. + * + * @ingroup functions + * @author Matthias Maier, 2013 + */ +template <int rank, int dim> +class ZeroTensorFunction : public ConstantTensorFunction<rank, dim> +{ +public: + /** + * Constructor. + * + * An initial value for the time variable may be specified, otherwise it + * defaults to zero. + */ + ZeroTensorFunction (const double initial_time = 0.0); +}; + + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/include/deal.II/base/tensor_product_polynomials.h b/deal.II/include/deal.II/base/tensor_product_polynomials.h index 3babe00729..8f74b0aa68 100644 --- a/deal.II/include/deal.II/base/tensor_product_polynomials.h +++ b/deal.II/include/deal.II/base/tensor_product_polynomials.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 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__tensor_product_polynomials_h #define __deal2__tensor_product_polynomials_h diff --git a/deal.II/include/deal.II/base/tensor_product_polynomials_const.h b/deal.II/include/deal.II/base/tensor_product_polynomials_const.h index 82fa269e5f..83c92be80f 100644 --- a/deal.II/include/deal.II/base/tensor_product_polynomials_const.h +++ b/deal.II/include/deal.II/base/tensor_product_polynomials_const.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: tensor_product_polynomials.h 27628 2012-11-20 22:49:26Z heister $ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tensor_product_polynomials_const_h #define __deal2__tensor_product_polynomials_const_h diff --git a/deal.II/include/deal.II/base/thread_local_storage.h b/deal.II/include/deal.II/base/thread_local_storage.h index a97219c44d..dccaa2f61f 100644 --- a/deal.II/include/deal.II/base/thread_local_storage.h +++ b/deal.II/include/deal.II/base/thread_local_storage.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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__thread_local_storage_h #define __deal2__thread_local_storage_h @@ -29,7 +34,6 @@ DEAL_II_NAMESPACE_OPEN namespace Threads { - template <typename T> /** * @brief A class that provides a separate storage location on each thread that accesses the object. * @@ -60,7 +64,8 @@ namespace Threads * provides a reference to a unique object when accessed from different threads. * Objects of type T are created lazily, i.e. they are only created whenever a * thread actually calls get(). - **/ + */ + template <typename T> class ThreadLocalStorage { public: diff --git a/deal.II/include/deal.II/base/thread_management.h b/deal.II/include/deal.II/base/thread_management.h index 316ba303b3..f7b97ebdf1 100644 --- a/deal.II/include/deal.II/base/thread_management.h +++ b/deal.II/include/deal.II/base/thread_management.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__thread_management_h #define __deal2__thread_management_h @@ -2712,7 +2717,7 @@ namespace Threads inline internal::fun_encapsulator<RT, std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>,6> - spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const) DEAL_II_DEPRECATED; + spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const) DEAL_II_DEPRECATED; template <typename RT, typename C, @@ -2745,13 +2750,13 @@ namespace Threads inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>,7> - spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; + spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; template <typename RT, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>,7> @@ -2776,13 +2781,13 @@ namespace Threads inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>,7> - spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; + spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; template <typename RT, typename C, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>,7> @@ -2808,13 +2813,13 @@ namespace Threads internal::fun_encapsulator<RT, std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>,7> - spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const) DEAL_II_DEPRECATED; + spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const) DEAL_II_DEPRECATED; template <typename RT, typename C, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator<RT, std_cxx1x::tuple<Arg1, Arg2, Arg3, @@ -2849,9 +2854,9 @@ namespace Threads template <typename RT, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7, typename Arg8> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, @@ -2884,9 +2889,9 @@ namespace Threads template <typename RT, typename C, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7, typename Arg8> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, @@ -2920,9 +2925,9 @@ namespace Threads template <typename RT, typename C, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7, typename Arg8> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator<RT, std_cxx1x::tuple<Arg1, Arg2, Arg3, @@ -2959,9 +2964,9 @@ namespace Threads template <typename RT, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7, typename Arg8, typename Arg9> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, @@ -2994,9 +2999,9 @@ namespace Threads template <typename RT, typename C, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7, typename Arg8, typename Arg9> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator<RT,std_cxx1x::tuple<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, @@ -3030,9 +3035,9 @@ namespace Threads template <typename RT, typename C, - typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5, typename Arg6, - typename Arg7, typename Arg8, typename Arg9> + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator<RT, std_cxx1x::tuple<Arg1, Arg2, Arg3, @@ -4059,7 +4064,18 @@ namespace Threads // call the function object // and put the return value // into the proper place - call (task_descriptor.function, task_descriptor.ret_val); + try + { + call (task_descriptor.function, task_descriptor.ret_val); + } + catch (const std::exception &exc) + { + internal::handle_std_exception (exc); + } + catch (...) + { + internal::handle_unknown_exception (); + } return 0; } @@ -4234,7 +4250,7 @@ namespace Threads // the TBB book on pages // 230/231 ("Start a large task // in parallel with the main - // program) + // program") task = new (tbb::task::allocate_root()) tbb::empty_task; task->set_ref_count (2); @@ -4349,6 +4365,7 @@ namespace Threads { call (function, ret_val); } + /** * Wait for the task to * return. Since we are in diff --git a/deal.II/include/deal.II/base/timer.h b/deal.II/include/deal.II/base/timer.h index bb031c3ce5..961ed9456e 100644 --- a/deal.II/include/deal.II/base/timer.h +++ b/deal.II/include/deal.II/base/timer.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__timer_h #define __deal2__timer_h @@ -348,7 +353,7 @@ public: /** * Reference to the TimerOutput object */ - dealii::TimerOutput & timer; + dealii::TimerOutput &timer; /** * Do we still need to exit the section we are in? */ @@ -622,8 +627,8 @@ TimerOutput::exit_section (const std::string &section_name) inline TimerOutput::Scope::Scope(dealii::TimerOutput &timer_, const std::string &section_name) -: -timer(timer_), in(true) + : + timer(timer_), in(true) { timer.enter_section(section_name); } diff --git a/deal.II/include/deal.II/base/types.h b/deal.II/include/deal.II/base/types.h index ec54568f5e..0da2ba52e6 100644 --- a/deal.II/include/deal.II/base/types.h +++ b/deal.II/include/deal.II/base/types.h @@ -1,20 +1,25 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__types_h #define __deal2__types_h #include <deal.II/base/config.h> - +#include <cstddef> DEAL_II_NAMESPACE_OPEN /** @@ -52,14 +57,55 @@ namespace types */ const unsigned int artificial_subdomain_id DEAL_II_DEPRECATED = static_cast<subdomain_id>(-2); +#ifdef DEAL_II_USE_LARGE_INDEX_TYPE + /** + * The type used for global indices of + * degrees of freedom. While in sequential + * computations the 4 billion indices of + * 32-bit unsigned integers is plenty, + * parallel computations using the + * parallel::distributed::Triangulation + * class can overflow this number and we + * need a bigger index space. + * + * The data type always indicates an + * unsigned integer type. + */ + // TODO: we should check that unsigned long long int + // has the same size as uint64_t + typedef unsigned long long int global_dof_index; + /** - * The type used to denote global dof - * indices. + * An identifier that denotes the MPI type + * associated with types::global_dof_index. + */ +# define DEAL_II_DOF_INDEX_MPI_TYPE MPI_UNSIGNED_LONG_LONG +#else + /** + * The type used for global indices of + * degrees of freedom. While in sequential + * computations the 4 billion indices of + * 32-bit unsigned integers is plenty, + * parallel computations using the + * parallel::distributed::Triangulation + * class can overflow this number and we + * need a bigger index space. + * + * The data type always indicates an + * unsigned integer type. */ typedef unsigned int global_dof_index; /** - * @deprecated Use numbers::invalid_dof_index + * An identifier that denotes the MPI type + * associated with types::global_dof_index. + */ +# define DEAL_II_DOF_INDEX_MPI_TYPE MPI_UNSIGNED +#endif + + + /** + * @deprecated Use numbers::invalid_dof_index */ const global_dof_index invalid_dof_index DEAL_II_DEPRECATED = static_cast<global_dof_index>(-1); @@ -111,6 +157,25 @@ namespace types } +namespace TrilinosWrappers +{ + namespace types + { +#ifdef DEAL_II_USE_LARGE_INDEX_TYPE + /** + * Declare type of integer used in the Epetra package of Trilinos. + */ + typedef long long int_type; +#else + /** + * Declare type of integer used in the Epetra package of Trilinos. + */ + typedef int int_type; +#endif + } +} + + // this part of the namespace numbers got moved to the bottom types.h file, // because otherwise we get a circular inclusion of config.h, types.h, and // numbers.h @@ -135,9 +200,29 @@ namespace numbers invalid_unsigned_int = static_cast<unsigned int> (-1); /** - * An invalid value for indices of degrees - * of freedom. - */ + * Representation of the + * largest number that + * can be put into a + * size_type. This value + * is used throughout + * the library as a + * marker for an + * invalid size_type + * value, such as + * an invalid array + * index, an invalid + * array size, and the + * like. Invalid_size_type + * is equivalent to + * invalid_dof_index. + */ + const types::global_dof_index + invalid_size_type = static_cast<types::global_dof_index> (-1); + + /** + * An invalid value for indices of degrees + * of freedom. + */ const types::global_dof_index invalid_dof_index = static_cast<types::global_dof_index>(-1); /** @@ -226,7 +311,6 @@ namespace numbers * more information. */ const types::subdomain_id artificial_subdomain_id = static_cast<types::subdomain_id>(-2); - } diff --git a/deal.II/include/deal.II/base/utilities.h b/deal.II/include/deal.II/base/utilities.h index a7a3591bec..df17f8f976 100644 --- a/deal.II/include/deal.II/base/utilities.h +++ b/deal.II/include/deal.II/base/utilities.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__utilities_h #define __deal2__utilities_h @@ -324,6 +329,27 @@ namespace Utilities std::vector<unsigned int> invert_permutation (const std::vector<unsigned int> &permutation); + /** + * Given a permutation vector (i.e. a + * vector $p_0\ldots p_{N-1}$ where each + * $p_i\in [0,N)$ and $p_i\neq p_j$ for + * $i\neq j$), produce the reverse + * permutation $q_i=N-1-p_i$. + */ + std::vector<unsigned long long int> + reverse_permutation (const std::vector<unsigned long long int> &permutation); + + /** + * Given a permutation vector (i.e. a + * vector $p_0\ldots p_{N-1}$ where each + * $p_i\in [0,N)$ and $p_i\neq p_j$ for + * $i\neq j$), produce the inverse + * permutation $q_0\ldots q_{N-1}$ so that + * $q_{p_i}=p_{q_i}=i$. + */ + std::vector<unsigned long long int> + invert_permutation (const std::vector<unsigned long long int> &permutation); + /** * A namespace for utility functions that * probe system properties. @@ -666,6 +692,7 @@ namespace Utilities #endif + } @@ -725,7 +752,7 @@ namespace Utilities Assert (last - first >= 0, ExcMessage ("The given iterators do not satisfy the proper ordering.")); - unsigned int len = last-first; + unsigned int len = static_cast<unsigned int>(last-first); if (len==0) return first; diff --git a/deal.II/include/deal.II/base/vector_slice.h b/deal.II/include/deal.II/base/vector_slice.h index af436af31a..25d802aef7 100644 --- a/deal.II/include/deal.II/base/vector_slice.h +++ b/deal.II/include/deal.II/base/vector_slice.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__vector_slice_h #define __deal2__vector_slice_h diff --git a/deal.II/include/deal.II/base/vectorization.h b/deal.II/include/deal.II/base/vectorization.h index c01ad12dba..f2c560f36c 100644 --- a/deal.II/include/deal.II/base/vectorization.h +++ b/deal.II/include/deal.II/base/vectorization.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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__vectorization_h #define __deal2__vectorization_h diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index b44ed33f2c..d4c9f9f619 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -1,23 +1,30 @@ -//--------------------------------------------------------------------------- -// $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__work_stream_h #define __deal2__work_stream_h #include <deal.II/base/config.h> #include <deal.II/base/multithread_info.h> +#include <deal.II/base/thread_management.h> #include <deal.II/base/template_constraints.h> #include <deal.II/base/std_cxx1x/function.h> #include <deal.II/base/std_cxx1x/bind.h> +#include <deal.II/base/thread_local_storage.h> #ifdef DEAL_II_WITH_THREADS # include <deal.II/base/thread_management.h> @@ -26,6 +33,7 @@ #include <vector> #include <utility> +#include <memory> DEAL_II_NAMESPACE_OPEN @@ -49,7 +57,7 @@ DEAL_II_NAMESPACE_OPEN * shared memory. However, some other part of this work may need to be * synchronised and be done in order. In the example of assembling a matrix, * the computation of local contributions can be done entirely in parallel, - * but copying the the local contributions into the global matrix requires + * but copying the local contributions into the global matrix requires * some care: First, several threads can't write at the same time, but need to * synchronise writing using a mutex; secondly, we want the order in which * local contributions are added to the global matrix to be always the same @@ -127,9 +135,14 @@ namespace WorkStream #ifdef DEAL_II_WITH_THREADS - namespace internal { + +//TODO: The following classes all use std_cxx1x::shared_ptr, but the +// correct pointer class would actually be std::unique_ptr. make this +// replacement whenever we have a class that provides these semantics +// and that is available also as a fall-back whenever via boost or similar + /** * A class that creates a sequence of * items from a range of iterators. @@ -142,23 +155,117 @@ namespace WorkStream public: /** * A data type that we use to identify - * items to be worked on. - * - * The first element indicates an array - * of iterators to work on; the second - * the scratch space; the third an - * array of copy data spaces; and the - * last the number of elements to work - * on. This last argument is an integer - * between one and chunk_size. The - * arrays have a length of chunk_size. + * items to be worked on. This is the structure + * that is passed around between the different parts of + * the WorkStream implementation to identify what needs + * to be done by the various stages of the pipeline. */ - typedef - std_cxx1x::tuple<std::vector<Iterator>, - ScratchData *, - std::vector<CopyData>, - unsigned int> - ItemType; + struct ItemType + { + /** + * A structure that contains a pointer to a scratch data object along + * with a flag that indicates whether this object is currently in use. + */ + struct ScratchDataObject + { + std_cxx1x::shared_ptr<ScratchData> scratch_data; + bool currently_in_use; + + /** + * Default constructor. + */ + ScratchDataObject () + : + currently_in_use (false) + {} + + ScratchDataObject (ScratchData *p, + const bool in_use) + : + scratch_data (p), + currently_in_use (in_use) + {} + }; + + + /** + * Typedef to a list of scratch data objects. The rationale for this + * list is provided in the variables that use these lists. + */ + typedef std::list<ScratchDataObject> ScratchDataList; + + /** + * A list of iterators that need to be worked on. Only the first + * n_items are relevant. + */ + std::vector<Iterator> work_items; + + /** + * The CopyData objects that the Worker part of the pipeline + * fills for each work item. Again, only the first n_items + * elements are what we care about. + */ + std::vector<CopyData> copy_datas; + + /** + * Number of items identified by the work_items array that the + * Worker and Copier pipeline stage need to work on. The maximum + * value of this variable will be chunk_size. + */ + unsigned int n_items; + + /** + * Pointer to a thread local variable identifying the scratch data objects + * this thread will use. The initial implementation of this + * class using thread local variables provided only a single + * scratch object per thread. This doesn't work, because + * the worker functions may start tasks itself and then call + * Threads::TaskGroup::join_all() or a similar function, which the + * TBB scheduler may use to run something else on the current + * thread -- for example another instance of the worker function. + * Consequently, there would be two instances of the worker + * function that use the same scratch object if we only + * provided a single scratch object per thread. The solution is + * to provide a list of scratch objects for each thread, together + * with a flag indicating whether this scratch object is currently + * used. If a thread needs a scratch object, it walks this list + * until it finds an unused object, or, if there is none, creates one + * itself. Note that we need not use synchronization primitives + * for this process since the lists are thread-local and + * we are guaranteed that only a single thread accesses them as long + * as we have no yield point in between the accesses to the list. + * + * The pointers to scratch objects stored in each of these lists must + * be so that they are deleted on all threads when the thread + * local object is destroyed. This is achieved by using shared_ptr. + * + * Note that when a worker needs to create a scratch object, it allocates + * it using sample_scratch_data to copy from. This has + * the advantage of a first-touch initialization, i.e., the + * memory for the scratch data object is allocated and initialized + * by the same thread that will later use it. + */ + Threads::ThreadLocalStorage<ScratchDataList> *scratch_data; + + /** + * Pointer to a sample scratch data object, to be used to initialize + * the scratch data objects created for each individual thread. + */ + const ScratchData *sample_scratch_data; + + + /** + * Default constructor. + * Initialize everything that doesn't + * have a default constructor itself. + */ + ItemType () + : + n_items (0), + scratch_data (0), + sample_scratch_data (0) + {} + }; /** @@ -179,32 +286,23 @@ namespace WorkStream tbb::filter (/*is_serial=*/true), remaining_iterator_range (begin, end), ring_buffer (buffer_size), + sample_scratch_data (sample_scratch_data), n_emitted_items (0), chunk_size (chunk_size) { - // initialize copies of - // additional_data. since - // this is frequently - // expensive (creating - // FEValues objects etc) do - // that in parallel - Threads::TaskGroup<> tasks; - for (unsigned int i=0; i<ring_buffer.size(); ++i) - tasks += Threads::new_task (&IteratorRangeToItemStream::init_buffer_elements, - *this, - i, - std_cxx1x::cref(sample_scratch_data), - std_cxx1x::cref(sample_copy_data)); - tasks.join_all (); - } - - /** - * Destructor. - */ - ~IteratorRangeToItemStream () - { - for (unsigned int i=0; i<ring_buffer.size(); ++i) - delete std_cxx1x::get<1>(ring_buffer[i]); + // initialize the elements of the ring buffer + for (unsigned int element=0; element<ring_buffer.size(); ++element) + { + Assert (ring_buffer[element].n_items == 0, + ExcInternalError()); + + ring_buffer[element].work_items.resize (chunk_size, + remaining_iterator_range.second); + ring_buffer[element].scratch_data = &thread_local_scratch; + ring_buffer[element].sample_scratch_data = &sample_scratch_data; + ring_buffer[element].copy_datas.resize (chunk_size, + sample_copy_data); + } } /** @@ -221,20 +319,20 @@ namespace WorkStream // initialize the next item. it may // consist of at most chunk_size // elements - std_cxx1x::get<3>(*current_item) = 0; + current_item->n_items = 0; while ((remaining_iterator_range.first != remaining_iterator_range.second) && - (std_cxx1x::get<3>(*current_item) < chunk_size)) + (current_item->n_items < chunk_size)) { - std_cxx1x::get<0>(*current_item)[std_cxx1x::get<3>(*current_item)] + current_item->work_items[current_item->n_items] = remaining_iterator_range.first; ++remaining_iterator_range.first; - ++std_cxx1x::get<3>(*current_item); + ++current_item->n_items; } - if (std_cxx1x::get<3>(*current_item) == 0) + if (current_item->n_items == 0) // there were no items // left. terminate the pipeline return 0; @@ -258,12 +356,52 @@ namespace WorkStream */ std::vector<ItemType> ring_buffer; + /** + * Pointer to a thread local variable identifying the scratch data objects + * this thread will use. The initial implementation of this + * class using thread local variables provided only a single + * scratch object per thread. This doesn't work, because + * the worker functions may start tasks itself and then call + * Threads::TaskGroup::join_all() or a similar function, which the + * TBB scheduler may use to run something else on the current + * thread -- for example another instance of the worker function. + * Consequently, there would be two instances of the worker + * function that use the same scratch object if we only + * provided a single scratch object per thread. The solution is + * to provide a list of scratch objects for each thread, together + * with a flag indicating whether this scratch object is currently + * used. If a thread needs a scratch object, it walks this list + * until it finds an unused object, or, if there is none, creates one + * itself. Note that we need not use synchronization primitives + * for this process since the lists are thread-local and + * we are guaranteed that only a single thread accesses them as long + * as we have no yield point in between the accesses to the list. + * + * The pointers to scratch objects stored in each of these lists must + * be so that they are deleted on all threads when the thread + * local object is destroyed. This is achieved by using shared_ptr. + * + * Note that when a worker needs to create a scratch object, it allocates + * it using sample_scratch_data to copy from. This has + * the advantage of a first-touch initialization, i.e., the + * memory for the scratch data object is allocated and initialized + * by the same thread that will later use it. + */ + Threads::ThreadLocalStorage<typename ItemType::ScratchDataList> thread_local_scratch; + + /** + * A reference to a sample scratch data that will be used to + * initialize the thread-local pointers to a scratch data object + * each of the worker tasks uses. + */ + const ScratchData &sample_scratch_data; + /** * Counter for the number of emitted * items. Each item may consist of up * to chunk_size iterator elements. */ - unsigned int n_emitted_items; + unsigned int n_emitted_items; /** * Number of elements of the @@ -285,17 +423,18 @@ namespace WorkStream * the ring buffer. */ void init_buffer_elements (const unsigned int element, - const ScratchData &sample_scratch_data, const CopyData &sample_copy_data) { - Assert (std_cxx1x::get<1>(ring_buffer[element]) == 0, + Assert (ring_buffer[element].n_items == 0, ExcInternalError()); - std_cxx1x::get<0>(ring_buffer[element]) + ring_buffer[element].work_items .resize (chunk_size, remaining_iterator_range.second); - std_cxx1x::get<1>(ring_buffer[element]) - = new ScratchData(sample_scratch_data); - std_cxx1x::get<2>(ring_buffer[element]) + ring_buffer[element].scratch_data + = &thread_local_scratch; + ring_buffer[element].sample_scratch_data + = &sample_scratch_data; + ring_buffer[element].copy_datas .resize (chunk_size, sample_copy_data); } }; @@ -344,13 +483,85 @@ namespace WorkStream ItemType *current_item = static_cast<ItemType *> (item); - // then call the worker function on - // each element of the chunk we - // were given - for (unsigned int i=0; i<std_cxx1x::get<3>(*current_item); ++i) - worker (std_cxx1x::get<0>(*current_item)[i], - *std_cxx1x::get<1>(*current_item), - std_cxx1x::get<2>(*current_item)[i]); + // we need to find an unused scratch data object in the list that + // corresponds to the current thread and then mark it as used. if + // we can't find one, create one + // + // as discussed in the discussion of the documentation of the + // IteratorRangeToItemStream::scratch_data variable, there is no + // need to synchronize access to this variable using a mutex + // as long as we have no yield-point in between. this means that + // we can't take an iterator into the list now and expect it to + // still be valid after calling the worker, but we at least do + // not have to lock the following section + ScratchData *scratch_data = 0; + { + typename ItemType::ScratchDataList & + scratch_data_list = current_item->scratch_data->get(); + + // see if there is an unused object. if so, grab it and mark + // it as used + for (typename ItemType::ScratchDataList::iterator + p = scratch_data_list.begin(); + p != scratch_data_list.end(); ++p) + if (p->currently_in_use == false) + { + scratch_data = p->scratch_data.get(); + p->currently_in_use = true; + break; + } + + // if no object was found, create one and mark it as used + if (scratch_data == 0) + { + scratch_data = new ScratchData(*current_item->sample_scratch_data); + + typename ItemType::ScratchDataList::value_type + new_scratch_object (scratch_data, true); + scratch_data_list.push_back (new_scratch_object); + } + } + + // then call the worker function on each element of the chunk we were + // given. since these worker functions are called on separate threads, + // nothing good can happen if they throw an exception and we are best + // off catching it and showing an error message + for (unsigned int i=0; i<current_item->n_items; ++i) + { + try + { + worker (current_item->work_items[i], + *scratch_data, + current_item->copy_datas[i]); + } + catch (const std::exception &exc) + { + Threads::internal::handle_std_exception (exc); + } + catch (...) + { + Threads::internal::handle_unknown_exception (); + } + } + + // finally mark the scratch object as unused again. as above, there + // is no need to lock anything here since the object we work on + // is thread-local + { + typename ItemType::ScratchDataList & + scratch_data_list = current_item->scratch_data->get(); + + for (typename ItemType::ScratchDataList::iterator p = + scratch_data_list.begin(); p != scratch_data_list.end(); + ++p) + if (p->scratch_data.get() == scratch_data) + { + Assert(p->currently_in_use == true, ExcInternalError()); + p->currently_in_use = false; + } + } + + // then return the original pointer // to the now modified object @@ -415,9 +626,25 @@ namespace WorkStream ItemType *current_item = static_cast<ItemType *> (item); - // initiate copying data - for (unsigned int i=0; i<std_cxx1x::get<3>(*current_item); ++i) - copier (std_cxx1x::get<2>(*current_item)[i]); + // initiate copying data. for the same reasons as in the worker class + // above, catch exceptions rather than letting it propagate into + // unknown territories + for (unsigned int i=0; i<current_item->n_items; ++i) + { + try + { + copier (current_item->copy_datas[i]); + } + catch (const std::exception &exc) + { + Threads::internal::handle_std_exception (exc); + } + catch (...) + { + Threads::internal::handle_unknown_exception (); + } + } + // return an invalid // item since we are at diff --git a/deal.II/include/deal.II/distributed/grid_refinement.h b/deal.II/include/deal.II/distributed/grid_refinement.h index 07d6c9aa2a..a660fe1414 100644 --- a/deal.II/include/deal.II/distributed/grid_refinement.h +++ b/deal.II/include/deal.II/distributed/grid_refinement.h @@ -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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__distribute_grid_refinement_h #define __deal2__distribute_grid_refinement_h diff --git a/deal.II/include/deal.II/distributed/solution_transfer.h b/deal.II/include/deal.II/distributed/solution_transfer.h index 55b0c930f7..8b1fa0019b 100644 --- a/deal.II/include/deal.II/distributed/solution_transfer.h +++ b/deal.II/include/deal.II/distributed/solution_transfer.h @@ -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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__distributed_solution_transfer_h #define __deal2__distributed_solution_transfer_h diff --git a/deal.II/include/deal.II/distributed/tria.h b/deal.II/include/deal.II/distributed/tria.h index b504986449..d17c8c082d 100644 --- a/deal.II/include/deal.II/distributed/tria.h +++ b/deal.II/include/deal.II/distributed/tria.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__distributed_tria_h #define __deal2__distributed_tria_h @@ -538,7 +543,7 @@ namespace parallel * of active cells in the * distributed triangulation. */ - unsigned int n_global_active_cells () const; + types::global_dof_index n_global_active_cells () const; /** * Returns the global maximum level. This may be bigger than n_levels. @@ -689,7 +694,7 @@ namespace parallel * in hierarchical ordering is the ith deal cell starting * from begin(0). */ - const std::vector<unsigned int> & + const std::vector<types::global_dof_index> & get_p4est_tree_to_coarse_cell_permutation() const; private: @@ -730,8 +735,10 @@ namespace parallel struct NumberCache { std::vector<unsigned int> n_locally_owned_active_cells; - unsigned int n_global_active_cells; + types::global_dof_index n_global_active_cells; unsigned int n_global_levels; + + NumberCache(); }; NumberCache number_cache; @@ -832,8 +839,8 @@ namespace parallel * by p4est is located on geometrically * close coarse grid cells. */ - std::vector<unsigned int> coarse_cell_to_p4est_tree_permutation; - std::vector<unsigned int> p4est_tree_to_coarse_cell_permutation; + std::vector<types::global_dof_index> coarse_cell_to_p4est_tree_permutation; + std::vector<types::global_dof_index> p4est_tree_to_coarse_cell_permutation; /** * Return a pointer to the p4est @@ -929,7 +936,7 @@ namespace parallel * of active cells in the * distributed triangulation. */ - unsigned int n_global_active_cells () const; + types::global_dof_index n_global_active_cells () const; virtual unsigned int n_global_levels () const; /** @@ -963,8 +970,8 @@ namespace parallel * these variables at a * couple places anyway. */ - std::vector<unsigned int> coarse_cell_to_p4est_tree_permutation; - std::vector<unsigned int> p4est_tree_to_coarse_cell_permutation; + std::vector<types::global_dof_index> coarse_cell_to_p4est_tree_permutation; + std::vector<types::global_dof_index> p4est_tree_to_coarse_cell_permutation; /** * dummy settings @@ -975,6 +982,9 @@ namespace parallel mesh_reconstruction_after_repartitioning = 0x1, construct_multigrid_hierarchy = 0x2 }; + + +//TODO: The following variable should really be private, but it is used in dof_handler_policy.cc ... /** * dummy settings object */ diff --git a/deal.II/include/deal.II/dofs/block_info.h b/deal.II/include/deal.II/dofs/block_info.h index 835d5270e5..620a59d6a3 100644 --- a/deal.II/include/deal.II/dofs/block_info.h +++ b/deal.II/include/deal.II/dofs/block_info.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__block_info_h #define __deal2__block_info_h @@ -158,7 +163,7 @@ public: * in the standard local * numbering of DoFAccessor. */ - unsigned int renumber (const unsigned int i) const; + types::global_dof_index renumber (const unsigned int i) const; /** * The number of base elements. @@ -226,7 +231,7 @@ private: * ordering. Filled by * initialize(). */ - std::vector<unsigned int> local_renumbering; + std::vector<types::global_dof_index> local_renumbering; }; @@ -259,9 +264,9 @@ BlockInfo::level (const unsigned int l) const inline -unsigned int BlockInfo::renumber (const unsigned int i) const +types::global_dof_index BlockInfo::renumber (const unsigned int i) const { - AssertIndexRange(i, local_renumbering.size()); + AssertIndexRange(i, static_cast<unsigned int>(local_renumbering.size())); return local_renumbering[i]; } diff --git a/deal.II/include/deal.II/dofs/dof_accessor.h b/deal.II/include/deal.II/dofs/dof_accessor.h index fd605cb43c..d91ecaab76 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.h +++ b/deal.II/include/deal.II/dofs/dof_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__dof_accessor_h #define __deal2__dof_accessor_h @@ -368,25 +373,18 @@ public: */ /** - * Return the indices of the dofs of this object in the standard - * ordering: dofs on vertex 0, dofs on vertex 1, etc, dofs on line - * 0, dofs on line 1, etc, dofs on quad 0, etc. + * Return the <i>global</i> indices of the degrees of freedom located on + * this object in the standard ordering defined by the finite element (i.e., + * dofs on vertex 0, dofs on vertex 1, etc, dofs on line 0, dofs on line 1, + * etc, dofs on quad 0, etc.) This function is only available on + * <i>active</i> objects (see @ref GlossActive "this glossary entry"). + * + * The cells needs to be an active cell (and not artificial in a + * parallel distributed computation). * * The vector has to have the right size before being passed to this * function. * - * @note The behavior descibed below for non-active cells will - * be removed in a future release. It is not very intuitive and its - * use is limited to FE_Q elements of degree 1. - * - * This function is most often used on active objects (edges, faces, - * cells). It can be used on non-active objects as well - * (i.e. objects that have children), but only if the finite element - * under consideration has degrees of freedom exclusively on - * vertices. Otherwise, the function doesn't make much sense, since - * for example inactive edges do not have degrees of freedom - * associated with them at all. - * * The last argument denotes the finite element index. For the * standard ::DoFHandler class, this value must be equal to its * default value since that class only supports the same finite @@ -411,27 +409,25 @@ public: * <code>cell-@>active_fe_index</code> as last argument. * */ - void get_dof_indices (std::vector<unsigned int> &dof_indices, + void get_dof_indices (std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index = DH::default_fe_index) const; /** - * Return the indices of the dofs of this - * object in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, ... - * dofs on line 0, dofs on line 1, ..., - * then quads, then hexes. - * - * It is assumed that the vector already - * has the right size beforehand. The - * indices refer to the local numbering - * for the level this line lives on. + * Return the global multilevel indices of the degrees of freedom that live + * on the current object with respect to the given level within the + * multigrid hierarchy. The indices refer to the local numbering for the + * level this line lives on. */ - void get_mg_dof_indices (const int level, std::vector<unsigned int> &dof_indices, const unsigned int fe_index = DH::default_fe_index) const; + void get_mg_dof_indices (const int level, + std::vector<types::global_dof_index> &dof_indices, + const unsigned int fe_index = DH::default_fe_index) const; /** * Sets the level DoF indices that are returned by get_mg_dof_indices. */ - void set_mg_dof_indices (const int level, const std::vector<unsigned int> &dof_indices, const unsigned int fe_index = DH::default_fe_index); + void set_mg_dof_indices (const int level, + const std::vector<types::global_dof_index> &dof_indices, + const unsigned int fe_index = DH::default_fe_index); /** * Global DoF index of the <i>i</i> @@ -469,19 +465,19 @@ public: * match the result of * active_fe_index(). */ - unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; + types::global_dof_index vertex_dof_index (const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** - * Returns the Global DoF index of the <code>i</code>th degree of + * Returns the global DoF index of the <code>i</code>th degree of * freedom associated with the <code>vertex</code>th vertex on * level @p level. Also see vertex_dof_index(). */ - unsigned int mg_vertex_dof_index (const int level, - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; + types::global_dof_index mg_vertex_dof_index (const int level, + const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** * Index of the <i>i</i>th degree @@ -537,13 +533,13 @@ public: * degrees are defined in the interior of * the face. */ - unsigned int dof_index (const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; + types::global_dof_index dof_index (const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** * Returns the dof_index on the given level. Also see dof_index. */ - unsigned int mg_dof_index (const int level, const unsigned int i) const; + types::global_dof_index mg_dof_index (const int level, const unsigned int i) const; /** * @} @@ -754,10 +750,10 @@ protected: * active_fe_index(). */ void set_dof_index (const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index = DH::default_fe_index) const; - void set_mg_dof_index (const int level, const unsigned int i, const unsigned int index) const; + void set_mg_dof_index (const int level, const unsigned int i, const types::global_dof_index index) const; /** * Set the global index of the <i>i</i> @@ -797,10 +793,10 @@ protected: */ void set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index = DH::default_fe_index) const; - void set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int index, const unsigned int fe_index = DH::default_fe_index) const; + void set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const types::global_dof_index index, const unsigned int fe_index = DH::default_fe_index) const; /** * Iterator classes need to be friends @@ -1079,32 +1075,19 @@ public: */ /** - * Return the indices of the dofs of this - * object in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. + * Return the <i>global</i> indices of the degrees of freedom located on + * this object in the standard ordering defined by the finite element (i.e., + * dofs on vertex 0, dofs on vertex 1, etc, dofs on line 0, dofs on line 1, + * etc, dofs on quad 0, etc.) This function is only available on + * <i>active</i> objects (see @ref GlossActive "this glossary entry"). + * + * The cells needs to be an active cell (and not artificial in a + * parallel distributed computation). * * The vector has to have the * right size before being passed * to this function. * - * This function is most often - * used on active objects (edges, - * faces, cells). It can be used - * on non-active objects as well - * (i.e. objects that have - * children), but only if the - * finite element under - * consideration has degrees of - * freedom exclusively on - * vertices. Otherwise, the - * function doesn't make much - * sense, since for example - * inactive edges do not have - * degrees of freedom associated - * with them at all. - * * The last argument denotes the * finite element index. For the * standard ::DoFHandler class, @@ -1149,7 +1132,7 @@ public: * <code>cell-@>active_fe_index</code> * as last argument. */ - void get_dof_indices (std::vector<unsigned int> &dof_indices, + void get_dof_indices (std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -1188,9 +1171,9 @@ public: * match the result of * active_fe_index(). */ - unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = AccessorData::default_fe_index) const; + types::global_dof_index vertex_dof_index (const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * Index of the <i>i</i>th degree @@ -1246,8 +1229,8 @@ public: * degrees are defined in the interior of * the face. */ - unsigned int dof_index (const unsigned int i, - const unsigned int fe_index = AccessorData::default_fe_index) const; + types::global_dof_index dof_index (const unsigned int i, + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * @} @@ -1436,7 +1419,7 @@ protected: * active_fe_index(). */ void set_dof_index (const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -1477,7 +1460,7 @@ protected: */ void set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index = AccessorData::default_fe_index) const; /** @@ -2076,51 +2059,50 @@ public: * * Examples for this use are in the implementation of DoFRenumbering. */ - void get_active_or_mg_dof_indices (std::vector<unsigned int> &dof_indices) const; + void get_active_or_mg_dof_indices (std::vector<types::global_dof_index> &dof_indices) const; /** - * Return the indices of the dofs of this - * quad in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. + * Return the <i>global</i> indices of the degrees of freedom located on + * this object in the standard ordering defined by the finite element (i.e., + * dofs on vertex 0, dofs on vertex 1, etc, dofs on line 0, dofs on line 1, + * etc, dofs on quad 0, etc.) This function is only available on + * <i>active</i> objects (see @ref GlossActive "this glossary entry"). + * + * @param[out] dof_indices The vector into which the indices will be + * written. It has to have the right size (namely, + * <code>fe.dofs_per_cell</code>, <code>fe.dofs_per_face</code>, + * or <code>fe.dofs_per_line</code>, depending on which kind of + * object this function is called) before being passed to this + * function. * - * It is assumed that the vector already - * has the right size beforehand. - * - * This function reimplements the - * same function in the base - * class. The functions in the - * base classes are available for - * all geometric objects, - * i.e. even in 3d they can be - * used to access the dof indices - * of edges, for example. On the - * other hand, the most common - * case is clearly the use on - * cells, which is why we cache - * the array for each cell, but - * not edge. To retrieve the - * cached values, rather than - * collect the necessary - * information every time, this - * function overwrites the one in - * the base class. - * - * This is a function which requires that the cell be active. + * This function reimplements the same function in the base class. + * In contrast to the function in the base class, we do not need the + * <code>fe_index</code> here because there is always a unique finite + * element index on cells. + * + * This is a function which requires that the cell is active. * * Also see get_active_or_mg_dof_indices(). * + * @note In many places in the tutorial and elsewhere in the library, + * the argument to this function is called <code>local_dof_indices</code> + * by convention. The name is not meant to indicate the <i>local</i> + * numbers of degrees of freedom (which are always between zero and + * <code>fe.dofs_per_cell</code>) but instead that the returned values + * are the <i>global</i> indices of those degrees of freedom that + * are located locally on the current cell. + * * @deprecated Currently, this function can also be called for non-active cells, if all degrees of freedom of the FiniteElement are located in vertices. This functionality will vanish in a future release. */ - void get_dof_indices (std::vector<unsigned int> &dof_indices) const; + void get_dof_indices (std::vector<types::global_dof_index> &dof_indices) const; /** * @deprecated Use get_active_or_mg_dof_indices() with level_cell_iterator returned from begin_mg(). * - * Retrieve the global indices of the degrees of freedom on this cell in the level vector associated to the level of the cell. + * Retrieve the global indices of the degrees of freedom on this cell in the + * level vector associated to the level of the cell. */ - void get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const; + void get_mg_dof_indices (std::vector<types::global_dof_index> &dof_indices) const; /** * @} @@ -2170,13 +2152,13 @@ public: * cache, if one exists for the * given DoF handler class. */ - void set_dof_indices (const std::vector<unsigned int> &dof_indices); + void set_dof_indices (const std::vector<types::global_dof_index> &dof_indices); /** * Set the Level DoF indices of this * cell to the given values. */ - void set_mg_dof_indices (const std::vector<unsigned int> &dof_indices); + void set_mg_dof_indices (const std::vector<types::global_dof_index> &dof_indices); /** * Update the cache in which we diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index 3ec680e342..8006dba0d0 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -1,19 +1,25 @@ -//--------------------------------------------------------------------------- -// $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__dof_accessor_templates_h #define __deal2__dof_accessor_templates_h #include <deal.II/base/config.h> +#include <deal.II/base/types.h> #include <deal.II/lac/constraint_matrix.h> #include <deal.II/dofs/dof_accessor.h> #include <deal.II/dofs/dof_levels.h> @@ -24,6 +30,7 @@ #include <deal.II/grid/tria_iterator.templates.h> #include <vector> +#include <limits> DEAL_II_NAMESPACE_OPEN @@ -219,7 +226,7 @@ namespace internal */ template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -244,7 +251,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<1>, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->dof_object. set_dof_index (dof_handler, @@ -257,7 +264,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -284,7 +291,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<1>, - const unsigned int global_index) + const types::global_dof_index global_index) { // faces have no levels Assert (obj_level == 0, ExcInternalError()); @@ -299,7 +306,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -324,7 +331,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<2>, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->dof_object. set_dof_index (dof_handler, @@ -337,7 +344,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -364,7 +371,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<1>, - const unsigned int global_index) + const types::global_dof_index global_index) { // faces have no levels Assert (obj_level == 0, ExcInternalError()); @@ -380,7 +387,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -407,7 +414,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<2>, - const unsigned int global_index) + const types::global_dof_index global_index) { // faces have no levels Assert (obj_level == 0, ExcInternalError()); @@ -423,7 +430,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -448,7 +455,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, dealii::internal::int2type<3>, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->dof_object. set_dof_index (dof_handler, @@ -461,7 +468,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -487,7 +494,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<1> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->dof_object. set_dof_index (dof_handler, @@ -501,7 +508,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -527,7 +534,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<1> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.faces->lines. set_dof_index (dof_handler, @@ -541,7 +548,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -567,7 +574,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<2> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->dof_object. set_dof_index (dof_handler, @@ -581,7 +588,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -607,7 +614,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<1> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.faces->lines. set_dof_index (dof_handler, @@ -621,7 +628,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -647,7 +654,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<2> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.faces->quads. set_dof_index (dof_handler, @@ -661,7 +668,7 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -687,7 +694,7 @@ namespace internal const unsigned int fe_index, const unsigned int local_index, const dealii::internal::int2type<3> &, - const unsigned int global_index) + const types::global_dof_index global_index) { dof_handler.levels[obj_level]->dof_object. set_dof_index (dof_handler, @@ -1103,7 +1110,7 @@ namespace internal const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index) + const types::global_dof_index global_index) { Assert ((fe_index == dealii::DoFHandler<dim,spacedim>::default_fe_index), ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); @@ -1128,7 +1135,7 @@ namespace internal const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index) + const types::global_dof_index global_index) { Assert ( (fe_index != dealii::hp::DoFHandler<dim,spacedim>::default_fe_index), ExcMessage ("You need to specify a FE index when working " @@ -1142,7 +1149,7 @@ namespace internal Assert (fe_index < dof_handler.finite_elements->size(), ExcInternalError()); Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, + numbers::invalid_dof_index, ExcMessage ("This vertex is unused and has no DoFs associated with it")); // hop along the list of index @@ -1152,15 +1159,17 @@ namespace internal // part. trigger an exception if // we can't find a set for this // particular fe_index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + // a fe index is always small + Assert((*pointer)<std::numeric_limits<unsigned int>::max(), ExcInternalError()); + const types::global_dof_index this_fe_index = *pointer; - Assert (this_fe_index != numbers::invalid_unsigned_int, + Assert (this_fe_index != numbers::invalid_dof_index, ExcInternalError()); Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1171,7 +1180,8 @@ namespace internal return; } else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + pointer += static_cast<types::global_dof_index>( + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); } } @@ -1189,7 +1199,7 @@ namespace internal template <int dim, int spacedim> static - unsigned int + types::global_dof_index get_vertex_dof_index (const dealii::DoFHandler<dim,spacedim> &dof_handler, const unsigned int vertex_index, const unsigned int fe_index, @@ -1213,7 +1223,7 @@ namespace internal template<int dim, int spacedim> static - unsigned int + types::global_dof_index get_vertex_dof_index (const dealii::hp::DoFHandler<dim,spacedim> &dof_handler, const unsigned int vertex_index, const unsigned int fe_index, @@ -1232,7 +1242,7 @@ namespace internal ExcIndexRange (vertex_index, 0, dof_handler.vertex_dofs_offsets.size())); Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, + numbers::invalid_dof_index, ExcMessage ("This vertex is unused and has no DoFs associated with it")); // hop along the list of index @@ -1242,15 +1252,16 @@ namespace internal // part. trigger an exception if // we can't find a set for this // particular fe_index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)<std::numeric_limits<types::global_dof_index>::max(), ExcInternalError()); + const types::global_dof_index this_fe_index = *pointer; - Assert (this_fe_index != numbers::invalid_unsigned_int, + Assert (this_fe_index != numbers::invalid_dof_index, ExcInternalError()); Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1258,7 +1269,8 @@ namespace internal if (this_fe_index == fe_index) return *(pointer + 1 + local_index); else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + pointer += static_cast<types::global_dof_index>( + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); } } @@ -1280,16 +1292,16 @@ namespace internal "this DoFHandler")); // if this vertex is unused, return 0 - if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int) + if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_dof_index) return 0; // hop along the list of index // sets and count the number of // hops - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; - Assert (*pointer != numbers::invalid_unsigned_int, + Assert (*pointer != numbers::invalid_dof_index, ExcInternalError()); unsigned int counter = 0; @@ -1297,13 +1309,14 @@ namespace internal { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + const types::global_dof_index this_fe_index = *pointer; - if (this_fe_index == numbers::invalid_unsigned_int) + if (this_fe_index == numbers::invalid_dof_index) return counter; else { - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + pointer += static_cast<types::global_dof_index>( + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); ++counter; } } @@ -1332,16 +1345,16 @@ namespace internal // make sure we don't ask on // unused vertices Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, + numbers::invalid_dof_index, ExcInternalError()); // hop along the list of index // sets and count the number of // hops - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; - Assert (*pointer != numbers::invalid_unsigned_int, + Assert (*pointer != numbers::invalid_dof_index, ExcInternalError()); unsigned int counter = 0; @@ -1349,7 +1362,8 @@ namespace internal { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)<std::numeric_limits<unsigned int>::max(), ExcInternalError()); + const types::global_dof_index this_fe_index = *pointer; Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1357,10 +1371,11 @@ namespace internal if (counter == n) return this_fe_index; - Assert (this_fe_index != numbers::invalid_unsigned_int, + Assert (this_fe_index != numbers::invalid_dof_index, ExcInternalError()); - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + pointer += static_cast<types::global_dof_index>( + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); ++counter; } } @@ -1392,28 +1407,29 @@ namespace internal // make sure we don't ask on // unused vertices Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, + numbers::invalid_dof_index, ExcInternalError()); // hop along the list of index // sets and see whether we find // the given index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + const types::global_dof_index starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const types::global_dof_index *pointer = &dof_handler.vertex_dofs[starting_offset]; - Assert (*pointer != numbers::invalid_unsigned_int, + Assert (*pointer != numbers::invalid_dof_index, ExcInternalError()); while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - const unsigned int this_fe_index = *pointer; + Assert((*pointer)<std::numeric_limits<types::global_dof_index>::max(), ExcInternalError()); + const types::global_dof_index this_fe_index = *pointer; Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); - if (this_fe_index == numbers::invalid_unsigned_int) + if (this_fe_index == numbers::invalid_dof_index) return false; else if (this_fe_index == fe_index) return true; @@ -1426,7 +1442,7 @@ namespace internal static void set_mg_dof_indices (const dealii::DoFAccessor<1,DH,lda> &, const int, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, const unsigned int) { AssertThrow (false, ExcNotImplemented ()); //TODO[TH]: implement @@ -1438,11 +1454,11 @@ namespace internal static void set_mg_dof_indices (dealii::DoFAccessor<2, DH,lda> &accessor, const int level, - const std::vector<unsigned int> &dof_indices, + const std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const FiniteElement<DH::dimension, DH::space_dimension> &fe = accessor.get_dof_handler ().get_fe ()[fe_index]; - std::vector<unsigned int>::const_iterator next = dof_indices.begin (); + std::vector<types::global_dof_index>::const_iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1464,7 +1480,7 @@ namespace internal static void set_mg_dof_indices (const dealii::DoFAccessor<3, DH,lda> &, const int, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, const unsigned int) { AssertThrow (false, ExcNotImplemented ()); //TODO[TH]: implement @@ -1478,7 +1494,7 @@ namespace internal template <int dim, class DH, bool lda> inline -unsigned int +types::global_dof_index DoFAccessor<dim,DH,lda>::dof_index (const unsigned int i, const unsigned int fe_index) const { @@ -1494,7 +1510,9 @@ DoFAccessor<dim,DH,lda>::dof_index (const unsigned int i, template<int structdim, class DH, bool lda> inline -unsigned int DoFAccessor<structdim, DH,lda>::mg_dof_index (const int level, const unsigned int i) const +types::global_dof_index +DoFAccessor<structdim, DH,lda>::mg_dof_index (const int level, + const unsigned int i) const { return this->dof_handler->template get_dof_index<structdim> (level, this->present_index, 0, i); } @@ -1504,7 +1522,7 @@ template <int dim, class DH, bool lda> inline void DoFAccessor<dim,DH,lda>::set_dof_index (const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index) const { // access the respective DoF @@ -1571,7 +1589,7 @@ DoFAccessor<dim,DH,lda>::fe_index_is_active (const unsigned int fe_index) const template <int structdim, class DH, bool lda> inline -unsigned int +types::global_dof_index DoFAccessor<structdim, DH,lda>::vertex_dof_index (const unsigned int vertex, const unsigned int i, const unsigned int fe_index) const @@ -1587,8 +1605,11 @@ DoFAccessor<structdim, DH,lda>::vertex_dof_index (const unsigned int vertex, template<int structdim, class DH, bool lda> inline -unsigned -DoFAccessor<structdim, DH,lda>::mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int fe_index) const +types::global_dof_index +DoFAccessor<structdim, DH,lda>::mg_vertex_dof_index (const int level, + const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); @@ -1603,7 +1624,7 @@ inline void DoFAccessor<structdim, DH,lda>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index) const { dealii::internal::DoFAccessor::Implementation::set_vertex_dof_index @@ -1618,7 +1639,11 @@ DoFAccessor<structdim, DH,lda>::set_vertex_dof_index (const unsigned int vertex, template<int structdim, class DH, bool lda> inline void -DoFAccessor<structdim, DH,lda>::set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const unsigned int index, const unsigned int fe_index) const +DoFAccessor<structdim, DH,lda>::set_mg_vertex_dof_index (const int level, + const unsigned int vertex, + const unsigned int i, + const types::global_dof_index index, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); @@ -1631,7 +1656,9 @@ DoFAccessor<structdim, DH,lda>::set_mg_vertex_dof_index (const int level, const template<int structdim, class DH, bool lda> inline void -DoFAccessor<structdim, DH,lda>::set_mg_dof_index (const int level, const unsigned int i, const unsigned int index) const +DoFAccessor<structdim, DH,lda>::set_mg_dof_index (const int level, + const unsigned int i, + const types::global_dof_index index) const { this->dof_handler->template set_dof_index<structdim> (level, this->present_index, 0, i, index); } @@ -1683,12 +1710,12 @@ namespace internal { template <class DH, bool lda> void get_dof_indices (const dealii::DoFAccessor<1,DH,lda> &accessor, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, dofs_per_line = accessor.get_fe(fe_index).dofs_per_line; - std::vector<unsigned int>::iterator next = dof_indices.begin(); + std::vector<types::global_dof_index>::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d<dofs_per_vertex; ++d) *next++ = accessor.vertex_dof_index(vertex,d,fe_index); @@ -1700,13 +1727,13 @@ namespace internal template <class DH, bool lda> void get_dof_indices (const dealii::DoFAccessor<2,DH,lda> &accessor, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad; - std::vector<unsigned int>::iterator next = dof_indices.begin(); + std::vector<types::global_dof_index>::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; d<dofs_per_vertex; ++d) *next++ = accessor.vertex_dof_index(vertex,d,fe_index); @@ -1735,14 +1762,14 @@ namespace internal template <class DH, bool lda> void get_dof_indices (const dealii::DoFAccessor<3,DH,lda> &accessor, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad, dofs_per_hex = accessor.get_fe(fe_index).dofs_per_hex; - std::vector<unsigned int>::iterator next = dof_indices.begin(); + std::vector<types::global_dof_index>::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; d<dofs_per_vertex; ++d) *next++ = accessor.vertex_dof_index(vertex,d,fe_index); @@ -1792,16 +1819,16 @@ namespace internal template<class DH, bool lda> void get_mg_dof_indices (const dealii::DoFAccessor<1, DH,lda> &accessor, const int level, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const DH &handler = accessor.get_dof_handler(); - Assert(handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); const FiniteElement<DH::dimension, DH::space_dimension> &fe = handler.get_fe ()[fe_index]; - std::vector<unsigned int>::iterator next = dof_indices.begin (); + std::vector<types::global_dof_index>::iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1818,15 +1845,15 @@ namespace internal template<class DH, bool lda> void get_mg_dof_indices (const dealii::DoFAccessor<2, DH,lda> &accessor, const int level, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const DH &handler = accessor.get_dof_handler(); - Assert(handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); const FiniteElement<DH::dimension, DH::space_dimension> &fe = handler.get_fe ()[fe_index]; - std::vector<unsigned int>::iterator next = dof_indices.begin (); + std::vector<types::global_dof_index>::iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1847,15 +1874,15 @@ namespace internal template<class DH, bool lda> void get_mg_dof_indices (const dealii::DoFAccessor<3, DH,lda> &accessor, const int level, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { const DH &handler = accessor.get_dof_handler(); - Assert(handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); const FiniteElement<DH::dimension, DH::space_dimension> &fe = handler.get_fe ()[fe_index]; - std::vector<unsigned int>::iterator next = dof_indices.begin (); + std::vector<types::global_dof_index>::iterator next = dof_indices.begin (); for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++vertex) for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof) @@ -1883,7 +1910,7 @@ namespace internal template <int structdim, class DH, bool lda> inline void -DoFAccessor<structdim,DH,lda>::get_dof_indices (std::vector<unsigned int> &dof_indices, +DoFAccessor<structdim,DH,lda>::get_dof_indices (std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcNotInitialized()); @@ -1946,7 +1973,7 @@ DoFAccessor<structdim,DH,lda>::get_dof_indices (std::vector<unsigned int> &dof_i template<int structdim, class DH, bool lda> inline void DoFAccessor<structdim, DH,lda>::get_mg_dof_indices (const int level, - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); @@ -1998,7 +2025,7 @@ void DoFAccessor<structdim, DH,lda>::get_mg_dof_indices (const int level, template<int structdim, class DH, bool lda> inline void DoFAccessor<structdim, DH,lda>::set_mg_dof_indices (const int level, - const std::vector<unsigned int> &dof_indices, + const std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) { Assert (this->dof_handler != 0, ExcInvalidObject ()); @@ -2134,10 +2161,10 @@ DoFAccessor<structdim,DH,lda>::line (const unsigned int i) const // checking of 'i' happens in line_index(i) return typename dealii::internal::DoFHandler::Iterators<DH,lda>::line_iterator - (this->tria, - 0, // only sub-objects are allowed, which have no level - this->line_index(i), - this->dof_handler); + (this->tria, + 0, // only sub-objects are allowed, which have no level + this->line_index(i), + this->dof_handler); } @@ -2169,10 +2196,10 @@ DoFAccessor<structdim,DH,lda>::quad (const unsigned int i) const // checking of 'i' happens in quad_index(i) return typename dealii::internal::DoFHandler::Iterators<DH,lda>::quad_iterator - (this->tria, - 0, // only sub-objects are allowed, which have no level - this->quad_index(i), - this->dof_handler); + (this->tria, + 0, // only sub-objects are allowed, which have no level + this->quad_index(i), + this->dof_handler); } @@ -2264,7 +2291,7 @@ template <template <int, int> class DH, int spacedim, bool lda> inline void DoFAccessor<0,DH<1,spacedim>, lda>::get_dof_indices ( - std::vector<unsigned int> &dof_indices, + std::vector<types::global_dof_index> &dof_indices, const unsigned int fe_index) const { for (unsigned int i=0; i<dof_indices.size(); ++i) @@ -2280,7 +2307,7 @@ DoFAccessor<0,DH<1,spacedim>, lda>::get_dof_indices ( template <template <int, int> class DH, int spacedim, bool lda> inline -unsigned int +types::global_dof_index DoFAccessor<0,DH<1,spacedim>, lda>:: vertex_dof_index (const unsigned int vertex, const unsigned int i, @@ -2403,7 +2430,7 @@ namespace internal ->cell_dof_indices_cache.size(), ExcInternalError()); - std::vector<unsigned int>::iterator next + std::vector<types::global_dof_index>::iterator next = (accessor.dof_handler->levels[accessor.present_level] ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell); @@ -2449,7 +2476,7 @@ namespace internal ->cell_dof_indices_cache.size(), ExcInternalError()); - std::vector<unsigned int>::iterator next + std::vector<types::global_dof_index>::iterator next = (accessor.dof_handler->levels[accessor.present_level] ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell); @@ -2498,7 +2525,7 @@ namespace internal ->cell_dof_indices_cache.size(), ExcInternalError()); - std::vector<unsigned int>::iterator next + std::vector<types::global_dof_index>::iterator next = (accessor.dof_handler->levels[accessor.present_level] ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell); @@ -2573,7 +2600,7 @@ namespace internal static void set_dof_indices (DoFCellAccessor<DoFHandler<1,spacedim>, lda> &accessor, - const std::vector<unsigned int> &local_dof_indices) + const std::vector<types::global_dof_index> &local_dof_indices) { Assert (accessor.has_children() == false, ExcInternalError()); @@ -2605,7 +2632,7 @@ namespace internal static void set_dof_indices (DoFCellAccessor<DoFHandler<2,spacedim>, lda> &accessor, - const std::vector<unsigned int> &local_dof_indices) + const std::vector<types::global_dof_index> &local_dof_indices) { Assert (accessor.has_children() == false, ExcInternalError()); @@ -2641,7 +2668,7 @@ namespace internal static void set_dof_indices (DoFCellAccessor<DoFHandler<3,spacedim>, lda> &accessor, - const std::vector<unsigned int> &local_dof_indices) + const std::vector<types::global_dof_index> &local_dof_indices) { Assert (accessor.has_children() == false, ExcInternalError()); @@ -2715,7 +2742,7 @@ namespace internal static void set_dof_indices (const DoFCellAccessor<dealii::hp::DoFHandler<dim,spacedim>, lda> &, - const std::vector<unsigned int> &) + const std::vector<types::global_dof_index> &) { Assert (false, ExcNotImplemented()); } @@ -2734,21 +2761,15 @@ namespace internal static void get_dof_indices (const DoFCellAccessor<DoFHandler<dim,spacedim>, lda> &accessor, - std::vector<unsigned int> &dof_indices) + std::vector<types::global_dof_index> &dof_indices) { AssertDimension (dof_indices.size(), accessor.get_fe().dofs_per_cell); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - - unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); + + types::global_dof_index *cache = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; for (unsigned int i=0; i<accessor.get_fe().dofs_per_cell; ++i, ++cache) dof_indices[i] = *cache; } @@ -2764,7 +2785,7 @@ namespace internal static void get_dof_indices (const DoFCellAccessor<dealii::hp::DoFHandler<dim,spacedim>, lda> &accessor, - std::vector<unsigned int> &dof_indices) + std::vector<types::global_dof_index> &dof_indices) { // no caching for // hp::DoFHandler @@ -2800,18 +2821,12 @@ namespace internal Assert (values.size() == accessor.get_dof_handler().n_dofs(), typename BaseClass::ExcVectorDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - - unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * - accessor.get_fe().dofs_per_cell]; + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); + + types::global_dof_index *cache = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * + accessor.get_fe().dofs_per_cell]; for ( ; local_values_begin != local_values_end; ++local_values_begin, ++cache) *local_values_begin = values(*cache); } @@ -2840,7 +2855,7 @@ namespace internal typename BaseClass::ExcVectorDoesNotMatch()); const unsigned int dofs_per_cell = accessor.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); get_dof_indices (accessor, local_dof_indices); for (unsigned int i=0; i<dofs_per_cell; ++i, ++local_values_begin) @@ -2873,18 +2888,12 @@ namespace internal Assert (values.size() == accessor.get_dof_handler().n_dofs(), typename BaseClass::ExcVectorDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - - unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * - accessor.get_fe().dofs_per_cell]; + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); + + types::global_dof_index *cache = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * + accessor.get_fe().dofs_per_cell]; constraints.get_dof_values(values, *cache, local_values_begin, local_values_end); } @@ -2913,7 +2922,7 @@ namespace internal typename BaseClass::ExcVectorDoesNotMatch()); const unsigned int dofs_per_cell = accessor.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); get_dof_indices (accessor, local_dof_indices); constraints.get_dof_values (values, local_dof_indices.begin(), @@ -2939,17 +2948,11 @@ namespace internal Assert (values.size() == accessor.get_dof_handler().n_dofs(), typename BaseClass::ExcVectorDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - - unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); + + types::global_dof_index *cache = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; for (unsigned int i=0; i<accessor.get_fe().dofs_per_cell; ++i, ++cache) values(*cache) = local_values(i); } @@ -2967,7 +2970,7 @@ namespace internal // implemented const unsigned int dofs_per_cell = accessor.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); get_dof_indices (accessor, local_dof_indices); for (unsigned int i=0; i<dofs_per_cell; ++i) @@ -3073,19 +3076,13 @@ namespace internal Assert (accessor.dof_handler->n_dofs() == global_destination.size(), typename BaseClass::ExcVectorDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active")); const unsigned int n_dofs = local_source_end - local_source_begin; - unsigned int *dofs = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * n_dofs]; + types::global_dof_index *dofs = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * n_dofs]; // distribute cell vector global_destination.add(n_dofs, dofs, local_source_begin); @@ -3116,7 +3113,7 @@ namespace internal //TODO[WB/MK]: This function could me made more efficient because it allocates memory, which could be avoided by passing in another argument as a scratch array. This should be fixed eventually // get indices of dofs - std::vector<unsigned int> dofs (n_dofs); + std::vector<types::global_dof_index> dofs (n_dofs); accessor.get_dof_indices (dofs); // distribute cell vector @@ -3144,19 +3141,13 @@ namespace internal Assert (accessor.dof_handler->n_dofs() == global_destination.size(), typename BaseClass::ExcVectorDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); const unsigned int n_dofs = local_source_end - local_source_begin; - unsigned int *dofs = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * n_dofs]; + types::global_dof_index *dofs = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * n_dofs]; // distribute cell vector constraints.distribute_local_to_global (local_source_begin, local_source_end, @@ -3189,7 +3180,7 @@ namespace internal //TODO[WB/MK]: This function could me made more efficient because it allocates memory, which could be avoided by passing in another argument as a scratch array. This should be fixed eventually // get indices of dofs - std::vector<unsigned int> dofs (n_dofs); + std::vector<types::global_dof_index> dofs (n_dofs); accessor.get_dof_indices (dofs); // distribute cell vector @@ -3220,19 +3211,13 @@ namespace internal Assert (accessor.dof_handler->n_dofs() == global_destination.n(), typename BaseClass::ExcMatrixDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); const unsigned int n_dofs = local_source.m(); - unsigned int *dofs = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * n_dofs]; + types::global_dof_index *dofs = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index * n_dofs]; // distribute cell matrix for (unsigned int i=0; i<n_dofs; ++i) @@ -3268,7 +3253,7 @@ namespace internal //TODO[WB/MK]: This function could me made more efficient because it allocates memory, which could be avoided by passing in another argument as a scratch array. // get indices of dofs - std::vector<unsigned int> dofs (n_dofs); + std::vector<types::global_dof_index> dofs (n_dofs); accessor.get_dof_indices (dofs); // distribute cell matrix @@ -3305,18 +3290,12 @@ namespace internal Assert (accessor.dof_handler->n_dofs() == global_vector.size(), typename BaseClass::ExcVectorDoesNotMatch()); - // check as in documentation that - // cell is either active, or dofs - // are only in vertices - Assert (!accessor.has_children() - || - (accessor.get_fe().dofs_per_cell == - accessor.get_fe().dofs_per_vertex * GeometryInfo<dim>::vertices_per_cell), - ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); + Assert (!accessor.has_children(), + ExcMessage ("Cell must be active.")); const unsigned int n_dofs = accessor.get_fe().dofs_per_cell; - unsigned int *dofs = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index *n_dofs]; + types::global_dof_index *dofs = &accessor.dof_handler->levels[accessor.level()] + ->cell_dof_indices_cache[accessor.present_index *n_dofs]; // distribute cell matrices for (unsigned int i=0; i<n_dofs; ++i) @@ -3364,7 +3343,7 @@ namespace internal //to ConstraintMatrix or MeshWorker::Assembler // get indices of dofs - std::vector<unsigned int> dofs (n_dofs); + std::vector<types::global_dof_index> dofs (n_dofs); accessor.get_dof_indices (dofs); // distribute cell matrix and vector @@ -3484,7 +3463,7 @@ namespace internal dealii::TriaAccessor<0, 1, DH::space_dimension>::interior_vertex)), cell.vertex_index(i), &cell.get_dof_handler()); - return typename dealii::TriaIterator<dealii::DoFAccessor<DH::dimension-1,DH,lda> > (a); + return dealii::TriaIterator<dealii::DoFAccessor<0,DH,lda> > (a); } @@ -3529,8 +3508,9 @@ DoFCellAccessor<DH,lda>::face (const unsigned int i) const template <class DH, bool lda> inline void -DoFCellAccessor<DH,lda>::get_dof_indices (std::vector<unsigned int> &dof_indices) const +DoFCellAccessor<DH,lda>::get_dof_indices (std::vector<types::global_dof_index> &dof_indices) const { + Assert (this->active(), ExcMessage ("get_dof_indices() only works on active cells.")); Assert (this->is_artificial() == false, ExcMessage ("Can't ask for DoF indices on artificial cells.")); AssertDimension (dof_indices.size(), this->get_fe().dofs_per_cell); @@ -3541,14 +3521,14 @@ DoFCellAccessor<DH,lda>::get_dof_indices (std::vector<unsigned int> &dof_indices template<class DH, bool lda> inline -void DoFCellAccessor<DH,lda>::get_mg_dof_indices (std::vector<unsigned int> &dof_indices) const +void DoFCellAccessor<DH,lda>::get_mg_dof_indices (std::vector<types::global_dof_index> &dof_indices) const { DoFAccessor<dim, DH,lda>::get_mg_dof_indices (this->level (), dof_indices); } template<class DH, bool lda> inline -void DoFCellAccessor<DH,lda>::set_mg_dof_indices (const std::vector<unsigned int> &dof_indices) +void DoFCellAccessor<DH,lda>::set_mg_dof_indices (const std::vector<types::global_dof_index> &dof_indices) { DoFAccessor<dim, DH,lda>::set_mg_dof_indices (this->level (), dof_indices); } @@ -3556,7 +3536,7 @@ void DoFCellAccessor<DH,lda>::set_mg_dof_indices (const std::vector<unsigned int template<class DH, bool lda> inline -void DoFCellAccessor<DH,lda>::get_active_or_mg_dof_indices (std::vector<unsigned int> &dof_indices) const +void DoFCellAccessor<DH,lda>::get_active_or_mg_dof_indices (std::vector<types::global_dof_index> &dof_indices) const { if (lda) get_mg_dof_indices (dof_indices); diff --git a/deal.II/include/deal.II/dofs/dof_faces.h b/deal.II/include/deal.II/dofs/dof_faces.h index a9062e8bf9..5ea64c0fae 100644 --- a/deal.II/include/deal.II/dofs/dof_faces.h +++ b/deal.II/include/deal.II/dofs/dof_faces.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 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__dof_faces_h #define __deal2__dof_faces_h @@ -42,7 +47,7 @@ namespace internal * 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 * degrees of freedom located on quads and lines. In 1D we do nothing, as the faces of - * lines are vertices which are treated seperately. + * lines are vertices which are treated separately. * * Apart from the DoFObjects object containing the data to store (degree of freedom * indices) we do not store any data or provide any functionality. However, we do implement @@ -72,7 +77,7 @@ namespace internal /** * 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 treted separately, don't do anything. * * @author Tobias Leicht, 2006 */ diff --git a/deal.II/include/deal.II/dofs/dof_handler.h b/deal.II/include/deal.II/dofs/dof_handler.h index a69f3d467a..9e990e154e 100644 --- a/deal.II/include/deal.II/dofs/dof_handler.h +++ b/deal.II/include/deal.II/dofs/dof_handler.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__dof_handler_h #define __deal2__dof_handler_h @@ -135,7 +140,7 @@ namespace internal * respective degree of freedom shall be assigned. This number may, for * example, be obtained by sorting the support points of the degrees of * freedom in downwind direction. Then call the - * <tt>renumber_dofs(vector<unsigned int>)</tt> function with the array, which + * <tt>renumber_dofs(vector<types::global_dof_index>)</tt> function with the array, which * converts old into new degree of freedom indices. * * @@ -232,7 +237,7 @@ public: * certain value, but rather take * its symbolic name. */ - static const unsigned int invalid_dof_index = numbers::invalid_unsigned_int; + static const types::global_dof_index invalid_dof_index = numbers::invalid_dof_index; /** * The default index of the @@ -425,7 +430,7 @@ public: * case that only one processor * participates in the mesh. */ - void renumber_dofs (const std::vector<unsigned int> &new_numbers); + void renumber_dofs (const std::vector<types::global_dof_index> &new_numbers); /** * The same function as above, but @@ -433,7 +438,7 @@ public: * single level of a multigrid hierarchy. */ void renumber_dofs (const unsigned int level, - const std::vector<unsigned int> &new_numbers); + const std::vector<types::global_dof_index> &new_numbers); /** * Return the maximum number of @@ -511,8 +516,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 + * <code>end_active(level)</code> 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; @@ -534,10 +547,8 @@ 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 + * 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 <tt>end()</tt>. */ active_cell_iterator end_active (const unsigned int level) const; @@ -603,7 +614,7 @@ public: * DoFs which are constrained by * hanging nodes, see @ref constraints. */ - unsigned int n_dofs () const; + types::global_dof_index n_dofs () const; /** * The (global) number of multilevel @@ -613,17 +624,17 @@ public: * If no level degrees of * freedom have been assigned * to this level, returns - * numbers::invalid_unsigned_int. Else + * numbers::invalid_dof_index. Else * returns the number of * degrees of freedom on this level. */ - unsigned int n_dofs (const unsigned int level) const; + types::global_dof_index n_dofs (const unsigned int level) const; /** * Return the number of degrees of freedom * located on the boundary. */ - unsigned int n_boundary_dofs () const; + types::global_dof_index n_boundary_dofs () const; /** * Return the number of degrees @@ -638,7 +649,7 @@ public: * @p make_boundary_sparsity_pattern * function. */ - unsigned int + types::global_dof_index n_boundary_dofs (const FunctionMap &boundary_indicators) const; /** @@ -649,7 +660,7 @@ public: * indicators under * consideration. */ - unsigned int + types::global_dof_index n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const; /** @@ -779,7 +790,7 @@ public: * then the vector has a single * element equal to n_dofs(). */ - const std::vector<unsigned int> & + const std::vector<types::global_dof_index> & n_locally_owned_dofs_per_processor () const; /** @@ -852,7 +863,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcNewNumbersNotConsecutive, - int, + types::global_dof_index, << "The given list of new dof indices is not consecutive: " << "the index " << arg1 << " does not exist."); /** @@ -891,7 +902,7 @@ protected: * degrees of freedom located at * vertices. */ - std::vector<unsigned int> vertex_dofs; + std::vector<types::global_dof_index> vertex_dofs; @@ -966,23 +977,93 @@ private: */ DoFHandler &operator = (const DoFHandler &); + /** + * A data structure that is used to store the DoF indices associated with + * a particular vertex. Unlike cells, vertices live on several levels of + * a multigrid hierarchy; consequently, we need to store DoF indices for + * each vertex for each of the levels it lives on. This class does + * this. + */ class MGVertexDoFs { - private: - unsigned int coarsest_level; - unsigned int finest_level; - unsigned int *indices; - unsigned int *indices_offset; - public: - DeclException0 (ExcNoMemory); + /** + * Constructor. + */ MGVertexDoFs (); + + /** + * Destructor. + */ ~MGVertexDoFs (); + + /** + * A function that is called to allocate the necessary amount of memory + * to store the indices of the DoFs that live on this vertex for the + * given (inclusive) range of levels. + */ + void init (const unsigned int coarsest_level, + const unsigned int finest_level, + const unsigned int dofs_per_vertex); + + /** + * Return the coarsest level for which this structure + * stores data. + */ unsigned int get_coarsest_level () const; + + /** + * Return the finest level for which this structure + * stores data. + */ unsigned int get_finest_level () const; - unsigned int get_index (const unsigned int level, const unsigned int dof_number) const; - void init (const unsigned int coarsest_level, const unsigned int finest_level, const unsigned int dofs_per_vertex); - void set_index (const unsigned int level, const unsigned int dof_number, const unsigned int index); + + /** + * Return the index of the <code>dof_number</code>th degree of + * freedom for the given level stored for the current vertex. + */ + types::global_dof_index + get_index (const unsigned int level, + const unsigned int dof_number) const; + + /** + * Set the index of the <code>dof_number</code>th degree of + * freedom for the given level stored for the current vertex + * to <code>index</code>. + */ + void set_index (const unsigned int level, + const unsigned int dof_number, + const types::global_dof_index index); + + /** + * Exception. + */ + DeclException0 (ExcNoMemory); + + private: + /** + * Coarsest level for which this object stores DoF indices. + */ + unsigned int coarsest_level; + + /** + * Finest level for which this object stores DoF indices. + */ + unsigned int finest_level; + + /** + * A pointer to an array where we store the indices of the + * DoFs that live on the various levels this vertex exists + * on. + */ + types::global_dof_index *indices; + + /** + * This array stores, for each level starting with coarsest_level, + * the offset in the <code>indices</code> array where the DoF + * indices for each level are stored. + */ + types::global_dof_index *indices_offset; }; void clear_mg_space (); @@ -995,10 +1076,10 @@ private: void reserve_space (); template <int structdim> - unsigned int get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const; + types::global_dof_index get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const; template<int structdim> - void set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index) const; + void set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index) const; /** * Space to store the DoF numbers @@ -1044,13 +1125,13 @@ private: #ifndef DOXYGEN -template <> unsigned int DoFHandler<1>::n_boundary_dofs () const; -template <> unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const; -template <> unsigned int DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> &) const; +template <> types::global_dof_index DoFHandler<1>::n_boundary_dofs () const; +template <> types::global_dof_index DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const; +template <> types::global_dof_index DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> &) const; -template <> void DoFHandler<1>::renumber_dofs(unsigned int,const std::vector<unsigned int> &new_numbers); -template <> void DoFHandler<2>::renumber_dofs(unsigned int,const std::vector<unsigned int> &new_numbers); -template <> void DoFHandler<3>::renumber_dofs(unsigned int,const std::vector<unsigned int> &new_numbers); +template <> void DoFHandler<1>::renumber_dofs(unsigned int,const std::vector<types::global_dof_index> &new_numbers); +template <> void DoFHandler<2>::renumber_dofs(unsigned int,const std::vector<types::global_dof_index> &new_numbers); +template <> void DoFHandler<3>::renumber_dofs(unsigned int,const std::vector<types::global_dof_index> &new_numbers); /* ----------------------- Inline functions ---------------------------------- */ @@ -1074,7 +1155,7 @@ DoFHandler<dim,spacedim>::has_active_dofs() const template <int dim, int spacedim> inline -unsigned int +types::global_dof_index DoFHandler<dim,spacedim>::n_dofs () const { return number_cache.n_global_dofs; @@ -1082,7 +1163,7 @@ DoFHandler<dim,spacedim>::n_dofs () const template<int dim, int spacedim> inline -unsigned int DoFHandler<dim, spacedim>::n_dofs (const unsigned int level) const +types::global_dof_index DoFHandler<dim, spacedim>::n_dofs (const unsigned int level) const { Assert(has_level_dofs(), ExcMessage("n_dofs(level) can only be called after distribute_mg_dofs()")); Assert (level < mg_number_cache.size (), ExcInvalidLevel (level)); @@ -1114,7 +1195,7 @@ DoFHandler<dim, spacedim>::locally_owned_mg_dofs(const unsigned int level) const } template <int dim, int spacedim> -const std::vector<unsigned int> & +const std::vector<types::global_dof_index> & DoFHandler<dim, spacedim>::n_locally_owned_dofs_per_processor() const { return number_cache.n_locally_owned_dofs_per_processor; @@ -1231,7 +1312,7 @@ void DoFHandler<dim,spacedim>::load (Archive &ar, template<int dim, int spacedim> inline -unsigned int DoFHandler<dim, spacedim>::MGVertexDoFs::get_index ( +types::global_dof_index DoFHandler<dim, spacedim>::MGVertexDoFs::get_index ( const unsigned int level, const unsigned int dof_number) const { @@ -1245,7 +1326,7 @@ inline void DoFHandler<dim, spacedim>::MGVertexDoFs::set_index ( const unsigned int level, const unsigned int dof_number, - const unsigned int index) + const types::global_dof_index index) { Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel (level)); indices[indices_offset[level - coarsest_level] + dof_number] = index; diff --git a/deal.II/include/deal.II/dofs/dof_handler_policy.h b/deal.II/include/deal.II/dofs/dof_handler_policy.h index fe40bf264c..42eecf8afa 100644 --- a/deal.II/include/deal.II/dofs/dof_handler_policy.h +++ b/deal.II/include/deal.II/dofs/dof_handler_policy.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__dof_handler_policy_h #define __deal2__dof_handler_policy_h @@ -81,7 +86,7 @@ namespace internal */ virtual NumberCache - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, dealii::DoFHandler<dim,spacedim> &dof_handler) const = 0; }; @@ -118,7 +123,7 @@ namespace internal */ virtual NumberCache - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, dealii::DoFHandler<dim,spacedim> &dof_handler) const; }; @@ -156,7 +161,7 @@ namespace internal */ virtual NumberCache - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, dealii::DoFHandler<dim,spacedim> &dof_handler) const; }; } diff --git a/deal.II/include/deal.II/dofs/dof_iterator_selector.h b/deal.II/include/deal.II/dofs/dof_iterator_selector.h index 554ead6c85..c87890d2f0 100644 --- a/deal.II/include/deal.II/dofs/dof_iterator_selector.h +++ b/deal.II/include/deal.II/dofs/dof_iterator_selector.h @@ -1,14 +1,19 @@ -//---------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__dof_iterators_h #define __deal2__dof_iterators_h diff --git a/deal.II/include/deal.II/dofs/dof_levels.h b/deal.II/include/deal.II/dofs/dof_levels.h index dbd19dc965..a153fa1c7b 100644 --- a/deal.II/include/deal.II/dofs/dof_levels.h +++ b/deal.II/include/deal.II/dofs/dof_levels.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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__dof_levels_h #define __deal2__dof_levels_h @@ -77,7 +82,7 @@ namespace internal * times * selected_fe.dofs_per_cell. */ - std::vector<unsigned int> cell_dof_indices_cache; + std::vector<types::global_dof_index> cell_dof_indices_cache; /** * The object containing dof-indices diff --git a/deal.II/include/deal.II/dofs/dof_objects.h b/deal.II/include/deal.II/dofs/dof_objects.h index 2d0f9d1c8d..57c6ba5686 100644 --- a/deal.II/include/deal.II/dofs/dof_objects.h +++ b/deal.II/include/deal.II/dofs/dof_objects.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__dof_objects_h #define __deal2__dof_objects_h @@ -63,7 +68,7 @@ namespace internal * Store the global indices of * the degrees of freedom. */ - std::vector<unsigned int> dofs; + std::vector<types::global_dof_index> dofs; public: /** @@ -99,7 +104,7 @@ namespace internal const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index); + const types::global_dof_index global_index); /** * Return the global index of @@ -127,7 +132,7 @@ namespace internal * and non-hp classes. */ template <int dh_dim, int spacedim> - unsigned int + types::global_dof_index get_dof_index (const dealii::DoFHandler<dh_dim,spacedim> &dof_handler, const unsigned int obj_index, const unsigned int fe_index, @@ -144,7 +149,7 @@ namespace internal template <int dh_dim, int spacedim> unsigned int n_active_fe_indices (const dealii::DoFHandler<dh_dim,spacedim> &dof_handler, - const unsigned int index) const; + const types::global_dof_index index) const; /** * Similar to the function @@ -155,7 +160,7 @@ namespace internal template <int dh_dim, int spacedim> bool fe_index_is_active (const dealii::DoFHandler<dh_dim,spacedim> &dof_handler, - const unsigned int index, + const types::global_dof_index index, const unsigned int fe_index) const; /** @@ -192,7 +197,7 @@ namespace internal inline unsigned int DoFObjects<dim>::n_active_fe_indices (const dealii::DoFHandler<dh_dim,spacedim> &, - const unsigned) const + const types::global_dof_index) const { return 1; } @@ -204,7 +209,7 @@ namespace internal inline bool DoFObjects<dim>::fe_index_is_active (const dealii::DoFHandler<dh_dim,spacedim> &, - const unsigned int, + const types::global_dof_index, const unsigned int fe_index) const { Assert (fe_index == 0, @@ -218,7 +223,7 @@ namespace internal template <int dim> template <int dh_dim, int spacedim> inline - unsigned int + types::global_dof_index DoFObjects<dim>:: get_dof_index (const dealii::DoFHandler<dh_dim,spacedim> &dof_handler, const unsigned int obj_index, diff --git a/deal.II/include/deal.II/dofs/dof_renumbering.h b/deal.II/include/deal.II/dofs/dof_renumbering.h index fce9f3fb95..c52ddaafd9 100644 --- a/deal.II/include/deal.II/dofs/dof_renumbering.h +++ b/deal.II/include/deal.II/dofs/dof_renumbering.h @@ -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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__dof_renumbering_h #define __deal2__dof_renumbering_h @@ -167,7 +172,7 @@ DEAL_II_NAMESPACE_OPEN * The component_wise() function allows not only to honor enumeration based on * vector components, but also allows to group together vector components into * "blocks" using a defaulted argument to the various DoFRenumber::component_wise() - * functinos (see @ref GlossComponent vs @ref GlossBlock for a description of + * functions (see @ref GlossComponent vs @ref GlossBlock for a description of * the difference). The blocks designated through this argument may, but do not * have to be, equal to the blocks that the finite element reports. For example, * a typical Stokes element would be @@ -445,8 +450,8 @@ namespace DoFRenumbering /** * Return true if c1 less c2. */ - bool operator () (const std::pair<Point<dim>,unsigned int> &c1, - const std::pair<Point<dim>,unsigned int> &c2) const + bool operator () (const std::pair<Point<dim>,types::global_dof_index> &c1, + const std::pair<Point<dim>,types::global_dof_index> &c2) const { const Point<dim> diff = c2.first-c1.first; return (diff*dir > 0 || (diff*dir==0 && c1.second<c2.second)); @@ -521,7 +526,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_Cuthill_McKee (std::vector<unsigned int> &new_dof_indices, + compute_Cuthill_McKee (std::vector<types::global_dof_index> &new_dof_indices, const DH &, const bool reversed_numbering = false, const bool use_constraints = false); @@ -566,7 +571,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_king_ordering (std::vector<unsigned int> &new_dof_indices, + compute_king_ordering (std::vector<types::global_dof_index> &new_dof_indices, const DH &, const bool reversed_numbering = false, const bool use_constraints = false); @@ -612,7 +617,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_minimum_degree (std::vector<unsigned int> &new_dof_indices, + compute_minimum_degree (std::vector<types::global_dof_index> &new_dof_indices, const DH &, const bool reversed_numbering = false, const bool use_constraints = false); @@ -641,7 +646,7 @@ namespace DoFRenumbering Cuthill_McKee (DH &dof_handler, const bool reversed_numbering = false, const bool use_constraints = false, - const std::vector<unsigned int> &starting_indices = std::vector<unsigned int>()); + const std::vector<types::global_dof_index> &starting_indices = std::vector<types::global_dof_index>()); /** * Computes the renumbering @@ -654,11 +659,11 @@ namespace DoFRenumbering */ template <class DH> void - compute_Cuthill_McKee (std::vector<unsigned int> &new_dof_indices, + compute_Cuthill_McKee (std::vector<types::global_dof_index> &new_dof_indices, const DH &, const bool reversed_numbering = false, const bool use_constraints = false, - const std::vector<unsigned int> &starting_indices = std::vector<unsigned int>()); + const std::vector<types::global_dof_index> &starting_indices = std::vector<types::global_dof_index>()); /** * Renumber the degrees of @@ -688,7 +693,7 @@ namespace DoFRenumbering Cuthill_McKee (DH &dof_handler, const unsigned int level, const bool reversed_numbering = false, - const std::vector<unsigned int> &starting_indices = std::vector<unsigned int> ()); + const std::vector<types::global_dof_index> &starting_indices = std::vector<types::global_dof_index> ()); /** * @name Component-wise numberings @@ -817,11 +822,12 @@ namespace DoFRenumbering * the renumbering vector. */ template <int dim, int spacedim, class ITERATOR, class ENDITERATOR> - unsigned int - compute_component_wise (std::vector<unsigned int> &new_dof_indices, + types::global_dof_index + compute_component_wise (std::vector<types::global_dof_index> &new_dof_indices, const ITERATOR &start, const ENDITERATOR &end, - const std::vector<unsigned int> &target_component); + const std::vector<unsigned int> &target_component, + bool is_level_operation); /** * @} @@ -919,8 +925,8 @@ namespace DoFRenumbering * the renumbering vector. */ template <int dim, int spacedim, class ITERATOR, class ENDITERATOR> - unsigned int - compute_block_wise (std::vector<unsigned int> &new_dof_indices, + types::global_dof_index + compute_block_wise (std::vector<types::global_dof_index> &new_dof_indices, const ITERATOR &start, const ENDITERATOR &end); @@ -972,8 +978,8 @@ namespace DoFRenumbering */ template <class DH> void - compute_cell_wise (std::vector<unsigned int> &renumbering, - std::vector<unsigned int> &inverse_renumbering, + compute_cell_wise (std::vector<types::global_dof_index> &renumbering, + std::vector<types::global_dof_index> &inverse_renumbering, const DH &dof_handler, const std::vector<typename DH::active_cell_iterator> &cell_order); @@ -999,8 +1005,8 @@ namespace DoFRenumbering */ template <class DH> void - compute_cell_wise (std::vector<unsigned int> &renumbering, - std::vector<unsigned int> &inverse_renumbering, + compute_cell_wise (std::vector<types::global_dof_index> &renumbering, + std::vector<types::global_dof_index> &inverse_renumbering, const DH &dof_handler, const unsigned int level, const std::vector<typename DH::level_cell_iterator> &cell_order); @@ -1138,8 +1144,8 @@ namespace DoFRenumbering */ template <class DH> void - compute_downstream (std::vector<unsigned int> &new_dof_indices, - std::vector<unsigned int> &reverse, + compute_downstream (std::vector<types::global_dof_index> &new_dof_indices, + std::vector<types::global_dof_index> &reverse, const DH &dof_handler, const Point<DH::space_dimension> &direction, const bool dof_wise_renumbering); @@ -1155,8 +1161,8 @@ namespace DoFRenumbering */ template <class DH> void - compute_downstream (std::vector<unsigned int> &new_dof_indices, - std::vector<unsigned int> &reverse, + compute_downstream (std::vector<types::global_dof_index> &new_dof_indices, + std::vector<types::global_dof_index> &reverse, const DH &dof_handler, const unsigned int level, const Point<DH::space_dimension> &direction, @@ -1205,7 +1211,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_clockwise_dg (std::vector<unsigned int> &new_dof_indices, + compute_clockwise_dg (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler, const Point<DH::space_dimension> &center, const bool counter); @@ -1274,7 +1280,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_sort_selected_dofs_back (std::vector<unsigned int> &new_dof_indices, + compute_sort_selected_dofs_back (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler, const std::vector<bool> &selected_dofs); @@ -1295,7 +1301,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_sort_selected_dofs_back (std::vector<unsigned int> &new_dof_indices, + compute_sort_selected_dofs_back (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler, const std::vector<bool> &selected_dofs, const unsigned int level); @@ -1318,7 +1324,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_random (std::vector<unsigned int> &new_dof_indices, + compute_random (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler); /** @@ -1380,7 +1386,7 @@ namespace DoFRenumbering */ template <class DH> void - compute_subdomain_wise (std::vector<unsigned int> &new_dof_indices, + compute_subdomain_wise (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler); /** diff --git a/deal.II/include/deal.II/dofs/dof_tools.h b/deal.II/include/deal.II/dofs/dof_tools.h index dc30e7863a..b7e1d21a7c 100644 --- a/deal.II/include/deal.II/dofs/dof_tools.h +++ b/deal.II/include/deal.II/dofs/dof_tools.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__dof_tools_h #define __deal2__dof_tools_h @@ -738,7 +743,7 @@ namespace DoFTools template <class DH, class SparsityPattern> void make_boundary_sparsity_pattern (const DH &dof, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SparsityPattern &sparsity_pattern); /** @@ -775,7 +780,7 @@ namespace DoFTools void make_boundary_sparsity_pattern (const DH &dof, const typename FunctionMap<DH::space_dimension>::type &boundary_indicators, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SparsityPattern &sparsity); /** @@ -1384,7 +1389,7 @@ namespace DoFTools /** * Do the same thing as the corresponding - * extract_dofs() functino for one level + * extract_dofs() function for one level * of a multi-grid DoF numbering. */ template <class DH> @@ -1396,7 +1401,7 @@ namespace DoFTools /** * Do the same thing as the corresponding - * extract_dofs() functino for one level + * extract_dofs() function for one level * of a multi-grid DoF numbering. */ template <class DH> @@ -1915,7 +1920,7 @@ namespace DoFTools const DH &dof_handler, const unsigned int level, const std::vector<bool> &selected_dofs = std::vector<bool>(), - unsigned int offset = 0); + types::global_dof_index offset = 0); /** * Create an incidence matrix that @@ -2253,7 +2258,7 @@ namespace DoFTools template <class DH> void count_dofs_per_component (const DH &dof_handler, - std::vector<unsigned int> &dofs_per_component, + std::vector<types::global_dof_index> &dofs_per_component, const bool vector_valued_once = false, std::vector<unsigned int> target_component = std::vector<unsigned int>()); @@ -2292,7 +2297,7 @@ namespace DoFTools template <class DH> void count_dofs_per_block (const DH &dof, - std::vector<unsigned int> &dofs_per_block, + std::vector<types::global_dof_index> &dofs_per_block, const std::vector<unsigned int> &target_block = std::vector<unsigned int>()); @@ -2307,7 +2312,7 @@ namespace DoFTools template <int dim, int spacedim> void count_dofs_per_component (const DoFHandler<dim,spacedim> &dof_handler, - std::vector<unsigned int> &dofs_per_component, + std::vector<types::global_dof_index> &dofs_per_component, std::vector<unsigned int> target_component) DEAL_II_DEPRECATED; /** @@ -2564,7 +2569,7 @@ namespace DoFTools const DoFHandler<dim,spacedim> &fine_grid, const unsigned int fine_component, const InterGridMap<DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map, - std::vector<std::map<unsigned int, float> > &transfer_representation); + std::vector<std::map<types::global_dof_index, float> > &transfer_representation); /** * Create a mapping from degree @@ -2596,7 +2601,7 @@ namespace DoFTools template <class DH> void map_dof_to_boundary_indices (const DH &dof_handler, - std::vector<unsigned int> &mapping); + std::vector<types::global_dof_index> &mapping); /** * Same as the previous function, @@ -2615,7 +2620,7 @@ namespace DoFTools void map_dof_to_boundary_indices (const DH &dof_handler, const std::set<types::boundary_id> &boundary_indicators, - std::vector<unsigned int> &mapping); + std::vector<types::global_dof_index> &mapping); /** * Return a list of support @@ -2693,7 +2698,7 @@ namespace DoFTools void map_dofs_to_support_points (const Mapping<dim,spacedim> &mapping, const DoFHandler<dim,spacedim> &dof_handler, - std::map<unsigned int, Point<spacedim> > &support_points); + std::map<types::global_dof_index, Point<spacedim> > &support_points); /** * Same as the previous function but for the hp case. @@ -2702,7 +2707,7 @@ namespace DoFTools void map_dofs_to_support_points (const dealii::hp::MappingCollection<dim,spacedim> &mapping, const hp::DoFHandler<dim,spacedim> &dof_handler, - std::map<unsigned int, Point<spacedim> > &support_points); + std::map<types::global_dof_index, Point<spacedim> > &support_points); /** @@ -2738,7 +2743,7 @@ namespace DoFTools void map_support_points_to_dofs (const Mapping<DH::dimension, DH::space_dimension> &mapping, const DH &dof_handler, - std::map<Point<DH::space_dimension>, unsigned int, Comp> &point_to_index_map); + std::map<Point<DH::space_dimension>, types::global_dof_index, Comp> &point_to_index_map); /** * Map a coupling table from the @@ -3069,7 +3074,7 @@ namespace DoFTools map_support_points_to_dofs ( const Mapping<DH::dimension,DH::space_dimension> &mapping, const DH &dof_handler, - std::map<Point<DH::space_dimension>, unsigned int, Comp> &point_to_index_map) + std::map<Point<DH::space_dimension>, types::global_dof_index, Comp> &point_to_index_map) { // let the checking of arguments be // done by the function first @@ -3080,7 +3085,7 @@ namespace DoFTools // previous function into the // output arg point_to_index_map.clear (); - for (unsigned int i=0; i<dof_handler.n_dofs(); ++i) + for (types::global_dof_index i=0; i<dof_handler.n_dofs(); ++i) point_to_index_map[support_points[i]] = i; } } diff --git a/deal.II/include/deal.II/dofs/function_map.h b/deal.II/include/deal.II/dofs/function_map.h index 9be53de26f..f5f8d7fcab 100644 --- a/deal.II/include/deal.II/dofs/function_map.h +++ b/deal.II/include/deal.II/dofs/function_map.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__function_map_h #define __deal2__function_map_h diff --git a/deal.II/include/deal.II/dofs/number_cache.h b/deal.II/include/deal.II/dofs/number_cache.h index d9ba385082..223030d453 100644 --- a/deal.II/include/deal.II/dofs/number_cache.h +++ b/deal.II/include/deal.II/dofs/number_cache.h @@ -1,14 +1,19 @@ -//---------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 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__number_cache_h #define __deal2__number_cache_h @@ -55,7 +60,7 @@ namespace internal * processors that may * participate on this mesh. */ - unsigned int n_global_dofs; + types::global_dof_index n_global_dofs; /** * Number of dofs owned by @@ -64,7 +69,7 @@ namespace internal * computation, then this * equals n_global_dofs. */ - unsigned int n_locally_owned_dofs; + types::global_dof_index n_locally_owned_dofs; /** * An index set denoting the @@ -86,7 +91,7 @@ namespace internal * element equal to * n_global_dofs. */ - std::vector<unsigned int> n_locally_owned_dofs_per_processor; + std::vector<types::global_dof_index> n_locally_owned_dofs_per_processor; /** * The dofs owned by each of diff --git a/deal.II/include/deal.II/fe/block_mask.h b/deal.II/include/deal.II/fe/block_mask.h index e9616258d6..6a5da60d28 100644 --- a/deal.II/include/deal.II/fe/block_mask.h +++ b/deal.II/include/deal.II/fe/block_mask.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__fe_block_mask_h #define __deal2__fe_block_mask_h diff --git a/deal.II/include/deal.II/fe/component_mask.h b/deal.II/include/deal.II/fe/component_mask.h index 9512abe54f..0661aa2c63 100644 --- a/deal.II/include/deal.II/fe/component_mask.h +++ b/deal.II/include/deal.II/fe/component_mask.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__fe_component_mask_h #define __deal2__fe_component_mask_h diff --git a/deal.II/include/deal.II/fe/fe.h b/deal.II/include/deal.II/fe/fe.h index fbf458b9fe..8d52d8c943 100644 --- a/deal.II/include/deal.II/fe/fe.h +++ b/deal.II/include/deal.II/fe/fe.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__fe_h #define __deal2__fe_h @@ -1060,7 +1065,7 @@ public: * Given a base element number, return the first block of a BlockVector it * would generate. */ - unsigned int first_block_of_base (const unsigned int b) const; + types::global_dof_index first_block_of_base (const unsigned int b) const; /** * For each vector component, return which base element implements this @@ -1088,7 +1093,7 @@ public: /** * The vector block and the index inside the block for this shape function. */ - std::pair<unsigned int,unsigned int> + std::pair<unsigned int,types::global_dof_index> system_to_block_index (const unsigned int component) const; /** @@ -1986,7 +1991,7 @@ inline unsigned int FiniteElement<dim,spacedim>::element_multiplicity (const unsigned int index) const { - return base_to_block_indices.block_size(index); + return static_cast<unsigned int>(base_to_block_indices.block_size(index)); } @@ -2063,7 +2068,7 @@ FiniteElement<dim,spacedim>::face_system_to_base_index (const unsigned int index template <int dim, int spacedim> inline -unsigned int +types::global_dof_index FiniteElement<dim,spacedim>::first_block_of_base (const unsigned int index) const { return base_to_block_indices.block_start(index); @@ -2096,7 +2101,7 @@ FiniteElement<dim,spacedim>::block_to_base_index (const unsigned int index) cons template <int dim, int spacedim> inline -std::pair<unsigned int,unsigned int> +std::pair<unsigned int,types::global_dof_index> FiniteElement<dim,spacedim>::system_to_block_index (const unsigned int index) const { Assert (index < this->dofs_per_cell, @@ -2104,7 +2109,7 @@ FiniteElement<dim,spacedim>::system_to_block_index (const unsigned int index) co // The block is computed simply as // first block of this base plus // the index within the base blocks - return std::pair<unsigned int, unsigned int>( + return std::pair<unsigned int, types::global_dof_index>( first_block_of_base(system_to_base_table[index].first.first) + system_to_base_table[index].first.second, system_to_base_table[index].second); diff --git a/deal.II/include/deal.II/fe/fe_abf.h b/deal.II/include/deal.II/fe/fe_abf.h index 53409be33c..1a50681b30 100644 --- a/deal.II/include/deal.II/fe/fe_abf.h +++ b/deal.II/include/deal.II/fe/fe_abf.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 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__fe_abf_h #define __deal2__fe_abf_h diff --git a/deal.II/include/deal.II/fe/fe_base.h b/deal.II/include/deal.II/fe/fe_base.h index ddd8e1565d..f7e0de1021 100644 --- a/deal.II/include/deal.II/fe/fe_base.h +++ b/deal.II/include/deal.II/fe/fe_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__fe_base_h #define __deal2__fe_base_h diff --git a/deal.II/include/deal.II/fe/fe_bdm.h b/deal.II/include/deal.II/fe/fe_bdm.h index 41c35743f3..c3e1d675b5 100644 --- a/deal.II/include/deal.II/fe/fe_bdm.h +++ b/deal.II/include/deal.II/fe/fe_bdm.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__fe_bdm_h #define __deal2__fe_bdm_h diff --git a/deal.II/include/deal.II/fe/fe_dg_vector.h b/deal.II/include/deal.II/fe/fe_dg_vector.h index c85d98153f..0616694148 100644 --- a/deal.II/include/deal.II/fe/fe_dg_vector.h +++ b/deal.II/include/deal.II/fe/fe_dg_vector.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__fe_dg_vector_h #define __deal2__fe_dg_vector_h diff --git a/deal.II/include/deal.II/fe/fe_dg_vector.templates.h b/deal.II/include/deal.II/fe/fe_dg_vector.templates.h index 3ad5f4d89a..8639be4cdb 100644 --- a/deal.II/include/deal.II/fe/fe_dg_vector.templates.h +++ b/deal.II/include/deal.II/fe/fe_dg_vector.templates.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. +// +// --------------------------------------------------------------------- + #include <deal.II/fe/fe_dg_vector.h> #include <deal.II/fe/fe_tools.h> diff --git a/deal.II/include/deal.II/fe/fe_dgp.h b/deal.II/include/deal.II/fe/fe_dgp.h index 7b3bcdbbc1..7ea266a45e 100644 --- a/deal.II/include/deal.II/fe/fe_dgp.h +++ b/deal.II/include/deal.II/fe/fe_dgp.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2010, 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__fe_dgp_h #define __deal2__fe_dgp_h diff --git a/deal.II/include/deal.II/fe/fe_dgp_monomial.h b/deal.II/include/deal.II/fe/fe_dgp_monomial.h index 53d8334006..f6a585c334 100644 --- a/deal.II/include/deal.II/fe/fe_dgp_monomial.h +++ b/deal.II/include/deal.II/fe/fe_dgp_monomial.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 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__fe_dgp_monomial_h #define __deal2__fe_dgp_monomial_h diff --git a/deal.II/include/deal.II/fe/fe_dgp_nonparametric.h b/deal.II/include/deal.II/fe/fe_dgp_nonparametric.h index 87a68a53e8..46c5e740e5 100644 --- a/deal.II/include/deal.II/fe/fe_dgp_nonparametric.h +++ b/deal.II/include/deal.II/fe/fe_dgp_nonparametric.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2010, 2011, 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__fe_dgp_nonparametric_h #define __deal2__fe_dgp_nonparametric_h diff --git a/deal.II/include/deal.II/fe/fe_dgq.h b/deal.II/include/deal.II/fe/fe_dgq.h index f1109184c8..a07cf4f32d 100644 --- a/deal.II/include/deal.II/fe/fe_dgq.h +++ b/deal.II/include/deal.II/fe/fe_dgq.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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__fe_dgq_h #define __deal2__fe_dgq_h diff --git a/deal.II/include/deal.II/fe/fe_face.h b/deal.II/include/deal.II/fe/fe_face.h index 4fdddd2e07..a091042adb 100644 --- a/deal.II/include/deal.II/fe/fe_face.h +++ b/deal.II/include/deal.II/fe/fe_face.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__fe_face_h #define __deal2__fe_face_h diff --git a/deal.II/include/deal.II/fe/fe_nedelec.h b/deal.II/include/deal.II/fe/fe_nedelec.h index a66df95cfa..4a8fe4824b 100644 --- a/deal.II/include/deal.II/fe/fe_nedelec.h +++ b/deal.II/include/deal.II/fe/fe_nedelec.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2010, 2011, 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__fe_nedelec_h #define __deal2__fe_nedelec_h diff --git a/deal.II/include/deal.II/fe/fe_nothing.h b/deal.II/include/deal.II/fe/fe_nothing.h index 9ed2d3ca9f..785b443bf5 100644 --- a/deal.II/include/deal.II/fe/fe_nothing.h +++ b/deal.II/include/deal.II/fe/fe_nothing.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__fe_nothing_h #define __deal2__fe_nothing_h diff --git a/deal.II/include/deal.II/fe/fe_poly.h b/deal.II/include/deal.II/fe/fe_poly.h index 1ff0992513..0cee69105c 100644 --- a/deal.II/include/deal.II/fe/fe_poly.h +++ b/deal.II/include/deal.II/fe/fe_poly.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 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__fe_poly_h #define __deal2__fe_poly_h diff --git a/deal.II/include/deal.II/fe/fe_poly.templates.h b/deal.II/include/deal.II/fe/fe_poly.templates.h index f5ba25953e..bfcc19d3ac 100644 --- a/deal.II/include/deal.II/fe/fe_poly.templates.h +++ b/deal.II/include/deal.II/fe/fe_poly.templates.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. +// +// --------------------------------------------------------------------- + #include <deal.II/base/qprojector.h> #include <deal.II/base/polynomial_space.h> diff --git a/deal.II/include/deal.II/fe/fe_poly_face.h b/deal.II/include/deal.II/fe/fe_poly_face.h index 10ccec681b..b4e57deca0 100644 --- a/deal.II/include/deal.II/fe/fe_poly_face.h +++ b/deal.II/include/deal.II/fe/fe_poly_face.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__fe_poly_face_h #define __deal2__fe_poly_face_h diff --git a/deal.II/include/deal.II/fe/fe_poly_face.templates.h b/deal.II/include/deal.II/fe/fe_poly_face.templates.h index 513213aeed..39651c0170 100644 --- a/deal.II/include/deal.II/fe/fe_poly_face.templates.h +++ b/deal.II/include/deal.II/fe/fe_poly_face.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 <deal.II/base/qprojector.h> #include <deal.II/base/polynomial_space.h> diff --git a/deal.II/include/deal.II/fe/fe_poly_tensor.h b/deal.II/include/deal.II/fe/fe_poly_tensor.h index d39b407367..6d32646bda 100644 --- a/deal.II/include/deal.II/fe/fe_poly_tensor.h +++ b/deal.II/include/deal.II/fe/fe_poly_tensor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__fe_poly_tensor_h #define __deal2__fe_poly_tensor_h diff --git a/deal.II/include/deal.II/fe/fe_q.h b/deal.II/include/deal.II/fe/fe_q.h index 294daad459..74ba683ec7 100644 --- a/deal.II/include/deal.II/fe/fe_q.h +++ b/deal.II/include/deal.II/fe/fe_q.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__fe_q_h #define __deal2__fe_q_h diff --git a/deal.II/include/deal.II/fe/fe_q_base.h b/deal.II/include/deal.II/fe/fe_q_base.h index e3fe259c17..6f17bd38a4 100644 --- a/deal.II/include/deal.II/fe/fe_q_base.h +++ b/deal.II/include/deal.II/fe/fe_q_base.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__fe_q_base_h #define __deal2__fe_q_base_h diff --git a/deal.II/include/deal.II/fe/fe_q_dg0.h b/deal.II/include/deal.II/fe/fe_q_dg0.h index d01c6b22c8..6f0f339e01 100644 --- a/deal.II/include/deal.II/fe/fe_q_dg0.h +++ b/deal.II/include/deal.II/fe/fe_q_dg0.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: fe_q.h 29043 2013-03-26 19:51:19Z bangerth $ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__fe_q_dg0_h #define __deal2__fe_q_dg0_h diff --git a/deal.II/include/deal.II/fe/fe_q_hierarchical.h b/deal.II/include/deal.II/fe/fe_q_hierarchical.h index e53f5dab32..bed960dcc2 100644 --- a/deal.II/include/deal.II/fe/fe_q_hierarchical.h +++ b/deal.II/include/deal.II/fe/fe_q_hierarchical.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2010, 2011, 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__fe_q_hierarchical_h #define __deal2__fe_q_hierarchical_h diff --git a/deal.II/include/deal.II/fe/fe_q_iso_q1.h b/deal.II/include/deal.II/fe/fe_q_iso_q1.h index 7f4c5cc620..965aa7ca30 100644 --- a/deal.II/include/deal.II/fe/fe_q_iso_q1.h +++ b/deal.II/include/deal.II/fe/fe_q_iso_q1.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__fe_q_iso_q1_h #define __deal2__fe_q_iso_q1_h diff --git a/deal.II/include/deal.II/fe/fe_raviart_thomas.h b/deal.II/include/deal.II/fe/fe_raviart_thomas.h index 3303b6b7bf..0831bf5c2c 100644 --- a/deal.II/include/deal.II/fe/fe_raviart_thomas.h +++ b/deal.II/include/deal.II/fe/fe_raviart_thomas.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__fe_raviart_thomas_h #define __deal2__fe_raviart_thomas_h diff --git a/deal.II/include/deal.II/fe/fe_system.h b/deal.II/include/deal.II/fe/fe_system.h index 650dbc5a43..96a0d2dfbd 100644 --- a/deal.II/include/deal.II/fe/fe_system.h +++ b/deal.II/include/deal.II/fe/fe_system.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__fe_system_h #define __deal2__fe_system_h diff --git a/deal.II/include/deal.II/fe/fe_tools.h b/deal.II/include/deal.II/fe/fe_tools.h index fe54359e3d..0722155e82 100644 --- a/deal.II/include/deal.II/fe/fe_tools.h +++ b/deal.II/include/deal.II/fe/fe_tools.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__fe_tools_H #define __deal2__fe_tools_H @@ -160,8 +165,8 @@ namespace FETools template<int dim, int spacedim> void compute_block_renumbering ( const FiniteElement<dim,spacedim> &fe, - std::vector<unsigned int> &renumbering, - std::vector<unsigned int> &block_data, + std::vector<types::global_dof_index> &renumbering, + std::vector<types::global_dof_index> &block_data, bool return_start_indices = true); /** @@ -259,7 +264,7 @@ namespace FETools * For all possible (isotropic and anisotropic) refinement cases compute the * embedding matrices from a coarse cell to the child cells. Each column of * the resulting matrices contains the representation of a coarse grid basis - * functon by the fine grid basis; the matrices are split such that there is + * function by the fine grid basis; the matrices are split such that there is * one matrix for every child. * * This function computes the coarse grid function in a sufficiently large diff --git a/deal.II/include/deal.II/fe/fe_update_flags.h b/deal.II/include/deal.II/fe/fe_update_flags.h index b604931fdb..922f167960 100644 --- a/deal.II/include/deal.II/fe/fe_update_flags.h +++ b/deal.II/include/deal.II/fe/fe_update_flags.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__fe_update_flags_h #define __deal2__fe_update_flags_h diff --git a/deal.II/include/deal.II/fe/fe_values.h b/deal.II/include/deal.II/fe/fe_values.h index 4758c761c0..1b0164b656 100644 --- a/deal.II/include/deal.II/fe/fe_values.h +++ b/deal.II/include/deal.II/fe/fe_values.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__fe_values_h #define __deal2__fe_values_h @@ -166,7 +171,7 @@ namespace FEValuesViews * gradient is a * <code>Tensor@<1,dim@></code>. */ - typedef Tensor<1,spacedim> gradient_type; + typedef dealii::Tensor<1,spacedim> gradient_type; /** * A typedef for the type of second @@ -176,7 +181,7 @@ namespace FEValuesViews * Hessian is a * <code>Tensor@<2,dim@></code>. */ - typedef Tensor<2,spacedim> hessian_type; + typedef dealii::Tensor<2,spacedim> hessian_type; /** * A structure where for each shape @@ -453,7 +458,7 @@ namespace FEValuesViews * of <code>dim</code> components, the * value type is a Tensor<1,spacedim>. */ - typedef Tensor<1,spacedim> value_type; + typedef dealii::Tensor<1,spacedim> value_type; /** * A typedef for the type of gradients @@ -463,7 +468,7 @@ namespace FEValuesViews * finite element, the gradient is a * <code>Tensor@<2,spacedim@></code>. */ - typedef Tensor<2,spacedim> gradient_type; + typedef dealii::Tensor<2,spacedim> gradient_type; /** * A typedef for the type of @@ -512,7 +517,7 @@ namespace FEValuesViews * finite element, the Hessian is a * <code>Tensor@<3,dim@></code>. */ - typedef Tensor<3,spacedim> hessian_type; + typedef dealii::Tensor<3,spacedim> hessian_type; /** * A structure where for each shape @@ -985,7 +990,7 @@ namespace FEValuesViews * definition of the * divergence. */ - typedef Tensor<1, spacedim> divergence_type; + typedef dealii::Tensor<1, spacedim> divergence_type; /** * A structure where for each shape @@ -1198,6 +1203,270 @@ namespace FEValuesViews */ std::vector<ShapeFunctionData> shape_function_data; }; + + + template <int rank, int dim, int spacedim = dim> + class Tensor; + + /** + * A class representing a view to a set of + * <code>dim*dim</code> components forming a + * second-order tensor from a + * vector-valued finite + * element. Views are discussed in the + * @ref vector_valued module. + * + * This class allows to query the + * value and divergence of + * (components of) shape functions + * and solutions representing + * tensors. The + * divergence of a tensor + * $T_{ij}, 0\le i,j<\text{dim}$ is + * defined as + * $d_i = \sum_j \frac{\partial T_{ji}}{\partial x_j}, + * 0\le i<\text{dim}$. + * + * You get an object of this type if you + * apply a + * FEValuesExtractors::Tensor to + * an FEValues, FEFaceValues or + * FESubfaceValues object. + * + * @ingroup feaccess vector_valued + * + * @author Denis Davydov, 2013 + */ + template <int dim, int spacedim> + class Tensor<2,dim,spacedim> + { + public: + + /** + * Data type for what you get when you apply an extractor + * of this kind to a vector-valued finite element. + */ + typedef dealii::Tensor<2, spacedim> value_type; + + /** + * Data type for taking the divergence of a tensor: a vector. + */ + typedef dealii::Tensor<1, spacedim> divergence_type; + + /** + * A structure where for each shape + * function we pre-compute a bunch of + * data that will make later accesses + * much cheaper. + */ + struct ShapeFunctionData + { + /** + * For each pair (shape + * function,component within + * vector), store whether the + * selected vector component may be + * nonzero. For primitive shape + * functions we know for sure + * whether a certain scalar + * component of a given shape + * function is nonzero, whereas for + * non-primitive shape functions + * this may not be entirely clear + * (e.g. for RT elements it depends + * on the shape of a cell). + */ + bool is_nonzero_shape_function_component[value_type::n_independent_components]; + + /** + * For each pair (shape function, + * component within vector), store + * the row index within the + * shape_values, shape_gradients, + * and shape_hessians tables (the + * column index is the quadrature + * point index). If the shape + * function is primitive, then we + * can get this information from + * the shape_function_to_row_table + * of the FEValues object; + * otherwise, we have to work a bit + * harder to compute this + * information. + */ + unsigned int row_index[value_type::n_independent_components]; + + /** + * For each shape function say the + * following: if only a single + * entry in + * is_nonzero_shape_function_component + * for this shape function is + * nonzero, then store the + * corresponding value of row_index + * and + * single_nonzero_component_index + * represents the index between 0 + * and (dim^2) for which it is + * attained. If multiple components + * are nonzero, then store -1. If + * no components are nonzero then + * store -2. + */ + int single_nonzero_component; + unsigned int single_nonzero_component_index; + }; + + /** + * Default constructor. Creates an + * invalid object. + */ + Tensor(); + + + /** + * Constructor for an object that + * represents <code>(dim*dim)</code> + * components of a + * FEValuesBase object (or of one of + * the classes derived from + * FEValuesBase), representing the unique + * components comprising a second-order + * tensor valued variable. + * + * The second argument denotes the + * index of the first component of the + * selected symmetric second order tensor. + */ + Tensor(const FEValuesBase<dim, spacedim> &fe_values_base, + const unsigned int first_tensor_component); + + + /** + * Copy operator. This is not a + * lightweight object so we don't allow + * copying and generate an exception if + * this function is called. + */ + Tensor &operator=(const Tensor<2, dim, spacedim> &); + + /** + * Return the value of the vector + * components selected by this view, + * for the shape function and + * quadrature point selected by the + * arguments. Here, since the view + * represents a vector-valued part of + * the FEValues object with + * <code>(dim*dim)</code> components + * (the unique components of a second-order tensor), + * the return type is a tensor of rank 2. + * + * @param shape_function Number + * of the shape function to be + * evaluated. Note that this + * number runs from zero to + * dofs_per_cell, even in the + * case of an FEFaceValues or + * FESubfaceValues object. + * + * @param q_point Number of + * the quadrature point at which + * function is to be evaluated + */ + value_type + value (const unsigned int shape_function, + const unsigned int q_point) const; + + /** + * Return the vector divergence of + * the vector components selected by + * this view, for the shape function + * and quadrature point selected by the + * arguments. + * + * See the general discussion + * of this class for a + * definition of the + * divergence. + * + * @note The meaning of the arguments + * is as documented for the value() + * function. + */ + divergence_type + divergence (const unsigned int shape_function, + const unsigned int q_point) const; + + /** + * Return the values of the selected + * vector components of the finite + * element function characterized by + * <tt>fe_function</tt> at the + * quadrature points of the cell, face + * or subface selected the last time + * the <tt>reinit</tt> function of the + * FEValues object was called. + * + * This function is the equivalent of + * the + * FEValuesBase::get_function_values + * function but it only works on the + * selected vector components. + */ + template <class InputVector> + void get_function_values (const InputVector &fe_function, + std::vector<value_type> &values) const; + + + /** + * Return the divergence of the selected + * vector components of the finite + * element function characterized by + * <tt>fe_function</tt> at the + * quadrature points of the cell, face + * or subface selected the last time + * the <tt>reinit</tt> function of the + * FEValues object was called. + * + * There is no equivalent function such + * as + * FEValuesBase::get_function_divergences + * in the FEValues classes but the + * information can be obtained from + * FEValuesBase::get_function_gradients, + * of course. + * + * See the general discussion + * of this class for a + * definition of the + * divergence. + */ + template <class InputVector> + void get_function_divergences (const InputVector &fe_function, + std::vector<divergence_type> &divergences) const; + + private: + /** + * A reference to the FEValuesBase object + * we operate on. + */ + const FEValuesBase<dim, spacedim> &fe_values; + + /** + * The first component of the vector + * this view represents of the + * FEValuesBase object. + */ + const unsigned int first_tensor_component; + + /** + * Store the data about shape + * functions. + */ + std::vector<ShapeFunctionData> shape_function_data; + }; + } @@ -1229,6 +1498,8 @@ namespace internal std::vector<dealii::FEValuesViews::Vector<dim,spacedim> > vectors; std::vector<dealii::FEValuesViews::SymmetricTensor<2,dim,spacedim> > symmetric_second_order_tensors; + std::vector<dealii::FEValuesViews::Tensor<2,dim,spacedim> > + second_order_tensors; /** * Constructor. @@ -2033,7 +2304,7 @@ public: */ template <class InputVector, typename number> void get_function_values (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<number> &values) const; /** @@ -2076,7 +2347,7 @@ public: */ template <class InputVector, typename number> void get_function_values (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Vector<number> > &values) const; @@ -2140,7 +2411,7 @@ public: */ template <class InputVector> void get_function_values (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, VectorSlice<std::vector<std::vector<double> > > values, const bool quadrature_points_fastest) const; @@ -2264,7 +2535,7 @@ public: */ template <class InputVector> void get_function_gradients (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Tensor<1,spacedim> > &gradients) const; /** @@ -2275,7 +2546,7 @@ public: */ template <class InputVector> void get_function_gradients (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, VectorSlice<std::vector<std::vector<Tensor<1,spacedim> > > > gradients, bool quadrature_points_fastest = false) const; @@ -2301,7 +2572,7 @@ public: */ template <class InputVector> void get_function_grads (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Tensor<1,spacedim> > &gradients) const DEAL_II_DEPRECATED; /** @@ -2310,7 +2581,7 @@ public: */ template <class InputVector> void get_function_grads (const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<std::vector<Tensor<1,spacedim> > > &gradients, bool quadrature_points_fastest = false) const DEAL_II_DEPRECATED; @@ -2441,7 +2712,7 @@ public: template <class InputVector> void get_function_hessians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Tensor<2,spacedim> > &hessians) const; /** @@ -2454,7 +2725,7 @@ public: template <class InputVector> void get_function_hessians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, VectorSlice<std::vector<std::vector<Tensor<2,spacedim> > > > hessians, bool quadrature_points_fastest = false) const; @@ -2606,7 +2877,7 @@ public: template <class InputVector, typename number> void get_function_laplacians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<number> &laplacians) const; /** @@ -2619,7 +2890,7 @@ public: template <class InputVector, typename number> void get_function_laplacians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Vector<number> > &laplacians) const; /** @@ -2632,7 +2903,7 @@ public: template <class InputVector, typename number> void get_function_laplacians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<std::vector<number> > &laplacians, bool quadrature_points_fastest = false) const; //@} @@ -2832,6 +3103,21 @@ public: const FEValuesViews::SymmetricTensor<2,dim,spacedim> & operator[] (const FEValuesExtractors::SymmetricTensor<2> &tensor) const; + + /** + * Create a view of the current FEValues + * object that represents a set of + * <code>(dim*dim)</code> scalar components + * (i.e. a 2nd order tensor) + * of the vector-valued + * finite element. The concept of views + * is explained in the documentation of + * the namespace FEValuesViews and in particular + * in the @ref vector_valued module. + */ + const FEValuesViews::Tensor<2,dim,spacedim> & + operator[] (const FEValuesExtractors::Tensor<2> &tensor) const; + //@} /// @name Access to the raw data @@ -3134,6 +3420,7 @@ private: template <int, int> friend class FEValuesViews::Scalar; template <int, int> friend class FEValuesViews::Vector; template <int, int, int> friend class FEValuesViews::SymmetricTensor; + template <int, int, int> friend class FEValuesViews::Tensor; }; @@ -4098,7 +4385,7 @@ namespace FEValuesViews inline dealii::SymmetricTensor<2,1> symmetrize_single_row (const unsigned int n, - const Tensor<1,1> &t) + const dealii::Tensor<1,1> &t) { Assert (n < 1, ExcIndexRange (n, 0, 1)); (void)n; // removes -Wunused-parameter warning in optimized mode @@ -4111,7 +4398,7 @@ namespace FEValuesViews inline dealii::SymmetricTensor<2,2> symmetrize_single_row (const unsigned int n, - const Tensor<1,2> &t) + const dealii::Tensor<1,2> &t) { switch (n) { @@ -4137,7 +4424,7 @@ namespace FEValuesViews inline dealii::SymmetricTensor<2,3> symmetrize_single_row (const unsigned int n, - const Tensor<1,3> &t) + const dealii::Tensor<1,3> &t) { switch (n) { @@ -4318,7 +4605,7 @@ namespace FEValuesViews // b_jj := \dfrac{\partial phi_{ii,jj}}{\partial x_jj}. // again, all other entries of 'b' are // zero - const Tensor<1, spacedim> phi_grad = fe_values.shape_gradients[snc][q_point]; + const dealii::Tensor<1, spacedim> phi_grad = fe_values.shape_gradients[snc][q_point]; divergence_type return_value; return_value[ii] = phi_grad[jj]; @@ -4337,6 +4624,115 @@ namespace FEValuesViews } } + template <int dim, int spacedim> + inline + typename Tensor<2, dim, spacedim>::value_type + Tensor<2, dim, spacedim>::value (const unsigned int shape_function, + const unsigned int q_point) const + { + typedef FEValuesBase<dim,spacedim> FVB; + Assert (shape_function < fe_values.fe->dofs_per_cell, + ExcIndexRange (shape_function, 0, fe_values.fe->dofs_per_cell)); + Assert (fe_values.update_flags & update_values, + typename FVB::ExcAccessToUninitializedField()); + + // similar to the vector case where we + // have more then one index and we need + // to convert between unrolled and + // component indexing for tensors + const int snc + = shape_function_data[shape_function].single_nonzero_component; + + if (snc == -2) + { + // shape function is zero for the + // selected components + return value_type(); + + } + else if (snc != -1) + { + value_type return_value; + const unsigned int comp = + shape_function_data[shape_function].single_nonzero_component_index; + const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); + return_value[indices] = fe_values.shape_values(snc,q_point); + return return_value; + } + else + { + value_type return_value; + for (unsigned int d = 0; d < dim*dim; ++d) + if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) + { + const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(d); + return_value[indices] + = fe_values.shape_values(shape_function_data[shape_function].row_index[d],q_point); + } + return return_value; + } + } + + + template <int dim, int spacedim> + inline + typename Tensor<2, dim, spacedim>::divergence_type + Tensor<2, dim, spacedim>::divergence(const unsigned int shape_function, + const unsigned int q_point) const + { + typedef FEValuesBase<dim,spacedim> FVB; + Assert (shape_function < fe_values.fe->dofs_per_cell, + ExcIndexRange (shape_function, 0, fe_values.fe->dofs_per_cell)); + Assert (fe_values.update_flags & update_gradients, + typename FVB::ExcAccessToUninitializedField()); + + const int snc = shape_function_data[shape_function].single_nonzero_component; + + if (snc == -2) + { + // shape function is zero for the + // selected components + return divergence_type(); + } + else if (snc != -1) + { + // we have a single non-zero component + // when the tensor is + // represented in unrolled form. + // + // the divergence of a second-order tensor + // is a first order tensor. + // + // assume the second-order tensor is + // A with components A_{ij}. + // divergence as: + // b_j := \dfrac{\partial phi_{ij}}{\partial x_i}. + // + // Now, we know the nonzero component + // in unrolled form: it is indicated + // by 'snc'. we can figure out which + // tensor components belong to this: + const unsigned int comp = + shape_function_data[shape_function].single_nonzero_component_index; + 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]; + + const dealii::Tensor<1, spacedim> phi_grad = fe_values.shape_gradients[snc][q_point]; + + divergence_type return_value; + return_value[jj] = phi_grad[ii]; + + return return_value; + + } + else + { + Assert (false, ExcNotImplemented()); + divergence_type return_value; + return return_value; + } + } } @@ -4388,6 +4784,21 @@ operator[] (const FEValuesExtractors::SymmetricTensor<2> &tensor) const return fe_values_views_cache.symmetric_second_order_tensors[tensor.first_tensor_component]; } +template <int dim, int spacedim> +inline +const FEValuesViews::Tensor<2,dim,spacedim> & +FEValuesBase<dim,spacedim>:: +operator[] (const FEValuesExtractors::Tensor<2> &tensor) const +{ + Assert (tensor.first_tensor_component < + fe_values_views_cache.second_order_tensors.size(), + ExcIndexRange (tensor.first_tensor_component, + 0, fe_values_views_cache.second_order_tensors.size())); + + return fe_values_views_cache.second_order_tensors[tensor.first_tensor_component]; +} + + template <int dim, int spacedim> @@ -4783,7 +5194,7 @@ inline void FEValuesBase<dim,spacedim>::get_function_grads ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Tensor<1,spacedim> > &values) const { get_function_gradients(fe_function, indices, values); @@ -4810,7 +5221,7 @@ inline void FEValuesBase<dim,spacedim>::get_function_grads ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<std::vector<Tensor<1,spacedim> > > &values, bool q_points_fastest) const { diff --git a/deal.II/include/deal.II/fe/fe_values_extractors.h b/deal.II/include/deal.II/fe/fe_values_extractors.h index 5d85836b08..882399aad1 100644 --- a/deal.II/include/deal.II/fe/fe_values_extractors.h +++ b/deal.II/include/deal.II/fe/fe_values_extractors.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__fe_values_extractors_h #define __deal2__fe_values_extractors_h @@ -200,6 +205,61 @@ namespace FEValuesExtractors */ SymmetricTensor (const unsigned int first_tensor_component); }; + + + /** + * Extractor for a (possible non-)symmetric tensor of a + * rank specified by the template + * argument. For a second order + * tensor, this represents a collection of + * <code>(dim*dim)</code> + * components of a vector-valued + * element. The value of <code>dim</code> + * is defined by the FEValues object the + * extractor is applied to. The result of + * applying an object of this type to an + * FEValues, FEFaceValues or + * FESubfaceValues object is of type + * FEValuesViews::Tensor. + * + * The concept of + * extractors is defined in the + * documentation of the namespace + * FEValuesExtractors and in the @ref + * vector_valued module. + * + * @ingroup feaccess vector_valued + * + * @author Denis Davydov, 2013 + */ + template <int rank> + struct Tensor + { + /** + * The first component of the tensor + * view. + */ + unsigned int first_tensor_component; + + /** + * Default constructor. Initialize the + * object with an invalid component. This leads to + * an object that can not be used, but it allows + * objects of this kind to be put into arrays that + * require a default constructor upon resizing the + * array, and then later assigning a suitable + * object to each element of the array. + */ + Tensor (); + + /** + * Constructor. Take the first + * component of the selected tensor + * inside the FEValues object as + * argument. + */ + Tensor (const unsigned int first_tensor_component); + }; } @@ -251,6 +311,22 @@ namespace FEValuesExtractors : first_tensor_component (first_tensor_component) {} + + + template <int rank> + inline + Tensor<rank>::Tensor () + : + first_tensor_component(numbers::invalid_unsigned_int) + {} + + + template <int rank> + inline + Tensor<rank>::Tensor (const unsigned int first_tensor_component) + : + first_tensor_component (first_tensor_component) + {} } diff --git a/deal.II/include/deal.II/fe/mapping.h b/deal.II/include/deal.II/fe/mapping.h index 74906f3107..f93a0cdf05 100644 --- a/deal.II/include/deal.II/fe/mapping.h +++ b/deal.II/include/deal.II/fe/mapping.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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_h #define __deal2__mapping_h diff --git a/deal.II/include/deal.II/fe/mapping_c1.h b/deal.II/include/deal.II/fe/mapping_c1.h index a56e3c24d5..85f900bf28 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 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..484963727b 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 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..4d4ba9cc9c 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 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 <deal.II/base/config.h> +#include <deal.II/base/exceptions.h> + +#include <vector> + + +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<unsigned char> 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<unsigned char> 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.size(); ++i) + os << static_cast<int>(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<idsize; ++i) + { + is >> 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 <class Iterator> 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 <class Iterator> 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 <class Iterator> 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 <class Iterator> 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 <class Iterator> 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 <class Iterator> + 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 <class Iterator> bool operator () (const Iterator &i) const; @@ -808,7 +796,11 @@ inline FilteredIterator<BaseIterator>:: FilteredIterator (const FilteredIterator &fi) : - BaseIterator (static_cast<BaseIterator>(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 <class Iterator> + 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 96ab4a635a..3967669860 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 @@ -51,6 +56,11 @@ template <typename number> class SparseMatrix; class 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 @@ -261,7 +271,7 @@ public: static void subdivided_parallelepiped (Triangulation<dim> &tria, - const unsigned int n_subdivisions, + const size_type n_subdivisions, const Point<dim> (&corners) [dim], const bool colorize = false); @@ -277,7 +287,7 @@ public: static void subdivided_parallelepiped (Triangulation<dim> &tria, - const unsigned int ( n_subdivisions) [dim], + const size_type ( n_subdivisions) [dim], const Point<dim> (&corners) [dim], const bool colorize = false); @@ -485,7 +495,7 @@ public: const Point<dim> &center, const double inner_radius, const double outer_radius, - const unsigned int n_cells = 0, + const size_type n_cells = 0, bool colorize = false); /** @@ -514,7 +524,7 @@ public: const Point<dim> &center, const double inner_radius, const double outer_radius, - const unsigned int n_cells = 0, + const size_type n_cells = 0, const bool colorize = false); @@ -543,7 +553,7 @@ public: const Point<dim> &center, const double inner_radius, const double outer_radius, - const unsigned int n_cells = 0, + const size_type n_cells = 0, const bool colorize = false); /** @@ -563,8 +573,8 @@ public: 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); + const size_type n_radial_cells = 0, + const size_type n_axial_cells = 0); @@ -602,7 +612,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, @@ -616,7 +626,7 @@ public: const double inner_radius = .25, const double outer_radius = .5, const double L = .5, - const unsigned int repetition = 1, + const size_type repetition = 1, const bool colorize = false); /** @@ -630,7 +640,7 @@ public: * @param r The radius of the cylinder bend together as loop. */ static void moebius (Triangulation<3,3> &tria, - const unsigned int n_cells, + const size_type n_cells, const unsigned int n_rotations, const double R, const double r); @@ -682,8 +692,8 @@ public: */ static void - extrude_triangulation(const Triangulation<2, 2> & input, - const unsigned int n_slices, + extrude_triangulation(const Triangulation<2, 2> &input, + const size_type n_slices, const double height, Triangulation<3,3> &result); @@ -704,7 +714,7 @@ public: template <int dim> static void laplace_transformation (Triangulation<dim> &tria, - const std::map<unsigned int,Point<dim> > &new_points) DEAL_II_DEPRECATED; + const std::map<size_type,Point<dim> > &new_points) DEAL_II_DEPRECATED; /** * Exception @@ -782,7 +792,7 @@ private: static void laplace_solve (const SparseMatrix<double> &S, - const std::map<unsigned int,double> &m, + const std::map<size_type,double> &m, Vector<double> &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 <int dim, int spacedim> void write_svg (const Triangulation<dim,spacedim> &tria, @@ -1091,7 +1100,7 @@ public: */ template <int dim> void write_mathgl (const Triangulation<dim> &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..1df740cff6 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 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 ce1fa0c4a8..adb735e58a 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 @@ -1470,7 +1475,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. * @@ -1485,7 +1490,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. * @@ -1501,7 +1506,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. * @@ -1519,7 +1524,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. * @@ -1544,7 +1549,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. * @@ -1567,7 +1572,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. * @@ -2106,7 +2111,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 @@ -2236,7 +2241,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. * @@ -2254,7 +2259,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. * @@ -2640,8 +2645,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 + * <code>end_active(level)</code> 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; @@ -2662,10 +2675,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 - * <tt>end()</tt>. + * 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 <tt>end()</tt>. */ active_cell_iterator end_active (const unsigned int level) const; @@ -2676,23 +2688,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; /*@}*/ /*---------------------------------------*/ @@ -3234,7 +3234,7 @@ public: */ DeclException0 (ExcTriangulationNotEmpty); /** - * Trying to re-read a grid, an error occured. + * Trying to re-read a grid, an error occurred. * * @ingroup Exceptions */ @@ -3554,7 +3554,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<dim> *faces; @@ -3826,7 +3826,7 @@ Triangulation<dim,spacedim>::load (Archive &ar, // as discussed in the documentation, do // not store the signals as well as - // boundary and manifold descrption + // boundary and manifold description // but everything else ar &smooth_grid; ar &levels; diff --git a/deal.II/include/deal.II/grid/tria_accessor.h b/deal.II/include/deal.II/grid/tria_accessor.h index 32db0f30fb..6705f5ded3 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,6 +24,7 @@ #include <deal.II/base/point.h> #include <deal.II/grid/tria_iterator_base.h> #include <deal.II/grid/tria_iterator_selector.h> +#include <deal.II/grid/cell_id.h> namespace std @@ -318,7 +324,7 @@ protected: TriaAccessorBase (const Triangulation<dim,spacedim> *parent = 0, const int level = -1, const int index = -1, - const AccessorData * = 0); + const AccessorData * = 0); /** * Copy constructor. Creates an @@ -345,6 +351,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 @@ -2833,6 +2847,14 @@ public: * See the @ref GlossSubdomainId * "glossary" for more * information. + * + * @note The subdomain of a cell is a property only defined + * for active cells, i.e., cells that are not further + * refined. Consequently, you can only call this function if + * the cell it refers to has no children. For multigrid + * methods in parallel, it is also important to know which + * processor owns non-active cells, and for this you can call + * level_subdomain_id(). */ types::subdomain_id subdomain_id () const; @@ -2847,6 +2869,14 @@ public: * use a * parallel::distributed::Triangulation * object. + * + * @note The subdomain of a cell is a property only defined + * for active cells, i.e., cells that are not further + * refined. Consequently, you can only call this function if + * the cell it refers to has no children. For multigrid + * methods in parallel, it is also important to know which + * processor owns non-active cells, and for this you can call + * level_subdomain_id(). */ void set_subdomain_id (const types::subdomain_id new_subdomain_id) const; @@ -2862,10 +2892,13 @@ public: /** - * Set the subdomain id of this - * cell and all its children (and - * grand-children, and so on) to - * the given value. + * Set the subdomain id of this cell (if it is active) or all its terminal + * children (and grand-children, and so on, as long as they have no children + * of their own) to the given value. Since the subdomain id is a concept + * that is only defined for cells that are active (i.e., have no children + * of their own), this function only sets the subdomain ids for all + * children and grand children of this cell that are actually active, + * skipping intermediate child cells. * * See the @ref GlossSubdomainId * "glossary" for more @@ -2873,7 +2906,8 @@ public: * should not be called if you * use a * parallel::distributed::Triangulation - * object. + * object since there the subdomain id is implicitly defined by which + * processor you're on. */ void recursively_set_subdomain_id (const types::subdomain_id new_subdomain_id) const; /** @@ -2900,7 +2934,8 @@ public: /** * Return an iterator to the - * parent. + * parent. Throws an exception if this cell has no parent, i.e. has + * level 0. */ TriaIterator<CellAccessor<dim,spacedim> > parent () const; @@ -2926,6 +2961,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<dim, spacedim> &other) const; + + /** * Return whether this cell is owned by the current processor * or is owned by another processor. The function always returns @@ -2940,9 +2985,21 @@ public: * * @post The returned value is equal to <code>!is_ghost() && * !is_artificial()</code>. - **/ + * + * @note Whether a cell is a ghost cell, artificial, or is + * locally owned or is a property that only pertains to cells + * that are active. Consequently, + * you can only call this function if the cell it refers to has + * no children. + */ 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 @@ -2969,6 +3026,12 @@ public: * @post The returned value is equal to * <code>!is_locally_owned() && * !is_artificial()</code>. + * + * @note Whether a cell is a ghost cell, artificial, or is + * locally owned or is a property that only pertains to cells + * that are active. Consequently, + * you can only call this function if the cell it refers to has + * no children. */ bool is_ghost () const; @@ -3007,6 +3070,12 @@ public: * @post The returned value is equal to * <code>!is_ghost() && * !is_artificial()</code>. + * + * @note Whether a cell is a ghost cell, artificial, or is + * locally owned or is a property that only pertains to cells + * that are active. Consequently, + * you can only call this function if the cell it refers to has + * no children. */ bool is_artificial () const; @@ -3051,6 +3120,15 @@ public: void set_neighbor (const unsigned int i, const TriaIterator<CellAccessor<dim, spacedim> > &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; + /** * @} */ @@ -3231,6 +3309,39 @@ CellAccessor (const TriaAccessor<structdim2,dim2,spacedim2> &) "the conversion is not valid in the current context.")); } +template <int dim, int spacedim> +CellId +CellAccessor<dim,spacedim>::id() const +{ + std::vector<unsigned char> id(this->level(), -1); + unsigned int coarse_index; + + CellAccessor<dim,spacedim> 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; c<ptr.parent()->n_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 be5a6c8fb1..6e153eb075 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<structdim,dim,spacedim>::operator != (const TriaAccessorBase<st +template <int structdim, int dim, int spacedim> +inline +bool +TriaAccessorBase<structdim,dim,spacedim>::operator < (const TriaAccessorBase<structdim,dim,spacedim> &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 <int structdim, int dim, int spacedim> inline int @@ -2989,11 +3010,11 @@ inline bool CellAccessor<dim,spacedim>::is_locally_owned () const { + Assert (this->active(), ExcMessage("is_locally_owned() only works on active cells!")); #ifndef DEAL_II_WITH_P4EST return true; #else - const types::subdomain_id subdomain = this->subdomain_id(); - if (subdomain == numbers::artificial_subdomain_id) + if (is_artificial()) return false; const parallel::distributed::Triangulation<dim,spacedim> *pdt @@ -3002,7 +3023,26 @@ CellAccessor<dim,spacedim>::is_locally_owned () const if (pdt == 0) return true; else - return (subdomain == pdt->locally_owned_subdomain()); + return (this->subdomain_id() == pdt->locally_owned_subdomain()); +#endif +} + + +template <int dim, int spacedim> +inline +bool +CellAccessor<dim,spacedim>::is_locally_owned_on_level () const +{ +#ifndef DEAL_II_WITH_P4EST + return true; +#else + const parallel::distributed::Triangulation<dim,spacedim> *pdt + = dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim> *>(this->tria); + + if (pdt == 0) + return true; + else + return (this->level_subdomain_id() == pdt->locally_owned_subdomain()); #endif } @@ -3012,11 +3052,11 @@ inline bool CellAccessor<dim,spacedim>::is_ghost () const { + Assert (this->active(), ExcMessage("is_ghost() only works on active cells!")); #ifndef DEAL_II_WITH_P4EST return false; #else - const types::subdomain_id subdomain = this->subdomain_id(); - if (subdomain == numbers::artificial_subdomain_id) + if (is_artificial() || this->has_children()) return false; const parallel::distributed::Triangulation<dim,spacedim> *pdt @@ -3025,7 +3065,7 @@ CellAccessor<dim,spacedim>::is_ghost () const if (pdt == 0) return false; else - return (subdomain != pdt->locally_owned_subdomain()); + return (this->subdomain_id() != pdt->locally_owned_subdomain()); #endif } @@ -3036,10 +3076,11 @@ inline bool CellAccessor<dim,spacedim>::is_artificial () const { + Assert (this->active(), ExcMessage("is_artificial() only works on active cells!")); #ifndef DEAL_II_WITH_P4EST return false; #else - return (this->subdomain_id() == numbers::artificial_subdomain_id); + return this->subdomain_id() == numbers::artificial_subdomain_id; #endif } @@ -3060,6 +3101,26 @@ CellAccessor<dim,spacedim>::neighbor_face_no (const unsigned int neighbor) const return neighbor_of_coarser_neighbor(neighbor).first; } + +template <int dim, int spacedim> +inline +bool +CellAccessor<dim,spacedim>::operator < (const CellAccessor<dim,spacedim> &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<dim,dim,spacedim>::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..ba83065200 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 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 <typename OtherAccessor> - 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)<level(b) or - * (level(a)==level(b) and index(a)<index(b)). + * Ordering relation for iterators. + * + * This relation attempts a total ordering of cells. For lower + * dimensional objects on distributed meshes, we only attempt a + * partial ordering. + * + * The relation is defined as follows: + * + * For objects of <tt>Accessor::structure_dimension < + * Accessor::dimension</tt>, 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): + * + * <ol> + * <li> The past-the-end iterator is always ordered last. Two + * past-the-end iterators rank the same, thus false is returned in + * that case.</li> + * + * <li> The level subdomain id</li> + * <li> If both cells are active, the subdomain id.</li> + * <li> The level of the cell.</li> + * <li> The index of a cell inside the level.</li> + * </ol> */ 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 <typename OtherAccessor> + explicit TriaIterator (const OtherAccessor &a); + /** * This is a conversion operator * (constructor) which takes another @@ -1155,39 +1182,21 @@ TriaRawIterator<Accessor>::state () const template <typename Accessor> inline bool -TriaRawIterator<Accessor>::operator < (const TriaRawIterator &i) const +TriaRawIterator<Accessor>::operator < (const TriaRawIterator<Accessor> &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<Accessor>::TriaIterator (const TriaRawIterator<OtherAccessor> &i) #endif } - +template <typename Accessor> +template <typename OtherAccessor> +TriaIterator<Accessor>::TriaIterator (const OtherAccessor &a) + : + TriaRawIterator<Accessor> (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 <typename Accessor> template <typename OtherAccessor> 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 6c58fa78f6..22965b0918 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, 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__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..bc7129518d 100644 --- a/deal.II/include/deal.II/hp/dof_faces.h +++ b/deal.II/include/deal.II/hp/dof_faces.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $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 @@ -43,7 +48,7 @@ namespace internal * 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 @@ -81,7 +86,7 @@ namespace internal /** * 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 treted separately, don't do anything. * * @ingroup hp * @author Tobias Leicht, 2006 diff --git a/deal.II/include/deal.II/hp/dof_handler.h b/deal.II/include/deal.II/hp/dof_handler.h index e9c7928db9..1baba27526 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 @@ -136,7 +141,7 @@ namespace hp * certain value, but rather take * its symbolic name. */ - static const unsigned int invalid_dof_index = numbers::invalid_unsigned_int; + static const types::global_dof_index invalid_dof_index = numbers::invalid_dof_index; /** * The default index of the @@ -254,7 +259,7 @@ namespace hp * number of the degree of * freedom referenced. */ - void renumber_dofs (const std::vector<unsigned int> &new_numbers); + void renumber_dofs (const std::vector<types::global_dof_index> &new_numbers); /** * Return the maximum number of @@ -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 + * <code>end_active(level)</code> 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 <tt>end()</tt>. - */ + * 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 <tt>end()</tt>. + */ 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. */ - unsigned int n_dofs () const; + types::global_dof_index n_dofs () const; /** * The number of multilevel @@ -389,13 +400,13 @@ namespace hp * numbers::invalid_unsigned * int independent of its argument. */ - unsigned int n_dofs(const unsigned int level) const; + types::global_dof_index n_dofs(const unsigned int level) const; /** * Return the number of degrees of freedom * located on the boundary. */ - unsigned int n_boundary_dofs () const; + types::global_dof_index n_boundary_dofs () const; /** * Return the number of degrees @@ -410,7 +421,7 @@ namespace hp * @p make_boundary_sparsity_pattern * function. */ - unsigned int + types::global_dof_index n_boundary_dofs (const FunctionMap &boundary_indicators) const; /** @@ -421,7 +432,7 @@ namespace hp * indicators under * consideration. */ - unsigned int + types::global_dof_index n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const; /** @@ -454,7 +465,7 @@ namespace hp * cells are also not necessarily * included. */ - unsigned int n_locally_owned_dofs() const; + types::global_dof_index n_locally_owned_dofs() const; /** * Return an IndexSet describing @@ -512,7 +523,7 @@ namespace hp * then the vector has a single * element equal to n_dofs(). */ - const std::vector<unsigned int> & + const std::vector<types::global_dof_index> & n_locally_owned_dofs_per_processor () const; /** @@ -577,7 +588,7 @@ namespace hp * Exception */ DeclException1 (ExcNewNumbersNotConsecutive, - int, + types::global_dof_index, << "The given list of new dof indices is not consecutive: " << "the index " << arg1 << " does not exist."); /** @@ -662,8 +673,8 @@ namespace hp public: MGVertexDoFs (); ~MGVertexDoFs (); - unsigned int get_index (const unsigned int level, const unsigned int dof_number) const; - void set_index (const unsigned int level, const unsigned int dof_number, const unsigned int index); + types::global_dof_index get_index (const unsigned int level, const unsigned int dof_number) const; + void set_index (const unsigned int level, const unsigned int dof_number, const types::global_dof_index index); }; /** @@ -672,10 +683,10 @@ namespace hp void clear_space (); template<int structdim> - unsigned int get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const; + types::global_dof_index get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const; template<int structdim> - void set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index) const; + void set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index) const; /** * Create default tables for @@ -716,7 +727,7 @@ namespace hp * distribute_dofs(). */ void - compute_vertex_dof_identities (std::vector<unsigned int> &new_dof_indices) const; + compute_vertex_dof_identities (std::vector<types::global_dof_index> &new_dof_indices) const; /** * Compute identities between @@ -725,7 +736,7 @@ namespace hp * distribute_dofs(). */ void - compute_line_dof_identities (std::vector<unsigned int> &new_dof_indices) const; + compute_line_dof_identities (std::vector<types::global_dof_index> &new_dof_indices) const; /** * Compute identities between @@ -734,7 +745,7 @@ namespace hp * distribute_dofs(). */ void - compute_quad_dof_identities (std::vector<unsigned int> &new_dof_indices) const; + compute_quad_dof_identities (std::vector<types::global_dof_index> &new_dof_indices) const; /** * Renumber the objects with @@ -761,16 +772,16 @@ namespace hp * co-located on the same * entity. */ - void renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + void renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<0>); - void renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + void renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<1>); - void renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + void renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<2>); - void renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + void renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<3>); /** @@ -826,7 +837,7 @@ namespace hp * actual data format used to * the present class. */ - std::vector<unsigned int> vertex_dofs; + std::vector<types::global_dof_index> vertex_dofs; /** * For each vertex in the @@ -849,7 +860,7 @@ namespace hp * actual data format used to * the present class. */ - std::vector<unsigned int> vertex_dofs_offsets; + std::vector<types::global_dof_index> vertex_dofs_offsets; std::vector<MGVertexDoFs> mg_vertex_dofs; @@ -903,7 +914,7 @@ namespace hp template <int dim, int spacedim> inline - unsigned int + types::global_dof_index DoFHandler<dim,spacedim>::n_dofs () const { return number_cache.n_global_dofs; @@ -912,15 +923,15 @@ namespace hp template <int dim, int spacedim> inline - unsigned int + types::global_dof_index DoFHandler<dim,spacedim>::n_dofs (const unsigned int) const { - return numbers::invalid_unsigned_int; + return numbers::invalid_dof_index; } template <int dim, int spacedim> - unsigned int + types::global_dof_index DoFHandler<dim, spacedim>::n_locally_owned_dofs() const { return number_cache.n_locally_owned_dofs; @@ -936,7 +947,7 @@ namespace hp template <int dim, int spacedim> - const std::vector<unsigned int> & + const std::vector<types::global_dof_index> & DoFHandler<dim, spacedim>::n_locally_owned_dofs_per_processor() const { return number_cache.n_locally_owned_dofs_per_processor; @@ -988,7 +999,7 @@ namespace hp template<int dim, int spacedim> inline - unsigned int DoFHandler<dim, spacedim>::MGVertexDoFs::get_index (const unsigned int, + types::global_dof_index DoFHandler<dim, spacedim>::MGVertexDoFs::get_index (const unsigned int, const unsigned int) const { Assert (false, ExcNotImplemented ()); @@ -999,7 +1010,7 @@ namespace hp inline void DoFHandler<dim, spacedim>::MGVertexDoFs::set_index (const unsigned int, const unsigned int, - const unsigned int) + types::global_dof_index) { Assert (false, ExcNotImplemented ()); } @@ -1012,5 +1023,3 @@ namespace hp 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 index f310c7dce7..9bc69d2143 100644 --- a/deal.II/include/deal.II/hp/dof_levels.h +++ b/deal.II/include/deal.II/hp/dof_levels.h @@ -1,14 +1,19 @@ -//---------------------------- hp_dof_levels.h ------------------------ -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2006, 2008, 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_dof_levels.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_dof_levels_h #define __deal2__hp_dof_levels_h diff --git a/deal.II/include/deal.II/hp/dof_objects.h b/deal.II/include/deal.II/hp/dof_objects.h index e675642398..54aee6dc70 100644 --- a/deal.II/include/deal.II/hp/dof_objects.h +++ b/deal.II/include/deal.II/hp/dof_objects.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2008, 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_objects_h #define __deal2__hp_dof_objects_h @@ -101,7 +106,7 @@ namespace internal * the degrees of freedom of each * hex in the @p hex_dofs array. */ - std::vector<unsigned int> dof_offsets; + std::vector<types::global_dof_index> dof_offsets; /** * Store the global indices of @@ -109,7 +114,7 @@ namespace internal * DoFLevel() for detailed * information. */ - std::vector<unsigned int> dofs; + std::vector<types::global_dof_index > dofs; /** * Set the global index of @@ -142,7 +147,7 @@ namespace internal const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index, + const types::global_dof_index global_index, const unsigned int obj_level); /** @@ -169,7 +174,7 @@ namespace internal * information. */ template <int dimm, int spacedim> - unsigned int + types::global_dof_index get_dof_index (const dealii::hp::DoFHandler<dimm,spacedim> &dof_handler, const unsigned int obj_index, const unsigned int fe_index, @@ -210,7 +215,7 @@ namespace internal * on this object. */ template <int dimm, int spacedim> - unsigned int + types::global_dof_index nth_active_fe_index (const dealii::hp::DoFHandler<dimm,spacedim> &dof_handler, const unsigned int obj_level, const unsigned int obj_index, @@ -243,7 +248,7 @@ namespace internal template <int dim> template <int dimm, int spacedim> inline - unsigned int + types::global_dof_index DoFObjects<dim>:: get_dof_index (const dealii::hp::DoFHandler<dimm,spacedim> &dof_handler, const unsigned int obj_index, @@ -272,7 +277,7 @@ namespace internal // make sure we are on an // object for which DoFs have // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_unsigned_int, + 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")); @@ -304,17 +309,18 @@ namespace internal // an exception if we can't // find a set for this // particular fe_index - const unsigned int starting_offset = dof_offsets[obj_index]; - const unsigned int *pointer = &dofs[starting_offset]; + 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_unsigned_int, + Assert (*pointer != numbers::invalid_dof_index, ExcInternalError()); if (*pointer == fe_index) return *(pointer + 1 + local_index); else - pointer += dof_handler.get_fe()[*pointer] - .template n_dofs_per_object<dim>() + 1; + pointer += static_cast<types::global_dof_index>( + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object<dim>() + 1); } } } @@ -330,7 +336,7 @@ namespace internal const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index, + const types::global_dof_index global_index, const unsigned int obj_level) { Assert ((fe_index != dealii::hp::DoFHandler<dimm,spacedim>::default_fe_index), @@ -354,7 +360,7 @@ namespace internal // make sure we are on an // object for which DoFs have // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_unsigned_int, + 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")); @@ -386,11 +392,11 @@ namespace internal // an exception if we can't // find a set for this // particular fe_index - const unsigned int starting_offset = dof_offsets[obj_index]; - unsigned int *pointer = &dofs[starting_offset]; + 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_unsigned_int, + Assert (*pointer != numbers::invalid_dof_index, ExcInternalError()); if (*pointer == fe_index) { @@ -426,7 +432,7 @@ namespace internal // make sure we are on an // object for which DoFs have // been allocated at all - if (dof_offsets[obj_index] == numbers::invalid_unsigned_int) + if (dof_offsets[obj_index] == numbers::invalid_dof_index) return 0; // if we are on a cell, then the @@ -450,11 +456,11 @@ namespace internal // find a set for this // particular fe_index const unsigned int starting_offset = dof_offsets[obj_index]; - const unsigned int *pointer = &dofs[starting_offset]; + const types::global_dof_index *pointer = &dofs[starting_offset]; unsigned int counter = 0; while (true) { - if (*pointer == numbers::invalid_unsigned_int) + if (*pointer == numbers::invalid_dof_index) // end of list reached return counter; else @@ -472,7 +478,7 @@ namespace internal template <int dim> template <int dimm, int spacedim> inline - unsigned int + types::global_dof_index DoFObjects<dim>:: nth_active_fe_index (const dealii::hp::DoFHandler<dimm,spacedim> &dof_handler, const unsigned int obj_level, @@ -491,7 +497,7 @@ namespace internal // make sure we are on an // object for which DoFs have // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_unsigned_int, + 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")); @@ -525,11 +531,11 @@ namespace internal // find a set for this // particular fe_index const unsigned int starting_offset = dof_offsets[obj_index]; - const unsigned int *pointer = &dofs[starting_offset]; + const types::global_dof_index *pointer = &dofs[starting_offset]; unsigned int counter = 0; while (true) { - Assert (*pointer != numbers::invalid_unsigned_int, + Assert (*pointer != numbers::invalid_dof_index, ExcInternalError()); const unsigned int fe_index = *pointer; @@ -565,7 +571,7 @@ namespace internal ExcMessage ("No finite element collection is associated with " "this DoFHandler")); Assert (obj_index < dof_offsets.size(), - ExcIndexRange (obj_index, 0, dof_offsets.size())); + ExcIndexRange (obj_index, 0, static_cast<unsigned int>(dof_offsets.size()))); Assert ((fe_index != dealii::hp::DoFHandler<dimm,spacedim>::default_fe_index), ExcMessage ("You need to specify a FE index when working " "with hp DoFHandlers")); @@ -575,7 +581,7 @@ namespace internal // make sure we are on an // object for which DoFs have // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_unsigned_int, + 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")); @@ -606,18 +612,19 @@ namespace internal // an exception if we can't // find a set for this // particular fe_index - const unsigned int starting_offset = dof_offsets[obj_index]; - const unsigned int *pointer = &dofs[starting_offset]; + 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_unsigned_int) + if (*pointer == numbers::invalid_dof_index) // end of list reached return false; else if (*pointer == fe_index) return true; else - pointer += dof_handler.get_fe()[*pointer] - .template n_dofs_per_object<dim>() + 1; + pointer += static_cast<types::global_dof_index>( + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object<dim>()+1); } } } 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..fd02273faa 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 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..8a1676220a 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 diff --git a/deal.II/include/deal.II/integrators/divergence.h b/deal.II/include/deal.II/integrators/divergence.h index de6b17d668..b78c4777f0 100644 --- a/deal.II/include/deal.II/integrators/divergence.h +++ b/deal.II/include/deal.II/integrators/divergence.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_divergence_h #define __deal2__integrators_divergence_h diff --git a/deal.II/include/deal.II/integrators/elasticity.h b/deal.II/include/deal.II/integrators/elasticity.h index 33a7ba4178..d772cf695c 100644 --- a/deal.II/include/deal.II/integrators/elasticity.h +++ b/deal.II/include/deal.II/integrators/elasticity.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_elasticity_h #define __deal2__integrators_elasticity_h @@ -95,12 +100,12 @@ namespace LocalIntegrators const double dx = factor * fe.JxW(k); for (unsigned int i=0; i<n_dofs; ++i) for (unsigned int d1=0; d1<dim; ++d1) - for (unsigned int d2=0; d2<dim; ++d2) - { - result(i) += dx * .25 * - (input[d1][k][d2] + input[d2][k][d1]) * - (fe.shape_grad_component(i,k,d1)[d2] + fe.shape_grad_component(i,k,d2)[d1]); - } + for (unsigned int d2=0; d2<dim; ++d2) + { + result(i) += dx * .25 * + (input[d1][k][d2] + input[d2][k][d1]) * + (fe.shape_grad_component(i,k,d1)[d2] + fe.shape_grad_component(i,k,d2)[d1]); + } } } @@ -191,24 +196,24 @@ namespace LocalIntegrators { const double u= input[d1][k]; const double v= fe.shape_value_component(i,k,d1); - const double g= data[d1][k]; - result(i) += dx + 2.*penalty * (u-g) * v; - - for (unsigned int d2=0; d2<dim; ++d2) - { - // v . nabla u n - result(i) -= .5*dx* v * Dinput[d1][k][d2] * n(d2); - // v . (nabla u)^T n - result(i) -= .5*dx* v * Dinput[d2][k][d1] * n(d2); - // u nabla v n - result(i) -= .5*dx * (u-g) * fe.shape_grad_component(i,k,d1)[d2] * n(d2); - // u (nabla v)^T n - result(i) -= .5*dx * (u-g) * fe.shape_grad_component(i,k,d2)[d1] * n(d2); - } - } - } + const double g= data[d1][k]; + result(i) += dx + 2.*penalty * (u-g) * v; + + for (unsigned int d2=0; d2<dim; ++d2) + { + // v . nabla u n + result(i) -= .5*dx* v * Dinput[d1][k][d2] * n(d2); + // v . (nabla u)^T n + result(i) -= .5*dx* v * Dinput[d2][k][d1] * n(d2); + // u nabla v n + result(i) -= .5*dx * (u-g) * fe.shape_grad_component(i,k,d1)[d2] * n(d2); + // u (nabla v)^T n + result(i) -= .5*dx * (u-g) * fe.shape_grad_component(i,k,d2)[d1] * n(d2); + } + } + } } - + /** * The interior penalty flux * for symmetric gradients. @@ -308,7 +313,7 @@ namespace LocalIntegrators double ext_factor = -1.) { const unsigned int n1 = fe1.dofs_per_cell; - + AssertDimension(fe1.get_fe().n_components(), dim); AssertDimension(fe2.get_fe().n_components(), dim); AssertVectorVectorDimension(input1, dim, fe1.n_quadrature_points); @@ -325,7 +330,7 @@ namespace LocalIntegrators { const double dx = fe1.JxW(k); const Point<dim> &n = fe1.normal_vector(k); - + for (unsigned int i=0; i<n1; ++i) for (unsigned int d1=0; d1<dim; ++d1) { @@ -333,27 +338,27 @@ namespace LocalIntegrators const double v2 = fe2.shape_value_component(i,k,d1); const double u1 = input1[d1][k]; const double u2 = input2[d1][k]; - + result1(i) += dx * penalty * u1*v1; - result1(i) -= dx * penalty * u2*v1; - result2(i) -= dx * penalty * u1*v2; + result1(i) -= dx * penalty * u2*v1; + result2(i) -= dx * penalty * u1*v2; result2(i) += dx * penalty * u2*v2; - - for (unsigned int d2=0; d2<dim; ++d2) - { - // v . nabla u n - result1(i) -= .25*dx* (nu1*Dinput1[d1][k][d2]+nu2*Dinput1[d1][k][d2]) * n(d2) * v1; - result2(i) += .25*dx* (nu1*Dinput1[d1][k][d2]+nu2*Dinput1[d1][k][d2]) * n(d2) * v1; - // v . (nabla u)^T n - result1(i) -= .25*dx* (nu1*Dinput1[d2][k][d1]+nu2*Dinput1[d2][k][d1]) * n(d2) * v1; - result2(i) += .25*dx* (nu1*Dinput1[d2][k][d1]+nu2*Dinput1[d2][k][d1]) * n(d2) * v1; - // u nabla v n - result1(i) -= .25*dx* nu1*fe1.shape_grad_component(i,k,d1)[d2] * n(d2) * (u1-u2); - result2(i) -= .25*dx* nu2*fe2.shape_grad_component(i,k,d1)[d2] * n(d2) * (u1-u2); - // u (nabla v)^T n - result1(i) -= .25*dx* nu1*fe1.shape_grad_component(i,k,d2)[d1] * n(d2) * (u1-u2); - result2(i) -= .25*dx* nu2*fe2.shape_grad_component(i,k,d2)[d1] * n(d2) * (u1-u2); - } + + for (unsigned int d2=0; d2<dim; ++d2) + { + // v . nabla u n + result1(i) -= .25*dx* (nu1*Dinput1[d1][k][d2]+nu2*Dinput1[d1][k][d2]) * n(d2) * v1; + result2(i) += .25*dx* (nu1*Dinput1[d1][k][d2]+nu2*Dinput1[d1][k][d2]) * n(d2) * v1; + // v . (nabla u)^T n + result1(i) -= .25*dx* (nu1*Dinput1[d2][k][d1]+nu2*Dinput1[d2][k][d1]) * n(d2) * v1; + result2(i) += .25*dx* (nu1*Dinput1[d2][k][d1]+nu2*Dinput1[d2][k][d1]) * n(d2) * v1; + // u nabla v n + result1(i) -= .25*dx* nu1*fe1.shape_grad_component(i,k,d1)[d2] * n(d2) * (u1-u2); + result2(i) -= .25*dx* nu2*fe2.shape_grad_component(i,k,d1)[d2] * n(d2) * (u1-u2); + // u (nabla v)^T n + result1(i) -= .25*dx* nu1*fe1.shape_grad_component(i,k,d2)[d1] * n(d2) * (u1-u2); + result2(i) -= .25*dx* nu2*fe2.shape_grad_component(i,k,d2)[d1] * n(d2) * (u1-u2); + } } } } diff --git a/deal.II/include/deal.II/integrators/l2.h b/deal.II/include/deal.II/integrators/l2.h index b9e54d79d8..2313997c04 100644 --- a/deal.II/include/deal.II/integrators/l2.h +++ b/deal.II/include/deal.II/integrators/l2.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_l2_h #define __deal2__integrators_l2_h diff --git a/deal.II/include/deal.II/integrators/laplace.h b/deal.II/include/deal.II/integrators/laplace.h index 55ffdb0739..c20eb4beba 100644 --- a/deal.II/include/deal.II/integrators/laplace.h +++ b/deal.II/include/deal.II/integrators/laplace.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_laplace_h #define __deal2__integrators_laplace_h diff --git a/deal.II/include/deal.II/integrators/local_integrators.h b/deal.II/include/deal.II/integrators/local_integrators.h index 22cbef8a6a..d3f9a49b6a 100644 --- a/deal.II/include/deal.II/integrators/local_integrators.h +++ b/deal.II/include/deal.II/integrators/local_integrators.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__integrators_local_integrators_h #define __deal2__integrators_local_integrators_h diff --git a/deal.II/include/deal.II/integrators/maxwell.h b/deal.II/include/deal.II/integrators/maxwell.h index 578625438a..d2b43c282b 100644 --- a/deal.II/include/deal.II/integrators/maxwell.h +++ b/deal.II/include/deal.II/integrators/maxwell.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__integrators_maxwell_h #define __deal2__integrators_maxwell_h diff --git a/deal.II/include/deal.II/integrators/patches.h b/deal.II/include/deal.II/integrators/patches.h index 7c727ccb52..ca2e2e96ea 100644 --- a/deal.II/include/deal.II/integrators/patches.h +++ b/deal.II/include/deal.II/integrators/patches.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_patches_h #define __deal2__integrators_patches_h diff --git a/deal.II/include/deal.II/lac/arpack_solver.h b/deal.II/include/deal.II/lac/arpack_solver.h index 2c25c8f3c2..9c3e1b2c83 100644 --- a/deal.II/include/deal.II/lac/arpack_solver.h +++ b/deal.II/include/deal.II/lac/arpack_solver.h @@ -1,16 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Authors: Bärbel Janssen, University of Heidelberg, -// Agnieszka Miedler, TU Berlin, 2010 +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__arpack_solver_h #define __deal2__arpack_solver_h @@ -77,6 +80,12 @@ extern "C" void dneupd_(int *rvec, char *howmany, int *select, double *d, class ArpackSolver : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + + /** * An enum that lists the possible * choices for which eigenvalues to @@ -373,7 +382,7 @@ void ArpackSolver::solve ( tmp.reinit(src); - for (unsigned int i=0; i<src.size(); ++i) + for (size_type i=0; i<src.size(); ++i) src(i) = *(workd+ipntr[0]-1+i); // multiplication with mass matrix M @@ -381,7 +390,7 @@ void ArpackSolver::solve ( // solving linear system inverse.vmult(dst,tmp); - for (unsigned int i=0; i<dst.size(); ++i) + for (size_type i=0; i<dst.size(); ++i) *(workd+ipntr[1]-1+i) = dst(i); } break; @@ -395,7 +404,7 @@ void ArpackSolver::solve ( tmp.reinit(src); tmp2.reinit(src); - for (unsigned int i=0; i<src.size(); ++i) + for (size_type i=0; i<src.size(); ++i) { src(i) = *(workd+ipntr[2]-1+i); tmp(i) = *(workd+ipntr[0]-1+i); @@ -403,7 +412,7 @@ void ArpackSolver::solve ( // solving linear system inverse.vmult(dst,src); - for (unsigned int i=0; i<dst.size(); ++i) + for (size_type i=0; i<dst.size(); ++i) *(workd+ipntr[1]-1+i) = dst(i); } break; @@ -415,13 +424,13 @@ void ArpackSolver::solve ( src.reinit(eigenvectors[0]); dst.reinit(src); - for (unsigned int i=0; i<src.size(); ++i) + for (size_type i=0; i<src.size(); ++i) src(i) = *(workd+ipntr[0]-1+i); // Multiplication with mass matrix M mass_matrix.vmult(dst, src); - for (unsigned int i=0; i<dst.size(); ++i) + for (size_type i=0; i<dst.size(); ++i) *(workd+ipntr[1]-1+i) = dst(i); } @@ -488,7 +497,7 @@ void ArpackSolver::solve ( Assert (false, ExcArpackInfodneupd(info)); } - for (unsigned int i=0; i<eigenvectors.size(); ++i) + for (size_type i=0; i<eigenvectors.size(); ++i) for (unsigned int j=0; j<n; ++j) eigenvectors[i](j) = v[i*n+j]; @@ -497,9 +506,9 @@ void ArpackSolver::solve ( AssertDimension (eigenvalues.size(), eigenvalues_real.size()); AssertDimension (eigenvalues.size(), eigenvalues_im.size()); - for (unsigned int i=0; i<eigenvalues.size(); ++i) - eigenvalues[i] = std::complex<double> (eigenvalues_real[i], - eigenvalues_im[i]); + for (size_type i=0; i<eigenvalues.size(); ++i) + eigenvalues[i] = std::complex<double> (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 19c836bb6c..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 @@ -17,6 +22,7 @@ #include <deal.II/base/subscriptor.h> #include <deal.II/base/exceptions.h> #include <deal.II/base/logstream.h> +#include <cstddef> #include <vector> DEAL_II_NAMESPACE_OPEN @@ -49,6 +55,10 @@ DEAL_II_NAMESPACE_OPEN class BlockIndices : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; /** * Default @@ -64,13 +74,13 @@ public: * number of blocks will be the * size of the vector */ - BlockIndices (const std::vector<unsigned int> &n); + BlockIndices (const std::vector<size_type> &n); /** * Specialized constructor for a * structure with blocks of equal size. */ - explicit BlockIndices(const unsigned int n_blocks, const unsigned int block_size = 0); + explicit BlockIndices(const unsigned int n_blocks, const size_type block_size = 0); /** * Reinitialize the number of @@ -78,7 +88,7 @@ public: * the same number of elements. */ void reinit (const unsigned int n_blocks, - const unsigned int n_elements_per_block); + const size_type n_elements_per_block); /** * Reinitialize the number of @@ -89,14 +99,14 @@ public: * of block @p i is set to * <tt>n[i]</tt>. */ - void reinit (const std::vector<unsigned int> &n); + void reinit (const std::vector<size_type> &n); /** * Add another block of given * size to the end of the block * structure. */ - void push_back(const unsigned int size); + void push_back(const size_type size); /** * @name Size information @@ -115,12 +125,12 @@ public: * of the vector space of the * block vector. */ - unsigned int total_size () const; + size_type total_size () const; /** * The size of the @p ith block. */ - unsigned int block_size (const unsigned int i) const; + size_type block_size (const unsigned int i) const; //@} @@ -147,20 +157,20 @@ public: * the block, the second the * index within it. */ - std::pair<unsigned int,unsigned int> - global_to_local (const unsigned int i) const; + std::pair<unsigned int,size_type> + global_to_local (const size_type i) const; /** * Return the global index of * @p index in block @p block. */ - unsigned int local_to_global (const unsigned int block, - const unsigned int index) const; + size_type local_to_global (const unsigned int block, + const size_type index) const; /** * The start index of the ith block. */ - unsigned int block_start (const unsigned int i) const; + size_type block_start (const unsigned int i) const; //@} /** @@ -206,7 +216,7 @@ private: * value is the total number of * entries. */ - std::vector<unsigned int> start_indices; + std::vector<size_type> start_indices; }; @@ -329,11 +339,11 @@ const bool IsBlockMatrix<MatrixType>::value; inline void BlockIndices::reinit (const unsigned int nb, - const unsigned int block_size) + const size_type block_size) { n_blocks = nb; start_indices.resize(n_blocks+1); - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) start_indices[i] = i * block_size; } @@ -341,15 +351,15 @@ BlockIndices::reinit (const unsigned int nb, inline void -BlockIndices::reinit (const std::vector<unsigned int> &n) +BlockIndices::reinit (const std::vector<size_type> &n) { if (start_indices.size() != n.size()+1) { - n_blocks = n.size(); + n_blocks = static_cast<unsigned int>(n.size()); start_indices.resize(n_blocks+1); } start_indices[0] = 0; - for (unsigned int i=1; i<=n_blocks; ++i) + for (size_type i=1; i<=n_blocks; ++i) start_indices[i] = start_indices[i-1] + n[i-1]; } @@ -366,21 +376,21 @@ BlockIndices::BlockIndices () inline BlockIndices::BlockIndices ( const unsigned int n_blocks, - const unsigned int block_size) + const size_type block_size) : n_blocks(n_blocks), start_indices(n_blocks+1) { - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) start_indices[i] = i * block_size; } inline -BlockIndices::BlockIndices (const std::vector<unsigned int> &n) +BlockIndices::BlockIndices (const std::vector<size_type> &n) : - n_blocks(n.size()), + n_blocks(static_cast<unsigned int>(n.size())), start_indices(n.size()+1) { reinit (n); @@ -389,7 +399,7 @@ BlockIndices::BlockIndices (const std::vector<unsigned int> &n) inline void -BlockIndices::push_back(const unsigned int sz) +BlockIndices::push_back(const size_type sz) { start_indices.push_back(start_indices[n_blocks]+sz); ++n_blocks; @@ -398,29 +408,29 @@ BlockIndices::push_back(const unsigned int sz) inline -std::pair<unsigned int,unsigned int> -BlockIndices::global_to_local (const unsigned int i) const +std::pair<unsigned int,BlockIndices::size_type> +BlockIndices::global_to_local (const size_type i) const { - Assert (i<total_size(), ExcIndexRange(i, 0, total_size())); - Assert (n_blocks > 0, ExcLowerRange(i, 1)); + Assert (i<total_size(), ExcIndexRangeType<size_type>(i, 0, total_size())); + Assert (n_blocks > 0, ExcLowerRangeType<size_type>(i, size_type(1))); unsigned int block = n_blocks-1; while (i < start_indices[block]) --block; - return std::pair<unsigned int,unsigned int>(block, - i-start_indices[block]); + return std::pair<size_type,size_type>(block, + i-start_indices[block]); } inline -unsigned int +BlockIndices::size_type BlockIndices::local_to_global (const unsigned int block, - const unsigned int index) const + const size_type index) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); Assert (index < start_indices[block+1]-start_indices[block], - ExcIndexRange (index, 0, start_indices[block+1]-start_indices[block])); + ExcIndexRangeType<size_type> (index, 0, start_indices[block+1]-start_indices[block])); return start_indices[block]+index; } @@ -436,7 +446,7 @@ BlockIndices::size () const inline -unsigned int +BlockIndices::size_type BlockIndices::total_size () const { if (n_blocks == 0) return 0; @@ -446,7 +456,7 @@ BlockIndices::total_size () const inline -unsigned int +BlockIndices::size_type BlockIndices::block_size (const unsigned int block) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); @@ -456,7 +466,7 @@ BlockIndices::block_size (const unsigned int block) const inline -unsigned int +BlockIndices::size_type BlockIndices::block_start (const unsigned int block) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); @@ -483,7 +493,7 @@ BlockIndices::operator == (const BlockIndices &b) const if (n_blocks != b.n_blocks) return false; - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) if (start_indices[i] != b.start_indices[i]) return false; @@ -499,7 +509,7 @@ BlockIndices::swap (BlockIndices &b) Assert (n_blocks == b.n_blocks, ExcDimensionMismatch(n_blocks, b.n_blocks)); - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) std::swap (start_indices[i], b.start_indices[i]); } diff --git a/deal.II/include/deal.II/lac/block_list.h b/deal.II/include/deal.II/lac/block_list.h index 04c312d806..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 @@ -48,8 +53,13 @@ class BlockList : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /// The container for each index set - typedef std::vector<unsigned int> block_container; + typedef std::vector<size_type> block_container; /// The iterator for individual indices typedef block_container::const_iterator const_iterator; @@ -65,7 +75,7 @@ public: * argument is the dimension of * the vector space. */ - void create_sparsity_pattern(SparsityPattern &sparsity, unsigned int n) const; + void create_sparsity_pattern(SparsityPattern &sparsity, size_type n) const; /** * Add the indices in @@ -73,7 +83,7 @@ public: * <tt>block</tt>, eliminating * repeated indices. */ - void add(unsigned int block, const std::vector<unsigned int> &indices); + void add(size_type block, const std::vector<size_type> &indices); /** * Add the indices in @@ -83,16 +93,16 @@ public: * those indices for which * <tt>selected_indices</tt> is true. */ - void add(unsigned int block, - const std::vector<unsigned int> &indices, + void add(size_type block, + const std::vector<size_type> &indices, const std::vector<bool> &selected_indices, - unsigned int offset = 0); + size_type offset = 0); /** * Just set up the correct size * and assign indices to blocks later. */ - void initialize(unsigned int n_blocks); + void initialize(size_type n_blocks); /** * Set up all index sets using an @@ -110,7 +120,7 @@ public: * blocks as its first argument. */ template <typename ITERATOR> - void initialize(unsigned int n_blocks, + void initialize(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end); @@ -133,7 +143,7 @@ public: * blocks as its first argument. */ template <typename ITERATOR> - void initialize_mg(unsigned int n_blocks, + void initialize_mg(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end) DEAL_II_DEPRECATED; @@ -169,11 +179,11 @@ public: * blocks as its first argument. */ template <typename ITERATOR> - void initialize(unsigned int n_blocks, + void initialize(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end, const std::vector<bool> &selected_dofs, - unsigned int offset = 0) DEAL_II_DEPRECATED; + size_type offset = 0) DEAL_II_DEPRECATED; /** * @deprecated This function will * move to DoFTools. @@ -206,11 +216,11 @@ public: * blocks as its first argument. */ template <typename ITERATOR> - void initialize_mg(unsigned int n_blocks, + void initialize_mg(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end, const std::vector<bool> &selected_dofs, - unsigned int offset = 0) DEAL_II_DEPRECATED; + size_type offset = 0) DEAL_II_DEPRECATED; /** * @deprecated This function will @@ -224,11 +234,11 @@ public: * around a vertex. */ template <int dim, typename ITERATOR> - void initialize_vertex_patches_mg(unsigned int n_blocks, + void initialize_vertex_patches_mg(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end, const std::vector<bool> &selected_dofs = std::vector<bool>(), - unsigned int offset = 0) DEAL_II_DEPRECATED; + size_type offset = 0) DEAL_II_DEPRECATED; /** * @deprecated This function will @@ -255,29 +265,29 @@ public: /** * The number of blocks. */ - unsigned int size() const; + size_type size() const; /** * The size of a single block. */ - unsigned int block_size(unsigned int block) const; + size_type block_size(size_type block) const; /** * Iterator to the first index in block. */ - const_iterator begin(unsigned int block) const; + const_iterator begin(size_type block) const; /** * End iterator for a single block. */ - const_iterator end(unsigned int block) const; + const_iterator end(size_type block) const; /** * Return the position of * <tt>index</tt> in * <tt>block</tt>, or - * numbers::invalid_unsigned_int, + * numbers::invalid_size_type, * if the index is not in the block. */ - unsigned int local_index(unsigned int block, unsigned int index) const; + size_type local_index(size_type block, size_type index) const; private: /** @@ -289,14 +299,14 @@ private: inline void -BlockList::create_sparsity_pattern(SparsityPattern &sparsity, unsigned int n) const +BlockList::create_sparsity_pattern(SparsityPattern &sparsity, size_type n) const { std::vector<unsigned int> sizes(size()); - for (unsigned int b=0; b<size(); ++b) + for (size_type b=0; b<size(); ++b) sizes[b] = block_size(b); sparsity.reinit(size(), n, sizes); - for (unsigned int b=0; b<size(); ++b) + for (size_type b=0; b<size(); ++b) { for (const_iterator i = begin(b); i != end(b); ++i) sparsity.add(b,*i); @@ -307,14 +317,14 @@ BlockList::create_sparsity_pattern(SparsityPattern &sparsity, unsigned int n) co inline void -BlockList::add(const unsigned int block, const std::vector<unsigned int> &indices) +BlockList::add(const size_type block, const std::vector<size_type> &indices) { AssertIndexRange(block, index_sets.size()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) { - const unsigned int k = indices[i]; - if (k==numbers::invalid_unsigned_int) + const size_type k = indices[i]; + if (k==numbers::invalid_size_type) continue; if (std::find(index_sets[block].begin(), index_sets[block].end(), k) == index_sets[block].end()) @@ -326,18 +336,18 @@ BlockList::add(const unsigned int block, const std::vector<unsigned int> &indice inline void BlockList::add( - const unsigned int block, - const std::vector<unsigned int> &indices, + const size_type block, + const std::vector<size_type> &indices, const std::vector<bool> &selected, - unsigned int offset) + size_type offset) { AssertIndexRange(block, index_sets.size()); AssertDimension(indices.size(), selected.size()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) { - const unsigned int k = indices[i]; - if (k==numbers::invalid_unsigned_int) + const size_type k = indices[i]; + if (k==numbers::invalid_size_type) continue; if (selected[i] && std::find(index_sets[block].begin(), index_sets[block].end(), k-offset) == index_sets[block].end()) @@ -348,7 +358,7 @@ BlockList::add( inline void -BlockList::initialize(unsigned int n_blocks) +BlockList::initialize(size_type n_blocks) { index_sets.resize(n_blocks); } @@ -357,11 +367,11 @@ BlockList::initialize(unsigned int n_blocks) template <typename ITERATOR> inline void -BlockList::initialize(unsigned int n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end) +BlockList::initialize(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end) { index_sets.resize(n_blocks); - std::vector<unsigned int> indices; - unsigned int k = 0; + std::vector<size_type> indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -374,11 +384,11 @@ BlockList::initialize(unsigned int n_blocks, const ITERATOR begin, const typenam template <typename ITERATOR> inline void -BlockList::initialize_mg(unsigned int n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end) +BlockList::initialize_mg(size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end) { index_sets.resize(n_blocks); - std::vector<unsigned int> indices; - unsigned int k = 0; + std::vector<size_type> indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -392,15 +402,15 @@ template <typename ITERATOR> inline void BlockList::initialize( - unsigned int n_blocks, + size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end, const std::vector<bool> &selected_dofs, - unsigned int offset) + size_type offset) { index_sets.resize(n_blocks); - std::vector<unsigned int> indices; - unsigned int k = 0; + std::vector<size_type> indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -416,15 +426,15 @@ template <typename ITERATOR> inline void BlockList::initialize_mg( - unsigned int n_blocks, + size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end, const std::vector<bool> &selected_dofs, - unsigned int offset) + size_type offset) { index_sets.resize(n_blocks); - std::vector<unsigned int> indices; - unsigned int k = 0; + std::vector<size_type> indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -494,11 +504,11 @@ template <int dim, typename ITERATOR> inline void BlockList::initialize_vertex_patches_mg( - unsigned int n_blocks, + size_type n_blocks, const ITERATOR begin, const typename identity<ITERATOR>::type end, const std::vector<bool> &selected_dofs, - unsigned int offset) + size_type offset) { Assert(selected_dofs.size() == 0, ExcNotImplemented()); Assert(offset==0, ExcNotImplemented()); @@ -506,8 +516,8 @@ BlockList::initialize_vertex_patches_mg( Assert(fe.dofs_per_vertex == 0, ExcNotImplemented()); index_sets.resize(n_blocks); - std::vector<unsigned int> indices; - unsigned int k = 0; + std::vector<size_type> indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell) { if (cell_generates_vertex_patch<dim>(cell, true)) @@ -520,52 +530,52 @@ BlockList::initialize_vertex_patches_mg( cell->neighbor(4)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,1)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,3)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,4)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,1)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,3)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,4)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(4)->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,0)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,3)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,4)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,0)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,3)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,4)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(4)->neighbor(2)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,1)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,2)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,4)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,1)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,2)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,4)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(4)->neighbor(2)->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,0)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,2)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,4)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,0)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,2)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,4)] = numbers::invalid_dof_index; } add(k, indices); case 2: cell->neighbor(2)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,1)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,2)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,1)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,2)] = numbers::invalid_dof_index; if (dim>2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(2)->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,0)] = numbers::invalid_unsigned_int; - indices[fe.face_to_cell_index(i,2)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,0)] = numbers::invalid_dof_index; + indices[fe.face_to_cell_index(i,2)] = numbers::invalid_dof_index; if (dim>2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); // no break here @@ -573,21 +583,21 @@ BlockList::initialize_vertex_patches_mg( cell->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,1)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,1)] = numbers::invalid_dof_index; if (dim>1) - indices[fe.face_to_cell_index(i,3)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,3)] = numbers::invalid_dof_index; if (dim>2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; i<fe.dofs_per_face; ++i) { - indices[fe.face_to_cell_index(i,0)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,0)] = numbers::invalid_dof_index; if (dim>1) - indices[fe.face_to_cell_index(i,3)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,3)] = numbers::invalid_dof_index; if (dim>2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); break; @@ -602,7 +612,7 @@ BlockList::initialize_vertex_patches_mg( inline -unsigned int +BlockList::size_type BlockList::size() const { return index_sets.size(); @@ -610,8 +620,8 @@ BlockList::size() const inline -unsigned int -BlockList::block_size(unsigned int block) const +BlockList::size_type +BlockList::block_size(size_type block) const { return index_sets[block].size(); } @@ -619,7 +629,7 @@ BlockList::block_size(unsigned int block) const inline BlockList::const_iterator -BlockList::begin(unsigned int block) const +BlockList::begin(size_type block) const { AssertIndexRange(block, index_sets.size()); return index_sets[block].begin(); @@ -628,7 +638,7 @@ BlockList::begin(unsigned int block) const inline BlockList::const_iterator -BlockList::end(unsigned int block) const +BlockList::end(size_type block) const { AssertIndexRange(block, index_sets.size()); return index_sets[block].end(); @@ -636,15 +646,15 @@ BlockList::end(unsigned int block) const inline -unsigned int -BlockList::local_index(unsigned int block, unsigned int index) const +BlockList::size_type +BlockList::local_index(size_type block, size_type index) const { AssertIndexRange(block, index_sets.size()); const block_container &b = index_sets[block]; - for (unsigned int i=0; i<b.size(); ++i) + for (size_type i=0; i<b.size(); ++i) if (b[i] == index) return i; - return numbers::invalid_unsigned_int; + return numbers::invalid_size_type; } 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 73420c5353..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 @@ -123,6 +128,11 @@ template <typename number = double> class BlockMatrixArray : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor creating a * useless object. initialize() @@ -200,11 +210,11 @@ public: * the multiplication functions. */ template <class MATRIX> - void enter (const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false); + void enter (const MATRIX &matrix, + const unsigned int row, + const unsigned int col, + const double prefix = 1., + const bool transpose = false); /** * Add an entry like with enter, @@ -218,11 +228,11 @@ public: */ template <class MATRIX> void enter_aux (VectorMemory<Vector<number> > &mem, - const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false) DEAL_II_DEPRECATED; + const MATRIX &matrix, + const unsigned int row, + const unsigned int col, + const double prefix = 1., + const bool transpose = false) DEAL_II_DEPRECATED; /** @@ -332,7 +342,7 @@ protected: */ template<class MATRIX> Entry (const MATRIX &matrix, - unsigned row, unsigned int col, + size_type row, size_type col, double prefix, bool transpose); /** @@ -362,13 +372,13 @@ protected: * Row number in the block * matrix. */ - unsigned int row; + size_type row; /** * Column number in the block * matrix. */ - unsigned int col; + size_type col; /** * Factor in front of the matrix @@ -471,6 +481,11 @@ class BlockTrianglePrecondition : private BlockMatrixArray<number> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor creating a * useless object. initialize() @@ -529,11 +544,11 @@ public: * matrices or preconditioners. */ template <class MATRIX> - void enter (const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false); + void enter (const MATRIX &matrix, + const size_type row, + const size_type col, + const double prefix = 1., + const bool transpose = false); /** * Enter a block. This calls @@ -548,11 +563,11 @@ public: */ template <class MATRIX> void enter_aux (VectorMemory<Vector<double> > &mem, - const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false) DEAL_II_DEPRECATED; + const MATRIX &matrix, + const size_type row, + const size_type col, + const double prefix = 1., + const bool transpose = false) DEAL_II_DEPRECATED; /** * Preconditioning. @@ -609,7 +624,7 @@ public: * matrix here. */ DeclException1(ExcNoDiagonal, - unsigned int, + size_type, << "No diagonal entry was added for block " << arg1); /** @@ -620,7 +635,7 @@ public: * matrix here. */ DeclException1(ExcMultipleDiagonal, - unsigned int, + size_type, << "Inverse diagonal entries may not be added in block " << arg1); //@} @@ -632,7 +647,7 @@ private: * for one row. */ void do_row (BlockVector<number> &dst, - unsigned int row_num) const; + size_type row_num) const; /** * Flag for backward insertion. @@ -649,8 +664,8 @@ template <class MATRIX> inline BlockMatrixArray<number>::Entry::Entry ( const MATRIX &m, - unsigned int row, - unsigned int col, + size_type row, + size_type col, double prefix, bool transpose) : @@ -728,7 +743,7 @@ BlockMatrixArray<number>::print_latex (STREAM &out) const typename std::vector<Entry>::const_iterator m = entries.begin(); typename std::vector<Entry>::const_iterator end = entries.end(); - unsigned int matrix_number = 0; + size_type matrix_number = 0; for (; m != end ; ++m) { if (matrix_names.find(m->matrix) == matrix_names.end()) @@ -773,7 +788,7 @@ template <class MATRIX> inline void BlockTrianglePrecondition<number>::enter (const MATRIX &matrix, - unsigned row, unsigned int col, + size_type row, size_type col, double prefix, bool transpose) { BlockMatrixArray<number>::enter(matrix, row, col, prefix, transpose); @@ -788,8 +803,8 @@ void BlockTrianglePrecondition<number>::enter_aux ( VectorMemory<Vector<double> > &mem, const MATRIX &matrix, - unsigned int row, - unsigned int col, + size_type row, + size_type col, double prefix, bool transpose) { 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 f98b791278..56d0067a63 100644 --- a/deal.II/include/deal.II/lac/block_matrix_base.h +++ b/deal.II/include/deal.II/lac/block_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__block_matrix_base_h #define __deal2__block_matrix_base_h @@ -53,6 +58,11 @@ namespace BlockMatrixIterators class AccessorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Typedef the value type of the * matrix we point into. @@ -120,6 +130,11 @@ namespace BlockMatrixIterators public AccessorBase<BlockMatrix> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Type of the matrix used in * this accessor. @@ -145,22 +160,22 @@ namespace BlockMatrixIterators * of rows in the matrix. */ Accessor (BlockMatrix *m, - const unsigned int row, - const unsigned int col); + const size_type row, + const size_type col); /** * Row number of the element * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of the entry at the @@ -212,7 +227,12 @@ namespace BlockMatrixIterators { public: /** - * Thype of the matrix used in + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + + /** + * Type of the matrix used in * this accessor. */ typedef const BlockMatrix MatrixType; @@ -236,8 +256,8 @@ namespace BlockMatrixIterators * of rows in the matrix. */ Accessor (const BlockMatrix *m, - const unsigned int row, - const unsigned int col); + const size_type row, + const size_type col); /** * Initalize const accessor @@ -250,14 +270,14 @@ namespace BlockMatrixIterators * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of the entry at the @@ -376,7 +396,7 @@ public: typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef std::size_t size_type; + typedef types::global_dof_index size_type; typedef MatrixIterator<BlockMatrixIterators::Accessor<BlockMatrixBase, false> > @@ -447,7 +467,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int m () const; + size_type m () const; /** * Return the dimension of the @@ -455,7 +475,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int n () const; + size_type n () const; /** @@ -483,8 +503,8 @@ public: * is allowed to store zero * values in non-existent fields. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const value_type value); /** @@ -515,9 +535,9 @@ public: * values are treated. */ template <typename number> - void set (const std::vector<unsigned int> &indices, - const FullMatrix<number> &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector<size_type> &indices, + const FullMatrix<number> &full_matrix, + const bool elide_zero_values = false); /** * Same function as before, but now @@ -527,10 +547,10 @@ public: * on rows and columns, respectively. */ template <typename number> - void set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number> &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number> &full_matrix, + const bool elide_zero_values = false); /** * Set several elements in the @@ -551,10 +571,10 @@ public: * values are treated. */ template <typename number> - void set (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number> &values, - const bool elide_zero_values = false); + void set (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number> &values, + const bool elide_zero_values = false); /** * Set several elements to values @@ -573,11 +593,11 @@ public: * values are inserted/replaced. */ template <typename number> - void set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values = false); + void set (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values = false); /** * Add <tt>value</tt> to the @@ -588,8 +608,8 @@ public: * is allowed to store zero * values in non-existent fields. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const value_type value); /** @@ -620,9 +640,9 @@ public: * into the matrix. */ template <typename number> - void add (const std::vector<unsigned int> &indices, - const FullMatrix<number> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &indices, + const FullMatrix<number> &full_matrix, + const bool elide_zero_values = true); /** * Same function as before, but now @@ -632,10 +652,10 @@ public: * on rows and columns, respectively. */ template <typename number> - void add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number> &full_matrix, + const bool elide_zero_values = true); /** * Set several elements in the @@ -655,10 +675,10 @@ public: * into the matrix. */ template <typename number> - void add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number> &values, - const bool elide_zero_values = true); + void add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number> &values, + const bool elide_zero_values = true); /** * Add an array of values given by @@ -678,12 +698,12 @@ public: * into the matrix. */ template <typename number> - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Add <tt>matrix</tt> scaled by @@ -711,8 +731,8 @@ public: * if the wanted element does not * exist in the matrix. */ - value_type operator () (const unsigned int i, - const unsigned int j) const; + value_type operator () (const size_type i, + const size_type j) const; /** * This function is mostly like @@ -731,8 +751,8 @@ public: * solution, since the sparsity * of the matrix is not used. */ - value_type el (const unsigned int i, - const unsigned int j) const; + value_type el (const size_type i, + const size_type j) const; /** * Return the main diagonal element in @@ -751,7 +771,7 @@ public: * involve searching for the * right column number. */ - value_type diag_element (const unsigned int i) const; + value_type diag_element (const size_type i) const; /** * Call the compress() function on all @@ -880,12 +900,12 @@ public: * STL-like iterator with the * first entry of row <tt>r</tt>. */ - iterator begin (const unsigned int r); + iterator begin (const size_type r); /** * Final iterator of row <tt>r</tt>. */ - iterator end (const unsigned int r); + iterator end (const size_type r); /** * STL-like iterator with the * first entry. @@ -901,12 +921,12 @@ public: * STL-like iterator with the * first entry of row <tt>r</tt>. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row <tt>r</tt>. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; /** * Return a reference to the underlying @@ -1227,7 +1247,7 @@ private: * individual blocks when doing a * collective add or set. */ - std::vector<unsigned int> counter_within_block; + std::vector<size_type> counter_within_block; /** * Temporary vector for column @@ -1235,7 +1255,7 @@ private: * local to global data on each * sparse matrix. */ - std::vector<std::vector<unsigned int> > column_indices; + std::vector<std::vector<size_type> > column_indices; /** * Temporary vector for storing the @@ -1304,8 +1324,8 @@ namespace BlockMatrixIterators inline Accessor<BlockMatrix, true>::Accessor ( const BlockMatrix *matrix, - const unsigned int row, - const unsigned int col) + const size_type row, + const size_type col) : matrix(matrix), base_iterator(matrix->block(0,0).begin()) @@ -1316,7 +1336,7 @@ namespace BlockMatrixIterators // the end of the matrix if (row < matrix->m()) { - const std::pair<unsigned int,unsigned int> indices + const std::pair<unsigned int,size_type> indices = matrix->row_block_indices.global_to_local(row); // find the first block that does @@ -1378,7 +1398,7 @@ namespace BlockMatrixIterators template <class BlockMatrix> inline - unsigned int + typename Accessor<BlockMatrix, true>::size_type Accessor<BlockMatrix, true>::row() const { Assert (this->row_block != numbers::invalid_unsigned_int, @@ -1391,7 +1411,7 @@ namespace BlockMatrixIterators template <class BlockMatrix> inline - unsigned int + typename Accessor<BlockMatrix, true>::size_type Accessor<BlockMatrix, true>::column() const { Assert (this->col_block != numbers::invalid_unsigned_int, @@ -1428,7 +1448,7 @@ namespace BlockMatrixIterators ExcIteratorPastEnd()); // Remember current row inside block - unsigned int local_row = base_iterator->row(); + size_type local_row = base_iterator->row(); // Advance one element inside the // current block @@ -1513,8 +1533,8 @@ namespace BlockMatrixIterators inline Accessor<BlockMatrix, false>::Accessor ( BlockMatrix *matrix, - const unsigned int row, - const unsigned int col) + const size_type row, + const size_type col) : matrix(matrix), base_iterator(matrix->block(0,0).begin()) @@ -1524,12 +1544,12 @@ namespace BlockMatrixIterators // the end of the matrix if (row < matrix->m()) { - const std::pair<unsigned int,unsigned int> indices + const std::pair<unsigned int,size_type> indices = matrix->row_block_indices.global_to_local(row); // find the first block that does // have an entry in this row - for (unsigned int bc=0; bc<matrix->n_block_cols(); ++bc) + for (size_type bc=0; bc<matrix->n_block_cols(); ++bc) { base_iterator = matrix->block(indices.first, bc).begin(indices.second); @@ -1554,18 +1574,18 @@ namespace BlockMatrixIterators { // we were asked to create the end // iterator for this matrix - this->row_block = numbers::invalid_unsigned_int; - this->col_block = numbers::invalid_unsigned_int; + this->row_block = numbers::invalid_size_type; + this->col_block = numbers::invalid_size_type; } } template <class BlockMatrix> inline - unsigned int + typename Accessor<BlockMatrix, false>::size_type Accessor<BlockMatrix, false>::row() const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return (matrix->row_block_indices.local_to_global(this->row_block, 0) + @@ -1575,10 +1595,10 @@ namespace BlockMatrixIterators template <class BlockMatrix> inline - unsigned int + typename Accessor<BlockMatrix, false>::size_type Accessor<BlockMatrix, false>::column() const { - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return (matrix->column_block_indices.local_to_global(this->col_block,0) + @@ -1591,9 +1611,9 @@ namespace BlockMatrixIterators typename Accessor<BlockMatrix, false>::value_type Accessor<BlockMatrix, false>::value () const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return base_iterator->value(); @@ -1606,9 +1626,9 @@ namespace BlockMatrixIterators void Accessor<BlockMatrix, false>::set_value (typename Accessor<BlockMatrix, false>::value_type newval) const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); base_iterator->value() = newval; @@ -1621,13 +1641,13 @@ namespace BlockMatrixIterators void Accessor<BlockMatrix, false>::advance () { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); // Remember current row inside block - unsigned int local_row = base_iterator->row(); + size_type local_row = base_iterator->row(); // Advance one element inside the // current block @@ -1669,8 +1689,8 @@ namespace BlockMatrixIterators ++this->row_block; if (this->row_block == matrix->n_block_rows()) { - this->row_block = numbers::invalid_unsigned_int; - this->col_block = numbers::invalid_unsigned_int; + this->row_block = numbers::invalid_size_type; + this->col_block = numbers::invalid_size_type; return; } } @@ -1697,9 +1717,9 @@ namespace BlockMatrixIterators // have to have the same // base_iterator representation, but // valid iterators have to - return (((this->row_block == numbers::invalid_unsigned_int) + return (((this->row_block == numbers::invalid_size_type) && - (this->col_block == numbers::invalid_unsigned_int)) + (this->col_block == numbers::invalid_size_type)) || (base_iterator == a.base_iterator)); @@ -1810,7 +1830,7 @@ BlockMatrixBase<MatrixType>::block (const unsigned int row, template <class MatrixType> inline -unsigned int +typename BlockMatrixBase<MatrixType>::size_type BlockMatrixBase<MatrixType>::m () const { return row_block_indices.total_size(); @@ -1820,7 +1840,7 @@ BlockMatrixBase<MatrixType>::m () const template <class MatrixType> inline -unsigned int +typename BlockMatrixBase<MatrixType>::size_type BlockMatrixBase<MatrixType>::n () const { return column_block_indices.total_size(); @@ -1854,15 +1874,15 @@ BlockMatrixBase<MatrixType>::n_block_rows () const template <class MatrixType> inline void -BlockMatrixBase<MatrixType>::set (const unsigned int i, - const unsigned int j, +BlockMatrixBase<MatrixType>::set (const size_type i, + const size_type j, const value_type value) { prepare_set_operation(); Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); block(row_index.first,col_index.first).set (row_index.second, @@ -1876,8 +1896,8 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, +BlockMatrixBase<MatrixType>::set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<number> &values, const bool elide_zero_values) { @@ -1886,7 +1906,7 @@ BlockMatrixBase<MatrixType>::set (const std::vector<unsigned int> &row_indices, Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -1897,7 +1917,7 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::set (const std::vector<unsigned int> &indices, +BlockMatrixBase<MatrixType>::set (const std::vector<size_type> &indices, const FullMatrix<number> &values, const bool elide_zero_values) { @@ -1905,7 +1925,7 @@ BlockMatrixBase<MatrixType>::set (const std::vector<unsigned int> &indices, ExcDimensionMismatch(indices.size(), values.m())); Assert (values.n() == values.m(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) set (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -1916,10 +1936,10 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::set (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number> &values, - const bool elide_zero_values) +BlockMatrixBase<MatrixType>::set (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number> &values, + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1937,11 +1957,11 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values) +BlockMatrixBase<MatrixType>::set (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values) { prepare_set_operation(); @@ -1986,17 +2006,17 @@ BlockMatrixBase<MatrixType>::set (const unsigned int row, // is stored contiguously (in fact, // indices will be intermixed when it // comes from an element matrix). - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { double value = values[j]; if (value == 0 && elide_zero_values == true) continue; - const std::pair<unsigned int, unsigned int> + const std::pair<unsigned int, size_type> col_index = this->column_block_indices.global_to_local(col_indices[j]); - const unsigned int local_index = counter_within_block[col_index.first]++; + const size_type local_index = counter_within_block[col_index.first]++; column_indices[col_index.first][local_index] = col_index.second; column_values[col_index.first][local_index] = value; @@ -2005,7 +2025,7 @@ BlockMatrixBase<MatrixType>::set (const unsigned int row, #ifdef DEBUG // If in debug mode, do a check whether // the right length has been obtained. - unsigned int length = 0; + size_type length = 0; for (unsigned int i=0; i<this->n_block_cols(); ++i) length += counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); @@ -2016,7 +2036,7 @@ BlockMatrixBase<MatrixType>::set (const unsigned int row, // where we should start reading out // data. Now let's write the data into // the individual blocks! - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = this->row_block_indices.global_to_local (row); for (unsigned int block_col=0; block_col<n_block_cols(); ++block_col) { @@ -2037,8 +2057,8 @@ BlockMatrixBase<MatrixType>::set (const unsigned int row, template <class MatrixType> inline void -BlockMatrixBase<MatrixType>::add (const unsigned int i, - const unsigned int j, +BlockMatrixBase<MatrixType>::add (const size_type i, + const size_type j, const value_type value) { @@ -2055,7 +2075,7 @@ BlockMatrixBase<MatrixType>::add (const unsigned int i, (value == value_type())) return; - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); block(row_index.first,col_index.first).add (row_index.second, @@ -2069,17 +2089,17 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number> &values, - const bool elide_zero_values) +BlockMatrixBase<MatrixType>::add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number> &values, + const bool elide_zero_values) { Assert (row_indices.size() == values.m(), ExcDimensionMismatch(row_indices.size(), values.m())); Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -2090,15 +2110,15 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::add (const std::vector<unsigned int> &indices, - const FullMatrix<number> &values, - const bool elide_zero_values) +BlockMatrixBase<MatrixType>::add (const std::vector<size_type> &indices, + const FullMatrix<number> &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.n() == values.m(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) add (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -2109,10 +2129,10 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number> &values, - const bool elide_zero_values) +BlockMatrixBase<MatrixType>::add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number> &values, + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -2130,12 +2150,12 @@ template <class MatrixType> template <typename number> inline void -BlockMatrixBase<MatrixType>::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values, - const bool col_indices_are_sorted) +BlockMatrixBase<MatrixType>::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values, + const bool col_indices_are_sorted) { prepare_add_operation(); @@ -2147,24 +2167,24 @@ BlockMatrixBase<MatrixType>::add (const unsigned int row, #ifdef DEBUG // check whether indices really are // sorted. - unsigned int before = col_indices[0]; - for (unsigned int i=1; i<n_cols; ++i) + size_type before = col_indices[0]; + for (size_type i=1; i<n_cols; ++i) if (col_indices[i] <= before) Assert (false, ExcMessage ("Flag col_indices_are_sorted is set, but " "indices appear to not be sorted.")) else before = col_indices[i]; #endif - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = this->row_block_indices.global_to_local (row); if (this->n_block_cols() > 1) { - const unsigned int *first_block = Utilities::lower_bound (col_indices, - col_indices+n_cols, - this->column_block_indices.block_start(1)); + const size_type *first_block = Utilities::lower_bound (col_indices, + col_indices+n_cols, + this->column_block_indices.block_start(1)); - const unsigned int n_zero_block_indices = first_block - col_indices; + const size_type n_zero_block_indices = first_block - col_indices; block(row_index.first, 0).add (row_index.second, n_zero_block_indices, col_indices, @@ -2231,17 +2251,17 @@ BlockMatrixBase<MatrixType>::add (const unsigned int row, // block is stored contiguously (in // fact, data will be intermixed when // it comes from an element matrix). - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { double value = values[j]; if (value == 0 && elide_zero_values == true) continue; - const std::pair<unsigned int, unsigned int> + const std::pair<unsigned int, size_type> col_index = this->column_block_indices.global_to_local(col_indices[j]); - const unsigned int local_index = counter_within_block[col_index.first]++; + const size_type local_index = counter_within_block[col_index.first]++; column_indices[col_index.first][local_index] = col_index.second; column_values[col_index.first][local_index] = value; @@ -2250,7 +2270,7 @@ BlockMatrixBase<MatrixType>::add (const unsigned int row, #ifdef DEBUG // If in debug mode, do a check whether // the right length has been obtained. - unsigned int length = 0; + size_type length = 0; for (unsigned int i=0; i<this->n_block_cols(); ++i) length += counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); @@ -2261,7 +2281,7 @@ BlockMatrixBase<MatrixType>::add (const unsigned int row, // where we should start reading out // data. Now let's write the data into // the individual blocks! - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = this->row_block_indices.global_to_local (row); for (unsigned int block_col=0; block_col<n_block_cols(); ++block_col) { @@ -2311,10 +2331,10 @@ BlockMatrixBase<MatrixType>::add (const value_type factor, template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::value_type -BlockMatrixBase<MatrixType>::operator () (const unsigned int i, - const unsigned int j) const +BlockMatrixBase<MatrixType>::operator () (const size_type i, + const size_type j) const { - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); return block(row_index.first,col_index.first) (row_index.second, @@ -2326,10 +2346,10 @@ BlockMatrixBase<MatrixType>::operator () (const unsigned int i, template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::value_type -BlockMatrixBase<MatrixType>::el (const unsigned int i, - const unsigned int j) const +BlockMatrixBase<MatrixType>::el (const size_type i, + const size_type j) const { - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); return block(row_index.first,col_index.first).el (row_index.second, @@ -2341,12 +2361,12 @@ BlockMatrixBase<MatrixType>::el (const unsigned int i, template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::value_type -BlockMatrixBase<MatrixType>::diag_element (const unsigned int i) const +BlockMatrixBase<MatrixType>::diag_element (const size_type i) const { Assert (n_block_rows() == n_block_cols(), ExcNotQuadratic()); - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> index = row_block_indices.global_to_local (i); return block(index.first,index.first).diag_element(index.second); } @@ -2440,11 +2460,11 @@ vmult_block_block (BlockVectorType &dst, Assert (src.n_blocks() == n_block_cols(), ExcDimensionMismatch(src.n_blocks(), n_block_cols())); - for (unsigned int row=0; row<n_block_rows(); ++row) + for (size_type row=0; row<n_block_rows(); ++row) { block(row,0).vmult (dst.block(row), src.block(0)); - for (unsigned int col=1; col<n_block_cols(); ++col) + for (size_type col=1; col<n_block_cols(); ++col) block(row,col).vmult_add (dst.block(row), src.block(col)); }; @@ -2466,7 +2486,7 @@ vmult_nonblock_block (VectorType &dst, ExcDimensionMismatch(src.n_blocks(), n_block_cols())); block(0,0).vmult (dst, src.block(0)); - for (unsigned int col=1; col<n_block_cols(); ++col) + for (size_type col=1; col<n_block_cols(); ++col) block(0,col).vmult_add (dst, src.block(col)); } @@ -2485,7 +2505,7 @@ vmult_block_nonblock (BlockVectorType &dst, Assert (1 == n_block_cols(), ExcDimensionMismatch(1, n_block_cols())); - for (unsigned int row=0; row<n_block_rows(); ++row) + for (size_type row=0; row<n_block_rows(); ++row) block(row,0).vmult (dst.block(row), src); } @@ -2543,7 +2563,7 @@ Tvmult_block_block (BlockVectorType &dst, dst = 0.; - for (unsigned int row=0; row<n_block_rows(); ++row) + for (unsigned int row=0; row<n_block_rows(); ++row) { for (unsigned int col=0; col<n_block_cols(); ++col) block(row,col).Tvmult_add (dst.block(col), @@ -2589,7 +2609,7 @@ Tvmult_nonblock_block (VectorType &dst, block(0,0).Tvmult (dst, src.block(0)); - for (unsigned int row=1; row<n_block_rows(); ++row) + for (size_type row=1; row<n_block_rows(); ++row) block(row,0).Tvmult_add (dst, src.block(row)); } @@ -2709,19 +2729,19 @@ residual (BlockVectorType &dst, x.block(0), b.block(row)); - for (unsigned int i=0; i<dst.block(row).size(); ++i) + for (size_type i=0; i<dst.block(row).size(); ++i) dst.block(row)(i) = -dst.block(row)(i); for (unsigned int col=1; col<n_block_cols(); ++col) block(row,col).vmult_add (dst.block(row), x.block(col)); - for (unsigned int i=0; i<dst.block(row).size(); ++i) + for (size_type i=0; i<dst.block(row).size(); ++i) dst.block(row)(i) = -dst.block(row)(i); }; value_type res = 0; - for (unsigned int row=0; row<n_block_rows(); ++row) + for (size_type row=0; row<n_block_rows(); ++row) res += dst.block(row).norm_sqr (); return std::sqrt(res); } @@ -2769,7 +2789,7 @@ BlockMatrixBase<MatrixType>::end () const template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::const_iterator -BlockMatrixBase<MatrixType>::begin (const unsigned int r) const +BlockMatrixBase<MatrixType>::begin (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); return const_iterator(this, r); @@ -2780,7 +2800,7 @@ BlockMatrixBase<MatrixType>::begin (const unsigned int r) const template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::const_iterator -BlockMatrixBase<MatrixType>::end (const unsigned int r) const +BlockMatrixBase<MatrixType>::end (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); return const_iterator(this, r+1); @@ -2811,7 +2831,7 @@ BlockMatrixBase<MatrixType>::end () template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::iterator -BlockMatrixBase<MatrixType>::begin (const unsigned int r) +BlockMatrixBase<MatrixType>::begin (const size_type r) { Assert (r<m(), ExcIndexRange(r,0,m())); return iterator(this, r); @@ -2822,7 +2842,7 @@ BlockMatrixBase<MatrixType>::begin (const unsigned int r) template <class MatrixType> inline typename BlockMatrixBase<MatrixType>::iterator -BlockMatrixBase<MatrixType>::end (const unsigned int r) +BlockMatrixBase<MatrixType>::end (const size_type r) { Assert (r<m(), ExcIndexRange(r,0,m())); return iterator(this, r+1); @@ -2834,8 +2854,8 @@ template <class MatrixType> void BlockMatrixBase<MatrixType>::collect_sizes () { - std::vector<unsigned int> row_sizes (this->n_block_rows()); - std::vector<unsigned int> col_sizes (this->n_block_cols()); + std::vector<size_type> row_sizes (this->n_block_rows()); + std::vector<size_type> col_sizes (this->n_block_cols()); // first find out the row sizes // from the first block column diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix.h b/deal.II/include/deal.II/lac/block_sparse_matrix.h index 5bc235ae13..e5f91ad22b 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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_sparse_matrix_h #define __deal2__block_sparse_matrix_h @@ -204,7 +209,7 @@ public: * Return the number of entries * in a specific row. */ - unsigned int get_row_length (const unsigned int row) const; + size_type get_row_length (const size_type row) const; /** * Return the number of nonzero @@ -215,7 +220,7 @@ public: * the entries should happen to * be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the number of actually @@ -224,7 +229,7 @@ public: * (with absolute value larger than * threshold) of all the blocks. */ - unsigned int n_actually_nonzero_elements (const double threshold = 0.0) const; + size_type n_actually_nonzero_elements (const double threshold = 0.0) const; /** * Return a (constant) reference @@ -470,8 +475,8 @@ BlockSparseMatrix<number>::operator = (const double d) { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) this->block(r,c) = d; return *this; @@ -596,7 +601,7 @@ precondition_Jacobi (BlockVectorType &dst, // do a diagonal preconditioning. uses only // the diagonal blocks of the matrix - for (unsigned int i=0; i<this->n_block_rows(); ++i) + for (size_type i=0; i<this->n_block_rows(); ++i) this->block(i,i).precondition_Jacobi (dst.block(i), src.block(i), omega); diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h b/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h index c50ac4fc00..73b3fba701 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix.templates.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__block_sparse_matrix_templates_h #define __deal2__block_sparse_matrix_templates_h @@ -60,8 +65,8 @@ operator = (const BlockSparseMatrix<number> &m) // anything except than checking // whether the base objects want to // do something - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) this->block(r,c) = m.block(r,c); return *this; @@ -100,8 +105,8 @@ reinit (const BlockSparsityPattern &sparsity) sparsity.n_block_cols()); // and reinitialize the blocks - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { BlockType *p = new SparseMatrix<number>(); p->reinit (sparsity.block(r,c)); @@ -115,8 +120,8 @@ template <typename number> bool BlockSparseMatrix<number>::empty () const { - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) if (this->block(r,c).empty () == false) return false; @@ -127,8 +132,8 @@ BlockSparseMatrix<number>::empty () const template <typename number> -unsigned int -BlockSparseMatrix<number>::get_row_length (const unsigned int row) const +typename BlockSparseMatrix<number>::size_type +BlockSparseMatrix<number>::get_row_length (const size_type row) const { return sparsity_pattern->row_length(row); } @@ -136,7 +141,7 @@ BlockSparseMatrix<number>::get_row_length (const unsigned int row) const template <typename number> -unsigned int +typename BlockSparseMatrix<number>::size_type BlockSparseMatrix<number>::n_nonzero_elements () const { return sparsity_pattern->n_nonzero_elements (); @@ -145,12 +150,12 @@ BlockSparseMatrix<number>::n_nonzero_elements () const template <typename number> -unsigned int +typename BlockSparseMatrix<number>::size_type BlockSparseMatrix<number>::n_actually_nonzero_elements (const double threshold) const { - unsigned int count = 0; - for (unsigned int i=0; i<this->n_block_rows(); ++i) - for (unsigned int j=0; j<this->n_block_cols(); ++j) + size_type count = 0; + for (size_type i=0; i<this->n_block_rows(); ++i) + for (size_type j=0; j<this->n_block_cols(); ++j) count += this->sub_objects[i][j]->n_actually_nonzero_elements (threshold); return count; @@ -177,8 +182,8 @@ print_formatted (std::ostream &out, const char *zero_string, const double denominator) const { - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { out << "Component (" << r << "," << c << ")" << std::endl; this->block(r,c).print_formatted (out, precision, scientific, @@ -194,8 +199,8 @@ BlockSparseMatrix<number>::memory_consumption () const { std::size_t mem = sizeof(*this); mem += MemoryConsumption::memory_consumption (this->sub_objects); - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) mem += MemoryConsumption::memory_consumption(*this->sub_objects[r][c]); return mem; diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h index c42d51ece1..a056125fb4 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 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__block_sparse_matrix_ez_h #define __deal2__block_sparse_matrix_ez_h @@ -47,6 +52,11 @@ template<typename Number> class BlockSparseMatrixEZ : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor. The * result is an empty object with @@ -189,7 +199,7 @@ public: * space. It is the sum of rows * of the rows of sub-matrices. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return number of columns of @@ -199,7 +209,7 @@ public: * columns of the columns of * sub-matrices. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Return the dimension of the @@ -207,7 +217,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int m () const; + size_type m () const; /** * Return the dimension of the @@ -215,7 +225,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int n () const; + size_type n () const; /** * Set the element <tt>(i,j)</tt> @@ -226,8 +236,8 @@ public: * allowed to store zero values * in non-existent fields. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const Number value); /** @@ -239,7 +249,7 @@ public: * is allowed to store zero * values in non-existent fields. */ - void add (const unsigned int i, const unsigned int j, + void add (const size_type i, const size_type j, const Number value); @@ -338,7 +348,7 @@ BlockSparseMatrixEZ<Number>::n_block_rows () const template <typename Number> inline -unsigned int +typename BlockSparseMatrixEZ<Number>::size_type BlockSparseMatrixEZ<Number>::n_rows () const { return row_indices.total_size(); @@ -358,7 +368,7 @@ BlockSparseMatrixEZ<Number>::n_block_cols () const template <typename Number> inline -unsigned int +typename BlockSparseMatrixEZ<Number>::size_type BlockSparseMatrixEZ<Number>::n_cols () const { return column_indices.total_size(); @@ -396,7 +406,7 @@ BlockSparseMatrixEZ<Number>::block (const unsigned int row, template <typename Number> inline -unsigned int +typename BlockSparseMatrixEZ<Number>::size_type BlockSparseMatrixEZ<Number>::m () const { return n_rows(); @@ -406,7 +416,7 @@ BlockSparseMatrixEZ<Number>::m () const template <typename Number> inline -unsigned int +typename BlockSparseMatrixEZ<Number>::size_type BlockSparseMatrixEZ<Number>::n () const { return n_cols(); @@ -417,14 +427,14 @@ BlockSparseMatrixEZ<Number>::n () const template <typename Number> inline void -BlockSparseMatrixEZ<Number>::set (const unsigned int i, - const unsigned int j, +BlockSparseMatrixEZ<Number>::set (const size_type i, + const size_type j, const Number value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); block(row_index.first,col_index.first).set (row_index.second, @@ -437,14 +447,14 @@ BlockSparseMatrixEZ<Number>::set (const unsigned int i, template <typename Number> inline void -BlockSparseMatrixEZ<Number>::add (const unsigned int i, - const unsigned int j, +BlockSparseMatrixEZ<Number>::add (const size_type i, + const size_type j, const Number value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const std::pair<unsigned int,unsigned int> + const std::pair<unsigned int,size_type> row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); block(row_index.first,col_index.first).add (row_index.second, @@ -530,11 +540,9 @@ Tvmult_add (BlockVector<somenumber> &dst, ExcDimensionMismatch(src.n_blocks(), n_block_rows())); for (unsigned int row=0; row<n_block_rows(); ++row) - { - for (unsigned int col=0; col<n_block_cols(); ++col) - block(row,col).Tvmult_add (dst.block(col), - src.block(row)); - }; + for (unsigned int col=0; col<n_block_cols(); ++col) + block(row,col).Tvmult_add (dst.block(col), + src.block(row)); } @@ -544,18 +552,18 @@ inline void BlockSparseMatrixEZ<number>::print_statistics (STREAM &out, bool full) { - unsigned int used_total = 0; - unsigned int allocated_total = 0; - unsigned int reserved_total = 0; - std::vector<unsigned int> used_by_line_total; - - unsigned int used; - unsigned int allocated; - unsigned int reserved; - std::vector<unsigned int> used_by_line; - - for (unsigned int i=0; i<n_block_rows(); ++i) - for (unsigned int j=0; j<n_block_cols(); ++j) + size_type used_total = 0; + size_type allocated_total = 0; + size_type reserved_total = 0; + std::vector<size_type> used_by_line_total; + + size_type used; + size_type allocated; + size_type reserved; + std::vector<size_type> used_by_line; + + for (size_type i=0; i<n_block_rows(); ++i) + for (size_type j=0; j<n_block_cols(); ++j) { used_by_line.clear(); out << "block:\t" << i << '\t' << j << std::endl; @@ -573,7 +581,7 @@ BlockSparseMatrixEZ<number>::print_statistics (STREAM &out, bool full) if (full) { used_by_line_total.resize(used_by_line.size()); - for (unsigned int i=0; i< used_by_line.size(); ++i) + for (size_type i=0; i< used_by_line.size(); ++i) if (used_by_line[i] != 0) { out << "row-entries\t" << i @@ -587,7 +595,7 @@ BlockSparseMatrixEZ<number>::print_statistics (STREAM &out, bool full) << "used:" << used_total << std::endl << "allocated:" << allocated_total << std::endl << "reserved:" << reserved_total << std::endl; - for (unsigned int i=0; i< used_by_line_total.size(); ++i) + for (size_type i=0; i< used_by_line_total.size(); ++i) if (used_by_line_total[i] != 0) { out << "row-entries\t" << i diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h index 033773ee16..49ec8b7cca 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_sparse_matrix_ez_templates_h #define __deal2__block_sparse_matrix_ez_templates_h @@ -137,8 +142,8 @@ BlockSparseMatrixEZ<number>::collect_sizes () { const unsigned int rows = n_block_rows(); const unsigned int columns = n_block_cols(); - std::vector<unsigned int> row_sizes (rows); - std::vector<unsigned int> col_sizes (columns); + std::vector<size_type> row_sizes (rows); + std::vector<size_type> col_sizes (columns); // first find out the row sizes // from the first block column diff --git a/deal.II/include/deal.II/lac/block_sparsity_pattern.h b/deal.II/include/deal.II/lac/block_sparsity_pattern.h index 21ee9f7a5b..392eaa4fca 100644 --- a/deal.II/include/deal.II/lac/block_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/block_sparsity_pattern.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__block_sparsity_pattern_h #define __deal2__block_sparsity_pattern_h @@ -72,7 +77,7 @@ namespace TrilinosWrappers * You will in general not want to use this class, but one of the * derived classes. * - * @todo Handle opitmization of diagonal elements of the underlying + * @todo Handle optimization of diagonal elements of the underlying * SparsityPattern correctly. * * @see @ref GlossBlockLA "Block (linear algebra)" @@ -82,6 +87,11 @@ template <class SparsityPatternBase> class BlockSparsityPatternBase : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Define a value which is used * to indicate that a certain @@ -94,7 +104,7 @@ public: * the respective value of the * SparsityPattern class. */ - static const unsigned int invalid_entry = SparsityPattern::invalid_entry; + static const size_type invalid_entry = SparsityPattern::invalid_entry; /** * Initialize the matrix empty, @@ -116,8 +126,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockSparsityPatternBase (const unsigned int n_block_rows, - const unsigned int n_block_columns); + BlockSparsityPatternBase (const size_type n_block_rows, + const size_type n_block_columns); /** * Copy constructor. This @@ -163,8 +173,8 @@ public: * user call whatever function * she desires. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + void reinit (const size_type n_block_rows, + const size_type n_block_columns); /** * Copy operator. For this the @@ -195,8 +205,8 @@ public: * given coordinates. */ SparsityPatternBase & - block (const unsigned int row, - const unsigned int column); + block (const size_type row, + const size_type column); /** @@ -205,8 +215,8 @@ public: * constant objects. */ const SparsityPatternBase & - block (const unsigned int row, - const unsigned int column) const; + block (const size_type row, + const size_type column) const; /** * Grant access to the object @@ -239,13 +249,13 @@ public: * Return the number of blocks in a * column. */ - unsigned int n_block_rows () const; + size_type n_block_rows () const; /** * Return the number of blocks in a * row. */ - unsigned int n_block_cols () const; + size_type n_block_cols () const; /** * Return whether the object is @@ -268,7 +278,7 @@ public: * blocks in a row, and the * maximum over all rows. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the matrix. @@ -282,7 +292,7 @@ public: * to which block <tt>(i,j)</tt> belongs * and then relays to that block. */ - void add (const unsigned int i, const unsigned int j); + void add (const size_type i, const size_type j); /** * Add several nonzero entries to the @@ -300,10 +310,10 @@ public: * blocks. */ template <typename ForwardIterator> - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted = false); /** * Return number of rows of this @@ -313,7 +323,7 @@ public: * of the (block-)rows of * sub-matrices. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return number of columns of @@ -323,13 +333,13 @@ public: * columns of the (block-)columns * of sub-matrices. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const unsigned int i, const unsigned int j) const; + bool exists (const size_type i, const size_type j) const; /** * Number of entries in a @@ -337,7 +347,7 @@ public: * all the blocks that form this * row. */ - unsigned int row_length (const unsigned int row) const; + unsigned int row_length (const size_type row) const; /** * Return the number of nonzero @@ -358,7 +368,7 @@ public: * the sum of the values as * returned by the sub-objects. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Print the sparsity of the @@ -410,12 +420,12 @@ protected: /** * Number of block rows. */ - unsigned int rows; + size_type rows; /** * Number of block columns. */ - unsigned int columns; + size_type columns; /** * Array of sparsity patterns. @@ -445,7 +455,7 @@ private: * individual blocks when doing a * collective add or set. */ - std::vector<unsigned int> counter_within_block; + std::vector<size_type > counter_within_block; /** * Temporary vector for column @@ -453,7 +463,7 @@ private: * local to global data on each * sparse matrix. */ - std::vector<std::vector<unsigned int> > block_column_indices; + std::vector<std::vector<size_type > > block_column_indices; /** * Make the block sparse matrix a @@ -501,15 +511,15 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Forwarding to * BlockSparsityPatternBase::reinit(). */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + void reinit (const size_type n_block_rows, + const size_type n_block_columns); /** * Initialize the pattern with @@ -672,8 +682,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockCompressedSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockCompressedSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -686,8 +696,8 @@ public: * and then entering the index * values. */ - BlockCompressedSparsityPattern (const std::vector<unsigned int> &row_block_sizes, - const std::vector<unsigned int> &col_block_sizes); + BlockCompressedSparsityPattern (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Initialize the pattern with @@ -713,8 +723,8 @@ public: * <tt>row_block_sizes[i]</tt> * times <tt>col_block_sizes[j]</tt>. */ - void reinit (const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes); + void reinit (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Resize the matrix to a tensor @@ -789,8 +799,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockCompressedSetSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockCompressedSetSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -803,8 +813,8 @@ public: * and then entering the index * values. */ - BlockCompressedSetSparsityPattern (const std::vector<unsigned int> &row_block_sizes, - const std::vector<unsigned int> &col_block_sizes); + BlockCompressedSetSparsityPattern (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Initialize the pattern with @@ -830,8 +840,8 @@ public: * <tt>row_block_sizes[i]</tt> * times <tt>col_block_sizes[j]</tt>. */ - void reinit (const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes); + void reinit (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Resize the matrix to a tensor @@ -899,8 +909,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockCompressedSimpleSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockCompressedSimpleSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -913,8 +923,8 @@ public: * and then entering the index * values. */ - BlockCompressedSimpleSparsityPattern (const std::vector<unsigned int> &row_block_sizes, - const std::vector<unsigned int> &col_block_sizes); + BlockCompressedSimpleSparsityPattern (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Initialize the pattern with symmetric @@ -945,8 +955,8 @@ public: * <tt>row_block_sizes[i]</tt> * times <tt>col_block_sizes[j]</tt>. */ - void reinit (const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes); + void reinit (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Resize the pattern with symmetric @@ -962,8 +972,8 @@ public: * Return the column number of * the @p index th entry in row @p row. */ - unsigned int column_number (const unsigned int row, - const unsigned int index) const; + size_type column_number (const size_type row, + const unsigned int index) const; /** * Allow the use of the reinit @@ -1025,8 +1035,8 @@ namespace TrilinosWrappers * to call collect_sizes() after * you assign them sizes. */ - BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -1039,8 +1049,8 @@ namespace TrilinosWrappers * and then entering the index * values. */ - BlockSparsityPattern (const std::vector<unsigned int> &row_block_sizes, - const std::vector<unsigned int> &col_block_sizes); + BlockSparsityPattern (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Initialize the pattern with an array @@ -1087,8 +1097,8 @@ namespace TrilinosWrappers * <tt>row_block_sizes[i]</tt> * times <tt>col_block_sizes[j]</tt>. */ - void reinit (const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes); + void reinit (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes); /** * Resize the matrix to a square tensor @@ -1129,8 +1139,8 @@ namespace TrilinosWrappers template <class SparsityPatternBase> inline SparsityPatternBase & -BlockSparsityPatternBase<SparsityPatternBase>::block (const unsigned int row, - const unsigned int column) +BlockSparsityPatternBase<SparsityPatternBase>::block (const size_type row, + const size_type column) { Assert (row<rows, ExcIndexRange(row,0,rows)); Assert (column<columns, ExcIndexRange(column,0,columns)); @@ -1142,8 +1152,8 @@ BlockSparsityPatternBase<SparsityPatternBase>::block (const unsigned int row, template <class SparsityPatternBase> inline const SparsityPatternBase & -BlockSparsityPatternBase<SparsityPatternBase>::block (const unsigned int row, - const unsigned int column) const +BlockSparsityPatternBase<SparsityPatternBase>::block (const size_type row, + const size_type column) const { Assert (row<rows, ExcIndexRange(row,0,rows)); Assert (column<columns, ExcIndexRange(column,0,columns)); @@ -1175,13 +1185,13 @@ BlockSparsityPatternBase<SparsityPatternBase>::get_column_indices () const template <class SparsityPatternBase> inline void -BlockSparsityPatternBase<SparsityPatternBase>::add (const unsigned int i, - const unsigned int j) +BlockSparsityPatternBase<SparsityPatternBase>::add (const size_type i, + const size_type j) { // if you get an error here, are // you sure you called // <tt>collect_sizes()</tt> before? - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); sub_objects[row_index.first][col_index.first]->add (row_index.second, @@ -1193,10 +1203,10 @@ BlockSparsityPatternBase<SparsityPatternBase>::add (const unsigned int i, template <class SparsityPatternBase> template <typename ForwardIterator> void -BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted) +BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted) { // Resize scratch arrays if (block_column_indices.size() < this->n_block_cols()) @@ -1205,7 +1215,7 @@ BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int r counter_within_block.resize (this->n_block_cols()); } - const unsigned int n_cols = static_cast<unsigned int>(end - begin); + const size_type n_cols = static_cast<size_type>(end - begin); // Resize sub-arrays to n_cols. This // is a bit wasteful, but we resize @@ -1218,12 +1228,12 @@ BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int r // enough before actually going // through all of them. if (block_column_indices[0].size() < n_cols) - for (unsigned int i=0; i<this->n_block_cols(); ++i) + for (size_type i=0; i<this->n_block_cols(); ++i) block_column_indices[i].resize(n_cols); // Reset the number of added elements // in each block to zero. - for (unsigned int i=0; i<this->n_block_cols(); ++i) + for (size_type i=0; i<this->n_block_cols(); ++i) counter_within_block[i] = 0; // Go through the column indices to @@ -1237,12 +1247,12 @@ BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int r // comes from an element matrix). for (ForwardIterator it = begin; it != end; ++it) { - const unsigned int col = *it; + const size_type col = *it; - const std::pair<unsigned int, unsigned int> + const std::pair<size_type , size_type> col_index = this->column_indices.global_to_local(col); - const unsigned int local_index = counter_within_block[col_index.first]++; + const size_type local_index = counter_within_block[col_index.first]++; block_column_indices[col_index.first][local_index] = col_index.second; } @@ -1250,8 +1260,8 @@ BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int r #ifdef DEBUG // If in debug mode, do a check whether // the right length has been obtained. - unsigned int length = 0; - for (unsigned int i=0; i<this->n_block_cols(); ++i) + size_type length = 0; + for (size_type i=0; i<this->n_block_cols(); ++i) length += counter_within_block[i]; Assert (length == n_cols, ExcInternalError()); #endif @@ -1261,9 +1271,9 @@ BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int r // where we should start reading out // data. Now let's write the data into // the individual blocks! - const std::pair<unsigned int,unsigned int> + const std::pair<size_type , size_type> row_index = this->row_indices.global_to_local (row); - for (unsigned int block_col=0; block_col<n_block_cols(); ++block_col) + for (size_type block_col=0; block_col<n_block_cols(); ++block_col) { if (counter_within_block[block_col] == 0) continue; @@ -1280,13 +1290,13 @@ BlockSparsityPatternBase<SparsityPatternBase>::add_entries (const unsigned int r template <class SparsityPatternBase> inline bool -BlockSparsityPatternBase<SparsityPatternBase>::exists (const unsigned int i, - const unsigned int j) const +BlockSparsityPatternBase<SparsityPatternBase>::exists (const size_type i, + const size_type j) const { // if you get an error here, are // you sure you called // <tt>collect_sizes()</tt> before? - const std::pair<unsigned int,unsigned int> + const std::pair<size_type , size_type> row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); return sub_objects[row_index.first][col_index.first]->exists (row_index.second, @@ -1299,14 +1309,14 @@ template <class SparsityPatternBase> inline unsigned int BlockSparsityPatternBase<SparsityPatternBase>:: -row_length (const unsigned int row) const +row_length (const size_type row) const { - const std::pair<unsigned int,unsigned int> + const std::pair<size_type , size_type> row_index = row_indices.global_to_local (row); unsigned int c = 0; - for (unsigned int b=0; b<rows; ++b) + for (size_type b=0; b<rows; ++b) c += sub_objects[row_index.first][b]->row_length (row_index.second); return c; @@ -1316,7 +1326,7 @@ row_length (const unsigned int row) const template <class SparsityPatternBase> inline -unsigned int +typename BlockSparsityPatternBase<SparsityPatternBase>::size_type BlockSparsityPatternBase<SparsityPatternBase>::n_block_cols () const { return columns; @@ -1326,7 +1336,7 @@ BlockSparsityPatternBase<SparsityPatternBase>::n_block_cols () const template <class SparsityPatternBase> inline -unsigned int +typename BlockSparsityPatternBase<SparsityPatternBase>::size_type BlockSparsityPatternBase<SparsityPatternBase>::n_block_rows () const { return rows; @@ -1334,23 +1344,25 @@ BlockSparsityPatternBase<SparsityPatternBase>::n_block_rows () const inline -unsigned int -BlockCompressedSimpleSparsityPattern::column_number (const unsigned int row, +BlockCompressedSimpleSparsityPattern::size_type +BlockCompressedSimpleSparsityPattern::column_number (const size_type row, const unsigned int index) const { // .first= ith block, .second = jth row in that block - const std::pair<unsigned int,unsigned int> + const std::pair<size_type ,size_type > row_index = row_indices.global_to_local (row); Assert(index<row_length(row), ExcIndexRange(index, 0, row_length(row))); - unsigned int c = 0; + size_type c = 0; + size_type block_columns = 0; //sum of n_cols for all blocks to the left for (unsigned int b=0; b<columns; ++b) { unsigned int rowlen = sub_objects[row_index.first][b]->row_length (row_index.second); if (index<c+rowlen) - return c+sub_objects[row_index.first][b]->column_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()); @@ -1361,8 +1373,8 @@ BlockCompressedSimpleSparsityPattern::column_number (const unsigned int row, inline void BlockSparsityPattern::reinit ( - const unsigned int n_block_rows, - const unsigned int n_block_columns) + const size_type n_block_rows, + const size_type n_block_columns) { BlockSparsityPatternBase<SparsityPattern>::reinit ( n_block_rows, n_block_columns); diff --git a/deal.II/include/deal.II/lac/block_vector.h b/deal.II/include/deal.II/lac/block_vector.h index 9d71854108..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 @@ -102,7 +107,7 @@ public: * sizes. */ explicit BlockVector (const unsigned int num_blocks = 0, - const unsigned int block_size = 0); + const size_type block_size = 0); /** * Copy-Constructor. Dimension set to @@ -157,7 +162,7 @@ public: * <tt>block_sizes[i]</tt> zero * elements. */ - BlockVector (const std::vector<unsigned int> &block_sizes); + BlockVector (const std::vector<size_type> &block_sizes); /** * Constructor. Initialize vector @@ -185,7 +190,7 @@ public: * different blocks. */ template <typename InputIterator> - BlockVector (const std::vector<unsigned int> &n, + BlockVector (const std::vector<size_type> &n, const InputIterator first, const InputIterator end); @@ -271,7 +276,7 @@ public: * is filled with zeros. */ void reinit (const unsigned int num_blocks, - const unsigned int block_size = 0, + const size_type block_size = 0, const bool fast = false); /** @@ -305,8 +310,8 @@ public: * since they may be routed to * the wrong block. */ - void reinit (const std::vector<unsigned int> &N, - const bool fast=false); + void reinit (const std::vector<size_type> &N, + const bool fast=false); /** * Reinitialize the BlockVector @@ -470,7 +475,7 @@ public: template <typename Number> template <typename InputIterator> -BlockVector<Number>::BlockVector (const std::vector<unsigned int> &n, +BlockVector<Number>::BlockVector (const std::vector<size_type> &n, const InputIterator first, const InputIterator end) { @@ -479,7 +484,7 @@ BlockVector<Number>::BlockVector (const std::vector<unsigned int> &n, // copy elements soon reinit (n, true); InputIterator start = first; - for (unsigned int b=0; b<n.size(); ++b) + for (size_type b=0; b<n.size(); ++b) { InputIterator end = start; std::advance (end, static_cast<signed int>(n[b])); @@ -543,7 +548,7 @@ template <typename Number> inline void BlockVector<Number>::compress (::dealii::VectorOperation::values operation) { - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].compress(operation); } @@ -555,7 +560,7 @@ void BlockVector<Number>::scale (const value_type factor) Assert (numbers::is_finite(factor), ExcNumberNotFinite()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] *= factor; } 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 0e000748e4..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 @@ -23,7 +28,7 @@ DEAL_II_NAMESPACE_OPEN template <typename Number> BlockVector<Number>::BlockVector (const unsigned int n_blocks, - const unsigned int block_size) + const size_type block_size) { reinit (n_blocks, block_size); } @@ -31,7 +36,7 @@ BlockVector<Number>::BlockVector (const unsigned int n_blocks, template <typename Number> -BlockVector<Number>::BlockVector (const std::vector<unsigned int> &n) +BlockVector<Number>::BlockVector (const std::vector<size_type> &n) { reinit (n, false); } @@ -52,7 +57,7 @@ BlockVector<Number>::BlockVector (const BlockVector<Number> &v) this->components.resize (v.n_blocks()); this->block_indices = v.block_indices; - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.components[i]; } @@ -78,7 +83,7 @@ BlockVector<Number>::BlockVector (const TrilinosWrappers::BlockVector &v) this->block_indices = v.get_block_indices(); this->components.resize(this->n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.block(i); BaseClass::collect_sizes(); @@ -89,23 +94,23 @@ BlockVector<Number>::BlockVector (const TrilinosWrappers::BlockVector &v) template <typename Number> void BlockVector<Number>::reinit (const unsigned int n_bl, - const unsigned int bl_sz, + const size_type bl_sz, const bool fast) { - std::vector<unsigned int> n(n_bl, bl_sz); + std::vector<size_type> n(n_bl, bl_sz); reinit(n, fast); } template <typename Number> -void BlockVector<Number>::reinit (const std::vector<unsigned int> &n, - const bool fast) +void BlockVector<Number>::reinit (const std::vector<size_type> &n, + const bool fast) { this->block_indices.reinit (n); if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].reinit(n[i], fast); } @@ -119,7 +124,7 @@ void BlockVector<Number>::reinit ( if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].reinit(n.block_size(i), fast); } @@ -133,7 +138,7 @@ void BlockVector<Number>::reinit (const BlockVector<Number2> &v, if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->block(i).reinit(v.block(i), fast); } @@ -161,7 +166,7 @@ void BlockVector<Number>::swap (BlockVector<Number> &v) Assert (this->n_blocks() == v.n_blocks(), ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) dealii::swap (this->components[i], v.components[i]); dealii::swap (this->block_indices, v.block_indices); } @@ -174,7 +179,7 @@ void BlockVector<Number>::print (std::ostream &out, const bool scientific, const bool across) const { - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) { if (across) out << 'C' << i << ':'; @@ -189,7 +194,7 @@ void BlockVector<Number>::print (std::ostream &out, template <typename Number> void BlockVector<Number>::block_write (std::ostream &out) const { - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].block_write(out); } @@ -198,7 +203,7 @@ void BlockVector<Number>::block_write (std::ostream &out) const template <typename Number> void BlockVector<Number>::block_read (std::istream &in) { - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].block_read(in); } 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 a512e1aa44..c66dfd4730 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 @@ -299,6 +304,11 @@ namespace internal typedef Iterator<BlockVectorType,!constness> InverseConstnessIterator; public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * Type of the number this * iterator points @@ -354,8 +364,8 @@ namespace internal * const or non-const * reference. */ - Iterator (BlockVector &parent, - const unsigned int global_index); + Iterator (BlockVector &parent, + const size_type global_index); /** * Copy constructor. @@ -382,12 +392,12 @@ namespace internal * the respective member * variables. */ - Iterator (BlockVector &parent, - const unsigned int global_index, - const unsigned int current_block, - const unsigned int index_within_block, - const unsigned int next_break_forward, - const unsigned int next_break_backward); + Iterator (BlockVector &parent, + const size_type global_index, + const size_type current_block, + const size_type index_within_block, + const size_type next_break_forward, + const size_type next_break_backward); public: @@ -614,7 +624,7 @@ namespace internal * element to which we * presently point. */ - unsigned int global_index; + size_type global_index; /** * Current block and index @@ -623,7 +633,7 @@ namespace internal * to. */ unsigned int current_block; - unsigned int index_within_block; + size_type index_within_block; /** * Indices of the global @@ -637,8 +647,8 @@ namespace internal * efficient than always * asking the parent object. */ - unsigned int next_break_forward; - unsigned int next_break_backward; + size_type next_break_forward; + size_type next_break_backward; /** * Move forward one element. @@ -734,8 +744,7 @@ public: typedef dealii::internal::BlockVectorIterators::Iterator<BlockVectorBase,true> const_iterator; typedef typename BlockType::reference reference; typedef typename BlockType::const_reference const_reference; - - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Declare a type that has holds @@ -844,7 +853,7 @@ public: * is the sum of the dimensions of all * components. */ - unsigned int size () const; + std::size_t size () const; /** * Return an index set that describes which elements of this vector @@ -895,20 +904,20 @@ public: /** * Access components, returns U(i). */ - value_type operator() (const unsigned int i) const; + value_type operator() (const size_type i) const; /** * Access components, returns U(i) * as a writeable reference. */ - reference operator() (const unsigned int i); + reference operator() (const size_type i); /** * Access components, returns U(i). * * Exactly the same as operator(). */ - value_type operator[] (const unsigned int i) const; + value_type operator[] (const size_type i) const; /** * Access components, returns U(i) @@ -916,7 +925,7 @@ public: * * Exactly the same as operator(). */ - reference operator[] (const unsigned int i); + reference operator[] (const size_type i); /** * Copy operator: fill all components of @@ -998,7 +1007,7 @@ public: * in the local range of this processor. * Asks the corresponding block. */ - bool in_local_range (const types::global_dof_index global_index) const; + bool in_local_range (const size_type global_index) const; /** * Return whether the vector contains only @@ -1044,8 +1053,8 @@ public: * indices. */ template <typename Number> - void add (const std::vector<unsigned int> &indices, - const std::vector<Number> &values); + void add (const std::vector<size_type> &indices, + const std::vector<Number> &values); /** * This is a second collective @@ -1055,8 +1064,8 @@ public: * values. */ template <typename Number> - void add (const std::vector<unsigned int> &indices, - const Vector<Number> &values); + void add (const std::vector<size_type> &indices, + const Vector<Number> &values); /** * Take an address where @@ -1068,9 +1077,9 @@ public: * functions above. */ template <typename Number> - void add (const unsigned int n_elements, - const unsigned int *indices, - const Number *values); + void add (const size_type n_elements, + const size_type *indices, + const Number *values); /** * $U(0-DIM)+=s$. Addition of <tt>s</tt> @@ -1265,11 +1274,11 @@ namespace internal inline Iterator<BlockVectorType,constness>:: Iterator (BlockVector &parent, - const unsigned int global_index, - const unsigned int current_block, - const unsigned int index_within_block, - const unsigned int next_break_forward, - const unsigned int next_break_backward) + const size_type global_index, + const size_type current_block, + const size_type index_within_block, + const size_type next_break_forward, + const size_type next_break_backward) : parent (&parent), global_index (global_index), @@ -1673,8 +1682,8 @@ namespace internal template <class BlockVectorType, bool constness> Iterator<BlockVectorType,constness>:: - Iterator (BlockVector &parent, - const unsigned int global_index) + Iterator (BlockVector &parent, + const size_type global_index) : parent (&parent), global_index (global_index) @@ -1687,7 +1696,7 @@ namespace internal // past-the-end if (global_index < parent.size()) { - const std::pair<unsigned int, unsigned int> + const std::pair<size_type, size_type> indices = parent.block_indices.global_to_local(global_index); current_block = indices.first; index_within_block = indices.second; @@ -1706,7 +1715,7 @@ namespace internal current_block = parent.n_blocks(); index_within_block = 0; next_break_backward = global_index; - next_break_forward = numbers::invalid_unsigned_int; + next_break_forward = numbers::invalid_size_type; }; } @@ -1738,7 +1747,7 @@ namespace internal // then move the next // boundary arbitrarily far // away - next_break_forward = numbers::invalid_unsigned_int; + next_break_forward = numbers::invalid_size_type; }; ++global_index; @@ -1772,7 +1781,7 @@ namespace internal // get into unspecified terrain { --current_block; - index_within_block = numbers::invalid_unsigned_int; + index_within_block = numbers::invalid_size_type; next_break_forward = 0; next_break_backward = 0; }; @@ -1795,7 +1804,7 @@ BlockVectorBase<VectorType>::BlockVectorBase () template <class VectorType> inline -unsigned int +std::size_t BlockVectorBase<VectorType>::size () const { return block_indices.total_size(); @@ -1810,16 +1819,12 @@ BlockVectorBase<VectorType>::locally_owned_elements () const { IndexSet is (size()); - // copy index sets from blocks into the global one + // copy index sets from blocks into the global one, shifted + // by the appropriate amount for each block for (unsigned int b=0; b<n_blocks(); ++b) { IndexSet x = block(b).locally_owned_elements(); - - //TODO: This can surely be made more efficient by just shifting - // x - for (unsigned int i=0; i<block(b).size(); ++i) - if (x.is_element(i)) - is.add_index(block_indices.local_to_global(b,i)); + is.add_indices(x, block_indices.block_start(b)); } is.compress(); @@ -1876,9 +1881,9 @@ inline void BlockVectorBase<VectorType>::collect_sizes () { - std::vector<unsigned int> sizes (n_blocks()); + std::vector<size_type> sizes (n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) sizes[i] = block(i).size(); block_indices.reinit(sizes); @@ -1949,9 +1954,9 @@ template <class VectorType> inline bool BlockVectorBase<VectorType>::in_local_range -(const types::global_dof_index global_index) const +(const size_type global_index) const { - const std::pair<unsigned int,unsigned int> local_index + const std::pair<size_type,size_type> local_index = block_indices.global_to_local (global_index); return components[local_index.first].in_local_range (global_index); @@ -1962,7 +1967,7 @@ template <class VectorType> bool BlockVectorBase<VectorType>::all_zero () const { - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) if (components[i].all_zero() == false) return false; @@ -1975,7 +1980,7 @@ template <class VectorType> bool BlockVectorBase<VectorType>::is_non_negative () const { - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) if (components[i].is_non_negative() == false) return false; @@ -1993,7 +1998,7 @@ operator * (const BlockVectorBase<VectorType> &v) const ExcDimensionMismatch(n_blocks(), v.n_blocks())); value_type sum = 0.; - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) sum += components[i]*v.components[i]; return sum; @@ -2005,7 +2010,7 @@ typename BlockVectorBase<VectorType>::real_type BlockVectorBase<VectorType>::norm_sqr () const { real_type sum = 0.; - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) sum += components[i].norm_sqr(); return sum; @@ -2018,7 +2023,7 @@ typename BlockVectorBase<VectorType>::value_type BlockVectorBase<VectorType>::mean_value () const { value_type sum = 0.; - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) sum += components[i].mean_value() * components[i].size(); return sum/size(); @@ -2031,7 +2036,7 @@ typename BlockVectorBase<VectorType>::real_type BlockVectorBase<VectorType>::l1_norm () const { real_type sum = 0.; - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) sum += components[i].l1_norm(); return sum; @@ -2053,7 +2058,7 @@ typename BlockVectorBase<VectorType>::real_type BlockVectorBase<VectorType>::linfty_norm () const { real_type sum = 0.; - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { value_type newval = components[i].linfty_norm(); if (sum<newval) @@ -2081,7 +2086,7 @@ BlockVectorBase<VectorType>::operator -= (const BlockVectorBase<VectorType> &v) Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i] -= v.components[i]; } @@ -2094,8 +2099,8 @@ template <class VectorType> template <typename Number> inline void -BlockVectorBase<VectorType>::add (const std::vector<unsigned int> &indices, - const std::vector<Number> &values) +BlockVectorBase<VectorType>::add (const std::vector<size_type> &indices, + const std::vector<Number> &values) { Assert (indices.size() == values.size(), ExcDimensionMismatch(indices.size(), values.size())); @@ -2108,13 +2113,13 @@ template <class VectorType> template <typename Number> inline void -BlockVectorBase<VectorType>::add (const std::vector<unsigned int> &indices, - const Vector<Number> &values) +BlockVectorBase<VectorType>::add (const std::vector<size_type> &indices, + const Vector<Number> &values) { Assert (indices.size() == values.size(), ExcDimensionMismatch(indices.size(), values.size())); - const unsigned int n_indices = indices.size(); - for (unsigned int i=0; i<n_indices; ++i) + const size_type n_indices = indices.size(); + for (size_type i=0; i<n_indices; ++i) (*this)(indices[i]) += values(i); } @@ -2124,11 +2129,11 @@ template <class VectorType> template <typename Number> inline void -BlockVectorBase<VectorType>::add (const unsigned int n_indices, - const unsigned int *indices, - const Number *values) +BlockVectorBase<VectorType>::add (const size_type n_indices, + const size_type *indices, + const Number *values) { - for (unsigned int i=0; i<n_indices; ++i) + for (size_type i=0; i<n_indices; ++i) (*this)(indices[i]) += values[i]; } @@ -2139,7 +2144,7 @@ void BlockVectorBase<VectorType>::add (const value_type a) { Assert (numbers::is_finite(a), ExcNumberNotFinite()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].add(a); } @@ -2153,7 +2158,7 @@ void BlockVectorBase<VectorType>::add (const BlockVectorBase<VectorType> &v) Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].add(v.components[i]); } @@ -2171,7 +2176,7 @@ void BlockVectorBase<VectorType>::add (const value_type a, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].add(a, v.components[i]); } @@ -2195,7 +2200,7 @@ void BlockVectorBase<VectorType>::add (const value_type a, ExcDimensionMismatch(n_blocks(), w.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].add(a, v.components[i], b, w.components[i]); } @@ -2213,7 +2218,7 @@ void BlockVectorBase<VectorType>::sadd (const value_type x, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].sadd(x, v.components[i]); } @@ -2232,7 +2237,7 @@ void BlockVectorBase<VectorType>::sadd (const value_type x, const value_type a, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].sadd(x, a, v.components[i]); } @@ -2256,7 +2261,7 @@ void BlockVectorBase<VectorType>::sadd (const value_type x, const value_type a, Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].sadd(x, a, v.components[i], b, w.components[i]); } @@ -2285,7 +2290,7 @@ void BlockVectorBase<VectorType>::sadd (const value_type x, const value_type a, Assert (n_blocks() == y.n_blocks(), ExcDimensionMismatch(n_blocks(), y.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].sadd(x, a, v.components[i], b, w.components[i], c, y.components[i]); @@ -2300,7 +2305,7 @@ void BlockVectorBase<VectorType>::scale (const BlockVector2 &v) { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].scale(v.block(i)); } @@ -2321,7 +2326,7 @@ void BlockVectorBase<VectorType>::equ (const value_type a, Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) { components[i].equ( a, v.components[i], b, w.components[i]); } @@ -2334,7 +2339,7 @@ std::size_t BlockVectorBase<VectorType>::memory_consumption () const { std::size_t mem = sizeof(this->n_blocks()); - for (unsigned int i=0; i<this->components.size(); ++i) + for (size_type i=0; i<this->components.size(); ++i) mem += MemoryConsumption::memory_consumption (this->components[i]); mem += MemoryConsumption::memory_consumption (this->block_indices); return mem; @@ -2353,7 +2358,7 @@ void BlockVectorBase<VectorType>::equ (const value_type a, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].equ( a, v.components[i]); } @@ -2362,7 +2367,7 @@ void BlockVectorBase<VectorType>::equ (const value_type a, template <class VectorType> void BlockVectorBase<VectorType>::update_ghost_values () const { - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) block(i).update_ghost_values (); } @@ -2375,7 +2380,7 @@ BlockVectorBase<VectorType>::operator = (const value_type s) Assert (numbers::is_finite(s), ExcNumberNotFinite()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i] = s; return *this; @@ -2388,7 +2393,7 @@ BlockVectorBase<VectorType>::operator = (const BlockVectorBase<VectorType> &v) { AssertDimension(n_blocks(), v.n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i] = v.components[i]; return *this; @@ -2402,7 +2407,7 @@ BlockVectorBase<VectorType>::operator = (const BlockVectorBase<VectorType2> &v) { AssertDimension(n_blocks(), v.n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i] = v.components[i]; return *this; @@ -2417,9 +2422,9 @@ BlockVectorBase<VectorType>::operator = (const VectorType &v) Assert (size() == v.size(), ExcDimensionMismatch(size(), v.size())); - unsigned int index_v = 0; - for (unsigned int b=0; b<n_blocks(); ++b) - for (unsigned int i=0; i<block(b).size(); ++i, ++index_v) + size_type index_v = 0; + for (size_type b=0; b<n_blocks(); ++b) + for (size_type i=0; i<block(b).size(); ++i, ++index_v) block(b)(i) = v(index_v); return *this; @@ -2436,7 +2441,7 @@ operator == (const BlockVectorBase<VectorType2> &v) const { Assert (block_indices == v.block_indices, ExcDifferentBlockIndices()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) if ( ! (components[i] == v.components[i])) return false; @@ -2453,7 +2458,7 @@ BlockVectorBase<VectorType>::operator *= (const value_type factor) Assert (numbers::is_finite(factor), ExcNumberNotFinite()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i] *= factor; return *this; @@ -2470,7 +2475,7 @@ BlockVectorBase<VectorType>::operator /= (const value_type factor) Assert (numbers::is_finite(factor), ExcNumberNotFinite()); Assert (factor > 0., ExcDivideByZero() ); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i] /= factor; return *this; @@ -2480,9 +2485,9 @@ BlockVectorBase<VectorType>::operator /= (const value_type factor) template <class VectorType> inline typename BlockVectorBase<VectorType>::value_type -BlockVectorBase<VectorType>::operator() (const unsigned int i) const +BlockVectorBase<VectorType>::operator() (const size_type i) const { - const std::pair<unsigned int,unsigned int> local_index + const std::pair<size_type,size_type> local_index = block_indices.global_to_local (i); return components[local_index.first](local_index.second); } @@ -2492,9 +2497,9 @@ BlockVectorBase<VectorType>::operator() (const unsigned int i) const template <class VectorType> inline typename BlockVectorBase<VectorType>::reference -BlockVectorBase<VectorType>::operator() (const unsigned int i) +BlockVectorBase<VectorType>::operator() (const size_type i) { - const std::pair<unsigned int,unsigned int> local_index + const std::pair<size_type,size_type> local_index = block_indices.global_to_local (i); return components[local_index.first](local_index.second); } @@ -2504,7 +2509,7 @@ BlockVectorBase<VectorType>::operator() (const unsigned int i) template <class VectorType> inline typename BlockVectorBase<VectorType>::value_type -BlockVectorBase<VectorType>::operator[] (const unsigned int i) const +BlockVectorBase<VectorType>::operator[] (const size_type i) const { return operator()(i); } @@ -2514,7 +2519,7 @@ BlockVectorBase<VectorType>::operator[] (const unsigned int i) const template <class VectorType> inline typename BlockVectorBase<VectorType>::reference -BlockVectorBase<VectorType>::operator[] (const unsigned int i) +BlockVectorBase<VectorType>::operator[] (const size_type i) { return operator()(i); } 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 8ceb359cfa..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<number,Constness> & value_type; + const Accessor<number,Constness> &value_type; /** * Constructor. Create an iterator into the matrix @p matrix for the given @@ -402,6 +407,11 @@ template <typename number> class ChunkSparseMatrix : public virtual Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * Type of matrix entries. In analogy to * the STL container classes. @@ -576,20 +586,20 @@ public: * Return the dimension of the image space. To remember: the matrix is of * dimension $m \times n$. */ - unsigned int m () const; + size_type m () const; /** * Return the dimension of the range space. To remember: the matrix is of * dimension $m \times n$. */ - unsigned int n () const; + size_type n () const; /** * Return the number of nonzero elements of this matrix. Actually, it * returns the number of entries in the sparsity pattern; if any of the * entries should happen to be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the number of actually nonzero elements of this matrix. @@ -598,7 +608,7 @@ public: * count all entries of the sparsity pattern but only the ones that are * nonzero. */ - unsigned int n_actually_nonzero_elements () const; + size_type n_actually_nonzero_elements () const; /** * Return a (constant) reference to the underlying sparsity pattern of this @@ -626,8 +636,8 @@ public: * entry does not exist or if <tt>value</tt> is not a finite number. Still, * it is allowed to store zero values in non-existent fields. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const number value); /** @@ -635,8 +645,8 @@ public: * entry does not exist or if <tt>value</tt> is not a finite number. Still, * it is allowed to store zero values in non-existent fields. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const number value); /** @@ -649,12 +659,12 @@ public: * i.e., zero values won't be added into the matrix. */ template <typename number2> - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Multiply the entire matrix by a fixed factor. @@ -760,8 +770,8 @@ public: * classes instead, since they are tailored better to a sparse matrix * structure. */ - number operator () (const unsigned int i, - const unsigned int j) const; + number operator () (const size_type i, + const size_type j) const; /** * This function is mostly like operator()() in that it returns the value of @@ -775,8 +785,8 @@ public: * classes instead, since they are tailored better to a sparse matrix * structure. */ - number el (const unsigned int i, - const unsigned int j) const; + number el (const size_type i, + const size_type j) const; /** * Return the main diagonal @@ -790,13 +800,13 @@ public: * each row and access therefore does not involve searching for the right * column number. */ - number diag_element (const unsigned int i) const; + number diag_element (const size_type i) const; /** * Same as above, but return a writeable reference. You're sure you know * what you do? */ - number &diag_element (const unsigned int i); + number &diag_element (const size_type i); //@} /** @@ -1015,8 +1025,8 @@ public: */ template <typename somenumber> void PSOR (Vector<somenumber> &v, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number om = 1.) const; /** @@ -1031,8 +1041,8 @@ public: */ template <typename somenumber> void TPSOR (Vector<somenumber> &v, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number om = 1.) const; /** @@ -1303,13 +1313,13 @@ private: * sparsity pattern with a smaller size to this object, using the reinit() * function. */ - unsigned int max_len; + size_type max_len; /** * Return the location of entry $(i,j)$ within the val array. */ - unsigned int compute_location (const unsigned int i, - const unsigned int j) const; + size_type compute_location (const size_type i, + const size_type j) const; // make all other sparse matrices friends template <typename somenumber> friend class ChunkSparseMatrix; @@ -1331,7 +1341,8 @@ private: template <typename number> inline -unsigned int ChunkSparseMatrix<number>::m () const +typename ChunkSparseMatrix<number>::size_type +ChunkSparseMatrix<number>::m () const { Assert (cols != 0, ExcNotInitialized()); return cols->rows; @@ -1340,7 +1351,8 @@ unsigned int ChunkSparseMatrix<number>::m () const template <typename number> inline -unsigned int ChunkSparseMatrix<number>::n () const +typename ChunkSparseMatrix<number>::size_type +ChunkSparseMatrix<number>::n () const { Assert (cols != 0, ExcNotInitialized()); return cols->cols; @@ -1361,13 +1373,13 @@ ChunkSparseMatrix<number>::get_sparsity_pattern () const template <typename number> inline -unsigned int -ChunkSparseMatrix<number>::compute_location (const unsigned int i, - const unsigned int j) const +typename ChunkSparseMatrix<number>::size_type +ChunkSparseMatrix<number>::compute_location (const size_type i, + const size_type j) const { - const unsigned int chunk_size = cols->get_chunk_size(); - const unsigned int chunk_index - = cols->sparsity_pattern(i/chunk_size, j/chunk_size); + const size_type chunk_size = cols->get_chunk_size(); + const size_type chunk_index + = cols->sparsity_pattern(i/chunk_size, j/chunk_size); if (chunk_index == ChunkSparsityPattern::invalid_entry) return ChunkSparsityPattern::invalid_entry; @@ -1384,8 +1396,8 @@ ChunkSparseMatrix<number>::compute_location (const unsigned int i, template <typename number> inline -void ChunkSparseMatrix<number>::set (const unsigned int i, - const unsigned int j, +void ChunkSparseMatrix<number>::set (const size_type i, + const size_type j, const number value) { @@ -1394,7 +1406,7 @@ void ChunkSparseMatrix<number>::set (const unsigned int i, Assert (cols != 0, ExcNotInitialized()); // it is allowed to set elements of the matrix that are not part of the // sparsity pattern, if the value to which we set it is zero - const unsigned int index = compute_location(i,j); + const size_type index = compute_location(i,j); Assert ((index != SparsityPattern::invalid_entry) || (value == 0.), ExcInvalidIndex(i,j)); @@ -1407,8 +1419,8 @@ void ChunkSparseMatrix<number>::set (const unsigned int i, template <typename number> inline -void ChunkSparseMatrix<number>::add (const unsigned int i, - const unsigned int j, +void ChunkSparseMatrix<number>::add (const size_type i, + const size_type j, const number value) { @@ -1418,7 +1430,7 @@ void ChunkSparseMatrix<number>::add (const unsigned int i, if (value != 0.) { - const unsigned int index = compute_location(i,j); + const size_type index = compute_location(i,j); Assert ((index != ChunkSparsityPattern::invalid_entry), ExcInvalidIndex(i,j)); @@ -1431,15 +1443,15 @@ void ChunkSparseMatrix<number>::add (const unsigned int i, template <typename number> template <typename number2> inline -void ChunkSparseMatrix<number>::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool /*elide_zero_values*/, - const bool /*col_indices_are_sorted*/) +void ChunkSparseMatrix<number>::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool /*elide_zero_values*/, + const bool /*col_indices_are_sorted*/) { // TODO: could be done more efficiently... - for (unsigned int col=0; col<n_cols; ++col) + for (size_type col=0; col<n_cols; ++col) add(row, col_indices[col], static_cast<number>(values[col])); } @@ -1453,7 +1465,7 @@ ChunkSparseMatrix<number>::operator *= (const number factor) Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); // multiply all elements of the matrix with the given factor. this includes // the padding elements in chunks that overlap the boundaries of the actual @@ -1483,7 +1495,7 @@ ChunkSparseMatrix<number>::operator /= (const number factor) const number factor_inv = 1. / factor; - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); // multiply all elements of the matrix with the given factor. this includes // the padding elements in chunks that overlap the boundaries of the actual @@ -1505,8 +1517,8 @@ ChunkSparseMatrix<number>::operator /= (const number factor) template <typename number> inline -number ChunkSparseMatrix<number>::operator () (const unsigned int i, - const unsigned int j) const +number ChunkSparseMatrix<number>::operator () (const size_type i, + const size_type j) const { Assert (cols != 0, ExcNotInitialized()); AssertThrow (compute_location(i,j) != SparsityPattern::invalid_entry, @@ -1518,11 +1530,11 @@ number ChunkSparseMatrix<number>::operator () (const unsigned int i, template <typename number> inline -number ChunkSparseMatrix<number>::el (const unsigned int i, - const unsigned int j) const +number ChunkSparseMatrix<number>::el (const size_type i, + const size_type j) const { Assert (cols != 0, ExcNotInitialized()); - const unsigned int index = compute_location(i,j); + const size_type index = compute_location(i,j); if (index != ChunkSparsityPattern::invalid_entry) return val[index]; @@ -1534,7 +1546,7 @@ number ChunkSparseMatrix<number>::el (const unsigned int i, template <typename number> inline -number ChunkSparseMatrix<number>::diag_element (const unsigned int i) const +number ChunkSparseMatrix<number>::diag_element (const size_type i) const { Assert (cols != 0, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); @@ -1542,7 +1554,7 @@ number ChunkSparseMatrix<number>::diag_element (const unsigned int i) const // Use that the first element in each row of a quadratic matrix is the main // diagonal of the chunk sparsity pattern - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); return val[cols->sparsity_pattern.rowstart[i/chunk_size] * chunk_size * chunk_size @@ -1561,13 +1573,13 @@ void ChunkSparseMatrix<number>::copy_from (const ForwardIterator begin, const ForwardIterator end) { - Assert (static_cast<unsigned int>(std::distance (begin, end)) == m(), + Assert (static_cast<size_type >(std::distance (begin, end)) == m(), ExcIteratorRange (std::distance (begin, end), m())); // for use in the inner loop, we define a typedef to the type of the inner // iterators typedef typename std::iterator_traits<ForwardIterator>::value_type::const_iterator inner_iterator; - unsigned int row=0; + size_type row=0; for (ForwardIterator i=begin; i!=end; ++i, ++row) { const inner_iterator end_of_row = i->end(); 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 bbc1fb9944..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 @@ -44,29 +49,36 @@ namespace internal namespace ChunkSparseMatrix { /** - * Add the result of multiplying a chunk of size chunk_size times - * chunk_size by a source vector fragment of size chunk_size to the - * destination vector fragment. + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + + /** + * Add the result of multiplying a chunk + * of size chunk_size times chunk_size by + * a source vector fragment of size + * chunk_size to the destination vector + * fragment. */ template <typename MatrixIterator, typename SrcIterator, typename DstIterator> inline void - chunk_vmult_add (const unsigned int chunk_size, + chunk_vmult_add (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator src, DstIterator dst) { MatrixIterator matrix_row = matrix; - for (unsigned int i=0; i<chunk_size; + for (size_type i=0; i<chunk_size; ++i, matrix_row += chunk_size) { typename std::iterator_traits<DstIterator>::value_type sum = 0; - for (unsigned int j=0; j<chunk_size; ++j) + for (size_type j=0; j<chunk_size; ++j) sum += matrix_row[j] * src[j]; dst[i] += sum; @@ -84,20 +96,20 @@ namespace internal typename DstIterator> inline void - chunk_vmult_subtract (const unsigned int chunk_size, + chunk_vmult_subtract (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator src, DstIterator dst) { MatrixIterator matrix_row = matrix; - for (unsigned int i=0; i<chunk_size; + for (size_type i=0; i<chunk_size; ++i, matrix_row += chunk_size) { typename std::iterator_traits<DstIterator>::value_type sum = 0; - for (unsigned int j=0; j<chunk_size; ++j) + for (size_type j=0; j<chunk_size; ++j) sum += matrix_row[j] * src[j]; dst[i] -= sum; @@ -115,17 +127,17 @@ namespace internal typename DstIterator> inline void - chunk_Tvmult_add (const unsigned int chunk_size, + chunk_Tvmult_add (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator src, DstIterator dst) { - for (unsigned int i=0; i<chunk_size; ++i) + for (size_type i=0; i<chunk_size; ++i) { typename std::iterator_traits<DstIterator>::value_type sum = 0; - for (unsigned int j=0; j<chunk_size; ++j) + for (size_type j=0; j<chunk_size; ++j) sum += matrix[j*chunk_size+i] * src[j]; dst[i] += sum; @@ -143,7 +155,7 @@ namespace internal typename SrcIterator2> inline result_type - chunk_matrix_scalar_product (const unsigned int chunk_size, + chunk_matrix_scalar_product (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator1 u, const SrcIterator2 v) @@ -152,13 +164,13 @@ namespace internal MatrixIterator matrix_row = matrix; - for (unsigned int i=0; i<chunk_size; + for (size_type i=0; i<chunk_size; ++i, matrix_row += chunk_size) { typename std::iterator_traits<SrcIterator2>::value_type sum = 0; - for (unsigned int j=0; j<chunk_size; ++j) + for (size_type j=0; j<chunk_size; ++j) sum += matrix_row[j] * v[j]; result += u[i] * sum; @@ -185,26 +197,28 @@ namespace internal const unsigned int end_row, const number *values, const std::size_t *rowstart, - const unsigned int *colnums, + const size_type *colnums, const InVector &src, OutVector &dst) { - const unsigned int m = cols.n_rows(); - const unsigned int n = cols.n_cols(); - const unsigned int chunk_size = cols.get_chunk_size(); + const size_type m = cols.n_rows(); + const size_type n = cols.n_cols(); + const size_type chunk_size = cols.get_chunk_size(); // loop over all chunks. note that we need to treat the last chunk row // and column differently if they have padding elements - const unsigned int n_filled_last_rows = m % chunk_size; - const unsigned int n_filled_last_cols = n % chunk_size; + const size_type n_filled_last_rows = m % chunk_size; + const size_type n_filled_last_cols = n % chunk_size; - const unsigned int last_regular_row = n_filled_last_rows > 0 ? - std::min(m/chunk_size, end_row) : end_row; - const unsigned int irregular_col = n/chunk_size; + const size_type last_regular_row = n_filled_last_rows > 0 ? + std::min(m/chunk_size, + static_cast<size_type>(end_row)) : + end_row; + const size_type irregular_col = n/chunk_size; typename OutVector::iterator dst_ptr = dst.begin()+chunk_size*begin_row; const number *val_ptr= &values[rowstart[begin_row]*chunk_size*chunk_size]; - const unsigned int *colnum_ptr = &colnums[rowstart[begin_row]]; + const size_type *colnum_ptr = &colnums[rowstart[begin_row]]; for (unsigned int chunk_row=begin_row; chunk_row<last_regular_row; ++chunk_row) { @@ -219,8 +233,8 @@ namespace internal dst_ptr); else // we're at a chunk column that has padding - for (unsigned int r=0; r<chunk_size; ++r) - for (unsigned int c=0; c<n_filled_last_cols; ++c) + for (size_type r=0; r<chunk_size; ++r) + for (size_type c=0; c<n_filled_last_cols; ++c) dst_ptr[r] += (val_ptr[r*chunk_size + c] * src(*colnum_ptr * chunk_size + c)); @@ -234,7 +248,7 @@ namespace internal // now deal with last chunk row if necessary if (n_filled_last_rows > 0 && end_row == (m/chunk_size+1)) { - const unsigned int chunk_row = last_regular_row; + const size_type chunk_row = last_regular_row; const number *const val_end_of_row = &values[rowstart[chunk_row+1] * chunk_size * chunk_size]; @@ -243,16 +257,16 @@ namespace internal if (*colnum_ptr != irregular_col) { // we're at a chunk row but not column that has padding - for (unsigned int r=0; r<n_filled_last_rows; ++r) - for (unsigned int c=0; c<chunk_size; ++c) + for (size_type r=0; r<n_filled_last_rows; ++r) + for (size_type c=0; c<chunk_size; ++c) dst_ptr[r] += (val_ptr[r*chunk_size + c] * src(*colnum_ptr * chunk_size + c)); } else // we're at a chunk row and column that has padding - for (unsigned int r=0; r<n_filled_last_rows; ++r) - for (unsigned int c=0; c<n_filled_last_cols; ++c) + for (size_type r=0; r<n_filled_last_rows; ++r) + for (size_type c=0; c<n_filled_last_cols; ++c) dst_ptr[r] += (val_ptr[r*chunk_size + c] * src(*colnum_ptr * chunk_size + c)); @@ -334,7 +348,7 @@ ChunkSparseMatrix<number>::ChunkSparseMatrix (const ChunkSparsityPattern &c, Assert (c.n_cols() == id.n(), ExcDimensionMismatch (c.n_cols(), id.n())); reinit (c); - for (unsigned int i=0; i<n(); ++i) + for (size_type i=0; i<n(); ++i) this->set(i,i,1.); } @@ -414,7 +428,7 @@ ChunkSparseMatrix<number>::operator= (const IdentityMatrix &id) ExcDimensionMismatch (cols->n_cols(), id.n())); *this = 0; - for (unsigned int i=0; i<n(); ++i) + for (size_type i=0; i<n(); ++i) this->set(i,i,1.); return *this; @@ -439,9 +453,9 @@ ChunkSparseMatrix<number>::reinit (const ChunkSparsityPattern &sparsity) // allocate not just m() * n() elements but enough so that we can store full // chunks. this entails some padding elements - const unsigned int chunk_size = cols->get_chunk_size(); - const unsigned int N = cols->sparsity_pattern.n_nonzero_elements() * - chunk_size * chunk_size; + const size_type chunk_size = cols->get_chunk_size(); + const size_type N = cols->sparsity_pattern.n_nonzero_elements() * + chunk_size * chunk_size; if (N > max_len || max_len == 0) { if (val != 0) @@ -483,7 +497,7 @@ ChunkSparseMatrix<number>::empty () const template <typename number> -unsigned int +typename ChunkSparseMatrix<number>::size_type ChunkSparseMatrix<number>::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -493,7 +507,7 @@ ChunkSparseMatrix<number>::n_nonzero_elements () const template <typename number> -unsigned int +typename ChunkSparseMatrix<number>::size_type ChunkSparseMatrix<number>::n_actually_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -501,7 +515,7 @@ ChunkSparseMatrix<number>::n_actually_nonzero_elements () const // count those elements that are nonzero, even if they lie in the padding // around the matrix. since we have the invariant that padding elements are // zero, nothing bad can happen here - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); return std::count_if(&val[0], &val[cols->sparsity_pattern.n_nonzero_elements () * chunk_size * chunk_size], @@ -532,7 +546,7 @@ ChunkSparseMatrix<number>::copy_from (const ChunkSparseMatrix<somenumber> &matri Assert (cols == matrix.cols, ExcDifferentChunkSparsityPatterns()); // copy everything, including padding elements - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); std::copy (&matrix.val[0], &matrix.val[cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size], @@ -552,8 +566,8 @@ ChunkSparseMatrix<number>::copy_from (const FullMatrix<somenumber> &matrix) *this = 0; // then copy old matrix - for (unsigned int row=0; row<matrix.m(); ++row) - for (unsigned int col=0; col<matrix.n(); ++col) + for (size_type row=0; row<matrix.m(); ++row) + for (size_type col=0; col<matrix.n(); ++col) if (matrix(row,col) != 0) set (row, col, matrix(row,col)); } @@ -571,14 +585,14 @@ ChunkSparseMatrix<number>::add (const number factor, Assert (cols == matrix.cols, ExcDifferentChunkSparsityPatterns()); // add everything, including padding elements - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); number *val_ptr = &val[0]; const somenumber *matrix_ptr = &matrix.val[0]; const number *const end_ptr = &val[cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size]; while (val_ptr != end_ptr) - *val_ptr++ += factor * *matrix_ptr++; + *val_ptr++ += factor **matrix_ptr++; } @@ -671,24 +685,24 @@ ChunkSparseMatrix<number>::Tvmult_add (OutVector &dst, Assert (!PointerComparison::equal(&src, &dst), ExcSourceEqualsDestination()); - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need to treat the last chunk row and // column differently if they have padding elements const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); // like in vmult_add, but don't keep an iterator into dst around since we're // not traversing it sequentially this time - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; - for (unsigned int chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) + for (size_type chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) { const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -705,8 +719,8 @@ ChunkSparseMatrix<number>::Tvmult_add (OutVector &dst, dst.begin() + *colnum_ptr * cols->chunk_size); else // we're at a chunk column that has padding - for (unsigned int r=0; r<cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) dst(*colnum_ptr * cols->chunk_size + c) += (val_ptr[r*cols->chunk_size + c] * src(chunk_row * cols->chunk_size + r)); @@ -719,7 +733,7 @@ ChunkSparseMatrix<number>::Tvmult_add (OutVector &dst, // now deal with last chunk row if necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -731,16 +745,16 @@ ChunkSparseMatrix<number>::Tvmult_add (OutVector &dst, (*colnum_ptr != cols->sparsity_pattern.n_cols()-1)) { // we're at a chunk row but not column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<cols->chunk_size; ++c) dst(*colnum_ptr * cols->chunk_size + c) += (val_ptr[r*cols->chunk_size + c] * src(chunk_row * cols->chunk_size + r)); } else // we're at a chunk row and column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) dst(*colnum_ptr * cols->chunk_size + c) += (val_ptr[r*cols->chunk_size + c] * src(chunk_row * cols->chunk_size + r)); @@ -767,23 +781,23 @@ ChunkSparseMatrix<number>::matrix_norm_square (const Vector<somenumber> &v) cons //////////////// // like matrix_scalar_product, except that the two vectors are now the same - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need to treat the last chunk row and // column differently if they have padding elements const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename Vector<somenumber>::const_iterator v_ptr = v.begin(); - for (unsigned int chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) + for (size_type chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) { const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -802,8 +816,8 @@ ChunkSparseMatrix<number>::matrix_norm_square (const Vector<somenumber> &v) cons v.begin() + *colnum_ptr * cols->chunk_size); else // we're at a chunk column that has padding - for (unsigned int r=0; r<cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) result += v(chunk_row * cols->chunk_size + r) @@ -821,7 +835,7 @@ ChunkSparseMatrix<number>::matrix_norm_square (const Vector<somenumber> &v) cons // now deal with last chunk row if necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -833,8 +847,8 @@ ChunkSparseMatrix<number>::matrix_norm_square (const Vector<somenumber> &v) cons (*colnum_ptr != cols->sparsity_pattern.n_cols()-1)) { // we're at a chunk row but not column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<cols->chunk_size; ++c) result += v(chunk_row * cols->chunk_size + r) @@ -843,8 +857,8 @@ ChunkSparseMatrix<number>::matrix_norm_square (const Vector<somenumber> &v) cons } else // we're at a chunk row and column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) result += v(chunk_row * cols->chunk_size + r) @@ -875,23 +889,23 @@ ChunkSparseMatrix<number>::matrix_scalar_product (const Vector<somenumber> &u, // the following works like the vmult_add function somenumber result = 0; - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need to treat the last chunk row and // column differently if they have padding elements const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename Vector<somenumber>::const_iterator u_ptr = u.begin(); - for (unsigned int chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) + for (size_type chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) { const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -910,8 +924,8 @@ ChunkSparseMatrix<number>::matrix_scalar_product (const Vector<somenumber> &u, v.begin() + *colnum_ptr * cols->chunk_size); else // we're at a chunk column that has padding - for (unsigned int r=0; r<cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) result += u(chunk_row * cols->chunk_size + r) @@ -929,7 +943,7 @@ ChunkSparseMatrix<number>::matrix_scalar_product (const Vector<somenumber> &u, // now deal with last chunk row if necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -941,8 +955,8 @@ ChunkSparseMatrix<number>::matrix_scalar_product (const Vector<somenumber> &u, (*colnum_ptr != cols->sparsity_pattern.n_cols()-1)) { // we're at a chunk row but not column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<cols->chunk_size; ++c) result += u(chunk_row * cols->chunk_size + r) @@ -951,8 +965,8 @@ ChunkSparseMatrix<number>::matrix_scalar_product (const Vector<somenumber> &u, } else // we're at a chunk row and column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) result += u(chunk_row * cols->chunk_size + r) @@ -976,7 +990,7 @@ ChunkSparseMatrix<number>::l1_norm () const Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all rows and columns; it is safe to also loop over the padding // elements (they are zero) if we make sure that the vector into which we @@ -984,11 +998,11 @@ ChunkSparseMatrix<number>::l1_norm () const Vector<real_type> column_sums(cols->sparsity_pattern.n_cols() * cols->chunk_size); - for (unsigned int chunk_row=0; chunk_row<n_chunk_rows; ++chunk_row) - for (unsigned int j=cols->sparsity_pattern.rowstart[chunk_row]; + for (size_type chunk_row=0; chunk_row<n_chunk_rows; ++chunk_row) + for (size_type j=cols->sparsity_pattern.rowstart[chunk_row]; j<cols->sparsity_pattern.rowstart[chunk_row+1] ; ++j) - for (unsigned int r=0; r<cols->chunk_size; ++r) - for (unsigned int s=0; s<cols->chunk_size; ++s) + for (size_type r=0; r<cols->chunk_size; ++r) + for (size_type s=0; s<cols->chunk_size; ++s) column_sums(cols->sparsity_pattern.colnums[j] * cols->chunk_size + s) += numbers::NumberTraits<number>::abs(val[j * cols->chunk_size * @@ -1012,7 +1026,7 @@ ChunkSparseMatrix<number>::linfty_norm () const // (without allocating a temporary vector) as is done in the SparseMatrix // class but since it is rarely called in time critical places it is // probably not worth it - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all rows and columns; it is safe to also loop over the padding // elements (they are zero) if we make sure that the vector into which we @@ -1020,11 +1034,11 @@ ChunkSparseMatrix<number>::linfty_norm () const Vector<real_type> row_sums(cols->sparsity_pattern.n_rows() * cols->chunk_size); - for (unsigned int chunk_row=0; chunk_row<n_chunk_rows; ++chunk_row) - for (unsigned int j=cols->sparsity_pattern.rowstart[chunk_row]; + for (size_type chunk_row=0; chunk_row<n_chunk_rows; ++chunk_row) + for (size_type j=cols->sparsity_pattern.rowstart[chunk_row]; j<cols->sparsity_pattern.rowstart[chunk_row+1] ; ++j) - for (unsigned int r=0; r<cols->chunk_size; ++r) - for (unsigned int s=0; s<cols->chunk_size; ++s) + for (size_type r=0; r<cols->chunk_size; ++r) + for (size_type s=0; s<cols->chunk_size; ++s) row_sums(chunk_row * cols->chunk_size + r) += numbers::NumberTraits<number>::abs(val[j * cols->chunk_size * cols->chunk_size + @@ -1077,23 +1091,23 @@ ChunkSparseMatrix<number>::residual (Vector<somenumber> &dst, // the rest of this function is like vmult_add, except that we subtract // rather than add A*u ///////// - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need to treat the last chunk row and // column differently if they have padding elements const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename Vector<somenumber>::iterator dst_ptr = dst.begin(); - for (unsigned int chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) + for (size_type chunk_row=0; chunk_row<n_regular_chunk_rows; ++chunk_row) { const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -1110,8 +1124,8 @@ ChunkSparseMatrix<number>::residual (Vector<somenumber> &dst, dst_ptr); else // we're at a chunk column that has padding - for (unsigned int r=0; r<cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) dst(chunk_row * cols->chunk_size + r) -= (val_ptr[r*cols->chunk_size + c] * u(*colnum_ptr * cols->chunk_size + c)); @@ -1127,7 +1141,7 @@ ChunkSparseMatrix<number>::residual (Vector<somenumber> &dst, // now deal with last chunk row if necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -1139,16 +1153,16 @@ ChunkSparseMatrix<number>::residual (Vector<somenumber> &dst, (*colnum_ptr != cols->sparsity_pattern.n_cols()-1)) { // we're at a chunk row but not column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<cols->chunk_size; ++c) dst(chunk_row * cols->chunk_size + r) -= (val_ptr[r*cols->chunk_size + c] * u(*colnum_ptr * cols->chunk_size + c)); } else // we're at a chunk row and column that has padding - for (unsigned int r=0; r<m() % cols->chunk_size; ++r) - for (unsigned int c=0; c<n() % cols->chunk_size; ++c) + for (size_type r=0; r<m() % cols->chunk_size; ++r) + for (size_type c=0; c<n() % cols->chunk_size; ++c) dst(chunk_row * cols->chunk_size + r) -= (val_ptr[r*cols->chunk_size + c] * u(*colnum_ptr * cols->chunk_size + c)); @@ -1274,8 +1288,8 @@ template <typename number> template <typename somenumber> void ChunkSparseMatrix<number>::PSOR (Vector<somenumber> &dst, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number /*om*/) const { Assert (cols != 0, ExcNotInitialized()); @@ -1296,8 +1310,8 @@ template <typename number> template <typename somenumber> void ChunkSparseMatrix<number>::TPSOR (Vector<somenumber> &dst, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number /*om*/) const { Assert (cols != 0, ExcNotInitialized()); @@ -1430,9 +1444,9 @@ void ChunkSparseMatrix<number>::print_formatted (std::ostream &out, width = precision+2; } - for (unsigned int i=0; i<m(); ++i) + for (size_type i=0; i<m(); ++i) { - for (unsigned int j=0; j<n(); ++j) + for (size_type j=0; j<n(); ++j) if (cols->sparsity_pattern(i,j) != SparsityPattern::invalid_entry) out << std::setw(width) << val[cols->sparsity_pattern(i,j)] * denominator << ' '; @@ -1458,27 +1472,27 @@ void ChunkSparseMatrix<number>::print_pattern (std::ostream &out, Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); // loop over all chunk rows and columns, and each time we find something // repeat it chunk_size times in both directions - for (unsigned int i=0; i<cols->sparsity_pattern.n_rows(); ++i) + for (size_type i=0; i<cols->sparsity_pattern.n_rows(); ++i) { - for (unsigned int d=0; d<chunk_size; ++d) - for (unsigned int j=0; j<cols->sparsity_pattern.n_cols(); ++j) + for (size_type d=0; d<chunk_size; ++d) + for (size_type j=0; j<cols->sparsity_pattern.n_cols(); ++j) if (cols->sparsity_pattern(i,j) == SparsityPattern::invalid_entry) { - for (unsigned int e=0; e<chunk_size; ++e) + for (size_type e=0; e<chunk_size; ++e) out << '.'; } else if (std::fabs(val[cols->sparsity_pattern(i,j)]) > threshold) { - for (unsigned int e=0; e<chunk_size; ++e) + for (size_type e=0; e<chunk_size; ++e) out << '*'; } else { - for (unsigned int e=0; e<chunk_size; ++e) + for (size_type e=0; e<chunk_size; ++e) out << ':'; } out << std::endl; 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 200c80303d..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 @@ -221,6 +226,10 @@ namespace ChunkSparsityPatternIterators class ChunkSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; /** * Typedef an iterator class that allows to walk over all nonzero elements * of a sparsity pattern. @@ -250,7 +259,7 @@ public: * perform some optimizations, but the actual value of the variable may * change over time. */ - static const unsigned int invalid_entry = SparsityPattern::invalid_entry; + static const size_type invalid_entry = SparsityPattern::invalid_entry; /** * Initialize the matrix empty, that is with no memory allocated. This is @@ -283,19 +292,19 @@ public: * @arg n number of columns * @arg max_per_row maximum number of nonzero entries per row */ - ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int max_chunks_per_row, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_chunks_per_row, + const size_type chunk_size); /** * @deprecated This constructor is deprecated. Use the version * without the last argument */ - ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int max_chunks_per_row, - const unsigned int chunk_size, + ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_chunks_per_row, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -306,19 +315,19 @@ public: * @arg row_lengths possible number of nonzero entries for each row. This * vector must have one entry for each row. */ - ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size); /** * @deprecated This constructor is deprecated. Use the version * without the last argument */ - ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size, + ChunkSparsityPattern (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -329,9 +338,9 @@ public: * elements. To avoid this, use the constructor taking row and column * numbers separately. */ - ChunkSparsityPattern (const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type n, + const size_type max_per_row, + const size_type chunk_size); /** * Initialize a quadratic matrix. @@ -340,17 +349,17 @@ public: * @arg row_lengths possible number of nonzero entries for each row. This * vector must have one entry for each row. */ - ChunkSparsityPattern (const unsigned int m, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type m, + const std::vector<size_type> &row_lengths, + const size_type chunk_size); /** * @deprecated This constructor is deprecated. Use the version * without the last argument */ - ChunkSparsityPattern (const unsigned int m, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size, + ChunkSparsityPattern (const size_type m, + const std::vector<size_type> &row_lengths, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -373,19 +382,19 @@ public: * This function simply maps its operations to the other <tt>reinit</tt> * function. */ - void reinit (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size); + void reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ - void reinit (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size, + void reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -405,37 +414,37 @@ public: * optimized access in relaxation * methods of SparseMatrix. */ - void reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size); + void reinit (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ - void reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size, - const bool optimize_diagonal) DEAL_II_DEPRECATED; + void reinit (const size_type m, + const size_type n, + const std::vector<size_type > &row_lengths, + const size_type chunk_size, + const bool optimize_diagonal) DEAL_II_DEPRECATED; /** * Same as above, but with a VectorSlice argument instead. */ - void reinit (const unsigned int m, - const unsigned int n, - const VectorSlice<const std::vector<unsigned int> > &row_lengths, - const unsigned int chunk_size); + void reinit (const size_type m, + const size_type n, + const VectorSlice<const std::vector<size_type> > &row_lengths, + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ - void reinit (const unsigned int m, - const unsigned int n, - const VectorSlice<const std::vector<unsigned int> > &row_lengths, - const unsigned int chunk_size, + void reinit (const size_type m, + const size_type n, + const VectorSlice<const std::vector<size_type> > &row_lengths, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -486,8 +495,8 @@ public: * Since that all sounds very complicated, consider the following example * code, which may be used to fill a sparsity pattern: * @code - * std::vector<std::vector<unsigned int> > column_indices (n_rows); - * for (unsigned int row=0; row<n_rows; ++row) + * std::vector<std::vector<size_type> > column_indices (n_rows); + * for (size_type row=0; row<n_rows; ++row) * // generate necessary columns in this row * fill_row (column_indices[row]); * @@ -506,8 +515,8 @@ public: * Another example would be as follows, where we initialize a whole matrix, * not only a sparsity pattern: * @code - * std::vector<std::map<unsigned int,double> > entries (n_rows); - * for (unsigned int row=0; row<n_rows; ++row) + * std::vector<std::map<size_type,double> > entries (n_rows); + * for (size_type row=0; row<n_rows; ++row) * // generate necessary pairs of columns * // and corresponding values in this row * fill_row (entries[row]); @@ -529,22 +538,22 @@ public: * iterators that point to such pairs. */ template <typename ForwardIterator> - void copy_from (const unsigned int n_rows, - const unsigned int n_cols, + void copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size); + 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 <typename ForwardIterator> - void copy_from (const unsigned int n_rows, - const unsigned int n_cols, + void copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -555,7 +564,7 @@ public: */ template <typename SparsityType> void copy_from (const SparsityType &csp, - const unsigned int chunk_size); + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function @@ -563,7 +572,7 @@ public: */ template <typename SparsityType> void copy_from (const SparsityType &csp, - const unsigned int chunk_size, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -575,7 +584,7 @@ public: */ template <typename number> void copy_from (const FullMatrix<number> &matrix, - const unsigned int chunk_size); + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function @@ -583,7 +592,7 @@ public: */ template <typename number> void copy_from (const FullMatrix<number> &matrix, - const unsigned int chunk_size, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -619,14 +628,14 @@ public: /** * Return the chunk size given as argument when constructing this object. */ - unsigned int get_chunk_size () const; + size_type get_chunk_size () const; /** * Return the maximum number of entries per row. Before compression, this * equals the number given to the constructor, while after compression, it * equals the maximum number of entries actually allocated by the user. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the matrix. This function may only be called for @@ -634,8 +643,8 @@ public: * * If the entry already exists, nothing bad happens. */ - void add (const unsigned int i, - const unsigned int j); + void add (const size_type i, + const size_type j); /** * Make the sparsity pattern symmetric by adding the sparsity pattern of the @@ -650,24 +659,24 @@ public: * Return number of rows of this matrix, which equals the dimension of the * image space. */ - unsigned int n_rows () const; + inline size_type n_rows () const; /** * Return number of columns of this matrix, which equals the dimension of * the range space. */ - unsigned int n_cols () const; + inline size_type n_cols () const; /** * Check if a value at a certain position may be non-zero. */ - bool exists (const unsigned int i, - const unsigned int j) const; + bool exists (const size_type i, + const size_type j) const; /** * Number of entries in a specific row. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Compute the bandwidth of the matrix represented by this structure. The @@ -675,7 +684,7 @@ public: * represents a nonzero entry of the matrix. Consequently, the maximum * bandwidth a $n\times m$ matrix can have is $\max\{n-1,m-1\}$. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements of this matrix. Actually, it @@ -685,7 +694,7 @@ public: * This function may only be called if the matrix struct is compressed. It * does not make too much sense otherwise anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether the structure is compressed or not. @@ -871,17 +880,17 @@ private: /** * Number of rows that this sparsity structure shall represent. */ - unsigned int rows; + size_type rows; /** * Number of columns that this sparsity structure shall represent. */ - unsigned int cols; + size_type cols; /** * The size of chunks. */ - unsigned int chunk_size; + size_type chunk_size; /** * The reduced sparsity pattern. We store only which chunks exist, with each @@ -914,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())), @@ -942,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(); } @@ -959,7 +968,7 @@ namespace ChunkSparsityPatternIterators Assert (is_valid_entry() == true, ExcInvalidIterator()); return sparsity_pattern->get_chunk_size()*reduced_accessor.row() + - chunk_row; + chunk_row; } @@ -971,7 +980,7 @@ namespace ChunkSparsityPatternIterators Assert (is_valid_entry() == true, ExcInvalidIterator()); return sparsity_pattern->get_chunk_size()*reduced_accessor.column() + - chunk_col; + chunk_col; } @@ -1019,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) @@ -1205,13 +1214,13 @@ ChunkSparsityPattern::iterator ChunkSparsityPattern::end (const unsigned int r) const { Assert (r<n_rows(), ExcIndexRange(r,0,n_rows())) - return iterator(this, r+1); + return iterator(this, r+1); } inline -unsigned int +ChunkSparsityPattern::size_type ChunkSparsityPattern::n_rows () const { return rows; @@ -1219,7 +1228,7 @@ ChunkSparsityPattern::n_rows () const inline -unsigned int +ChunkSparsityPattern::size_type ChunkSparsityPattern::n_cols () const { return cols; @@ -1228,7 +1237,7 @@ ChunkSparsityPattern::n_cols () const inline -unsigned int +ChunkSparsityPattern::size_type ChunkSparsityPattern::get_chunk_size () const { return chunk_size; @@ -1257,11 +1266,11 @@ ChunkSparsityPattern::optimize_diagonal () const template <typename ForwardIterator> inline void -ChunkSparsityPattern::copy_from (const unsigned int n_rows, - const unsigned int n_cols, +ChunkSparsityPattern::copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size, + const size_type chunk_size, const bool) { copy_from (n_rows, n_cols, begin, end, chunk_size); @@ -1271,13 +1280,13 @@ ChunkSparsityPattern::copy_from (const unsigned int n_rows, template <typename ForwardIterator> void -ChunkSparsityPattern::copy_from (const unsigned int n_rows, - const unsigned int n_cols, +ChunkSparsityPattern::copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size) + const size_type chunk_size) { - Assert (static_cast<unsigned int>(std::distance (begin, end)) == n_rows, + Assert (static_cast<size_type>(std::distance (begin, end)) == n_rows, ExcIteratorRange (std::distance (begin, end), n_rows)); // first determine row lengths for each row. if the matrix is quadratic, @@ -1285,7 +1294,7 @@ ChunkSparsityPattern::copy_from (const unsigned int n_rows, // is not yet present. as we have to call compress anyway later on, don't // bother to check whether that diagonal entry is in a certain row or not const bool is_square = (n_rows == n_cols); - std::vector<unsigned int> row_lengths; + std::vector<size_type> row_lengths; row_lengths.reserve(n_rows); for (ForwardIterator i=begin; i!=end; ++i) row_lengths.push_back (std::distance (i->begin(), i->end()) @@ -1294,15 +1303,15 @@ ChunkSparsityPattern::copy_from (const unsigned int n_rows, reinit (n_rows, n_cols, row_lengths, chunk_size); // now enter all the elements into the matrix - unsigned int row = 0; + size_type row = 0; typedef typename std::iterator_traits<ForwardIterator>::value_type::const_iterator inner_iterator; for (ForwardIterator i=begin; i!=end; ++i, ++row) { const inner_iterator end_of_row = i->end(); for (inner_iterator j=i->begin(); j!=end_of_row; ++j) { - const unsigned int col - = internal::SparsityPatternTools::get_column_index_from_iterator(*j); + const size_type col + = 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 3235b5b181..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 @@ -106,13 +111,18 @@ template <typename number> class SparseMatrix; class CompressedSetSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * An iterator that can be used to * iterate over the elements of a single * row. The result of dereferencing such * an iterator is a column index. */ - typedef std::set<unsigned int>::const_iterator row_iterator; + typedef std::set<size_type>::const_iterator row_iterator; /** @@ -150,14 +160,14 @@ public: * matrix with @p m rows and * @p n columns. */ - CompressedSetSparsityPattern (const unsigned int m, - const unsigned int n); + CompressedSetSparsityPattern (const size_type m, + const size_type n); /** * Initialize a square matrix of * dimension @p n. */ - CompressedSetSparsityPattern (const unsigned int n); + CompressedSetSparsityPattern (const size_type n); /** * Copy operator. For this the @@ -177,8 +187,8 @@ public: * max_entries_per_row() nonzero * entries per row. */ - void reinit (const unsigned int m, - const unsigned int n); + void reinit (const size_type m, + const size_type n); /** * Since this object is kept @@ -206,15 +216,15 @@ public: * this number may change as * entries are added. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the * matrix. If the entry already * exists, nothing bad happens. */ - void add (const unsigned int i, - const unsigned int j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the @@ -223,17 +233,17 @@ public: * happens. */ template <typename ForwardIterator> - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted = false); /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const unsigned int i, - const unsigned int j) const; + bool exists (const size_type i, + const size_type j) const; /** * Make the sparsity pattern @@ -289,19 +299,19 @@ public: * matrix, which equals the dimension * of the image space. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Return an iterator that can loop over @@ -309,12 +319,12 @@ public: * row. Dereferencing the iterator yields * a column index. */ - row_iterator row_begin (const unsigned int row) const; + row_iterator row_begin (const size_type row) const; /** * End iterator for the given row. */ - row_iterator row_end (const unsigned int row) const; + row_iterator row_end (const size_type row) const; /** @@ -325,14 +335,14 @@ public: * $(i,j)$ represents a nonzero entry * of the matrix. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements * allocated through this sparsity * pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether this object stores only @@ -357,13 +367,13 @@ private: * Number of rows that this sparsity * structure shall represent. */ - unsigned int rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - unsigned int cols; + size_type cols; /** * For each row of the matrix, store the @@ -374,7 +384,7 @@ private: */ struct Line { - std::set<unsigned int> entries; + std::set<size_type> entries; /** * Constructor. @@ -385,7 +395,7 @@ private: * Add the given column number to * this line. */ - void add (const unsigned int col_num); + void add (const size_type col_num); /** * Add the columns specified by the @@ -417,7 +427,7 @@ CompressedSetSparsityPattern::Line::Line () inline void -CompressedSetSparsityPattern::Line::add (const unsigned int j) +CompressedSetSparsityPattern::Line::add (const size_type j) { entries.insert (j); } @@ -436,7 +446,7 @@ CompressedSetSparsityPattern::Line::add_entries (ForwardIterator begin, inline -unsigned int +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_rows () const { return rows; @@ -445,7 +455,7 @@ CompressedSetSparsityPattern::n_rows () const inline -unsigned int +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_cols () const { return cols; @@ -455,11 +465,11 @@ CompressedSetSparsityPattern::n_cols () const inline void -CompressedSetSparsityPattern::add (const unsigned int i, - const unsigned int j) +CompressedSetSparsityPattern::add (const size_type i, + const size_type j) { - Assert (i<rows, ExcIndexRange(i, 0, rows)); - Assert (j<cols, ExcIndexRange(j, 0, cols)); + Assert (i<rows, ExcIndexRangeType<size_type>(i, 0, rows)); + Assert (j<cols, ExcIndexRangeType<size_type>(j, 0, cols)); lines[i].add (j); } @@ -469,12 +479,12 @@ CompressedSetSparsityPattern::add (const unsigned int i, template <typename ForwardIterator> inline void -CompressedSetSparsityPattern::add_entries (const unsigned int row, +CompressedSetSparsityPattern::add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool /*indices_are_sorted*/) { - Assert (row < rows, ExcIndexRange (row, 0, rows)); + Assert (row < rows, ExcIndexRangeType<size_type> (row, 0, rows)); lines[row].add_entries (begin, end); } @@ -482,10 +492,10 @@ CompressedSetSparsityPattern::add_entries (const unsigned int row, inline -unsigned int -CompressedSetSparsityPattern::row_length (const unsigned int row) const +CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::row_length (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); return lines[row].entries.size(); } @@ -494,7 +504,7 @@ CompressedSetSparsityPattern::row_length (const unsigned int row) const inline CompressedSetSparsityPattern::row_iterator -CompressedSetSparsityPattern::row_begin (const unsigned int row) const +CompressedSetSparsityPattern::row_begin (const size_type row) const { return (lines[row].entries.begin ()); } @@ -503,7 +513,7 @@ CompressedSetSparsityPattern::row_begin (const unsigned int row) const inline CompressedSetSparsityPattern::row_iterator -CompressedSetSparsityPattern::row_end (const unsigned int row) const +CompressedSetSparsityPattern::row_end (const size_type row) const { return (lines[row].entries.end ()); } 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 a7b9daed20..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 @@ -87,13 +92,18 @@ template <typename number> class SparseMatrix; class CompressedSimpleSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * An iterator that can be used to * iterate over the elements of a single * row. The result of dereferencing such * an iterator is a column index. */ - typedef std::vector<unsigned int>::const_iterator row_iterator; + typedef std::vector<size_type>::const_iterator row_iterator; /** * Initialize the matrix empty, @@ -136,15 +146,21 @@ public: * default argument keeps all * entries. */ - CompressedSimpleSparsityPattern (const unsigned int m, - const unsigned int n, + CompressedSimpleSparsityPattern (const size_type m, + 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. */ - CompressedSimpleSparsityPattern (const unsigned int n); + CompressedSimpleSparsityPattern (const size_type n); /** * Copy operator. For this the @@ -170,8 +186,8 @@ public: * default argument keeps all * entries. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const IndexSet &rowset = IndexSet()); /** @@ -200,15 +216,15 @@ public: * this number may change as * entries are added. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the * matrix. If the entry already * exists, nothing bad happens. */ - void add (const unsigned int i, - const unsigned int j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the @@ -217,17 +233,17 @@ public: * happens. */ template <typename ForwardIterator> - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_unique_and_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_unique_and_sorted = false); /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const unsigned int i, - const unsigned int j) const; + bool exists (const size_type i, + const size_type j) const; /** * Make the sparsity pattern @@ -283,14 +299,14 @@ public: * matrix, which equals the dimension * of the image space. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Number of entries in a @@ -300,15 +316,15 @@ public: * index set of rows that we want * to store. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Access to column number field. * Return the column number of * the @p indexth entry in @p row. */ - unsigned int column_number (const unsigned int row, - const unsigned int index) const; + size_type column_number (const size_type row, + const size_type index) const; /** * Return an iterator that can loop over @@ -316,12 +332,12 @@ public: * row. Dereferencing the iterator yields * a column index. */ - row_iterator row_begin (const unsigned int row) const; + row_iterator row_begin (const size_type row) const; /** * Returns the end of the current row. */ - row_iterator row_end (const unsigned int row) const; + row_iterator row_end (const size_type row) const; /** * Compute the bandwidth of the matrix * represented by this structure. The @@ -330,13 +346,13 @@ public: * $(i,j)$ represents a nonzero entry * of the matrix. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements * allocated through this sparsity pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the IndexSet that sets which @@ -370,20 +386,20 @@ public: * memory consumption (in bytes) * of this object. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; private: /** * Number of rows that this sparsity * structure shall represent. */ - unsigned int rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - unsigned int cols; + size_type cols; /** * A set that contains the valid rows. @@ -409,7 +425,7 @@ private: * this row. This array is always * kept sorted. */ - std::vector<unsigned int> entries; + std::vector<size_type> entries; /** * Constructor. @@ -420,7 +436,7 @@ private: * Add the given column number to * this line. */ - void add (const unsigned int col_num); + void add (const size_type col_num); /** * Add the columns specified by the @@ -434,7 +450,7 @@ private: /** * estimates memory consumption. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; }; @@ -452,7 +468,7 @@ private: inline void -CompressedSimpleSparsityPattern::Line::add (const unsigned int j) +CompressedSimpleSparsityPattern::Line::add (const size_type j) { // first check the last element (or if line // is still empty) @@ -464,7 +480,7 @@ CompressedSimpleSparsityPattern::Line::add (const unsigned int j) // do a binary search to find the place // where to insert: - std::vector<unsigned int>::iterator + std::vector<size_type>::iterator it = Utilities::lower_bound(entries.begin(), entries.end(), j); @@ -483,7 +499,7 @@ CompressedSimpleSparsityPattern::Line::add (const unsigned int j) inline -unsigned int +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::n_rows () const { return rows; @@ -492,7 +508,7 @@ CompressedSimpleSparsityPattern::n_rows () const inline -unsigned int +types::global_dof_index CompressedSimpleSparsityPattern::n_cols () const { return cols; @@ -502,16 +518,16 @@ CompressedSimpleSparsityPattern::n_cols () const inline void -CompressedSimpleSparsityPattern::add (const unsigned int i, - const unsigned int j) +CompressedSimpleSparsityPattern::add (const size_type i, + const size_type j) { - Assert (i<rows, ExcIndexRange(i, 0, rows)); - Assert (j<cols, ExcIndexRange(j, 0, cols)); + Assert (i<rows, ExcIndexRangeType<size_type>(i, 0, rows)); + Assert (j<cols, ExcIndexRangeType<size_type>(j, 0, cols)); if (rowset.size() > 0 && !rowset.is_element(i)) return; - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? i : rowset.index_within_set(i); lines[rowindex].add (j); } @@ -521,17 +537,17 @@ CompressedSimpleSparsityPattern::add (const unsigned int i, template <typename ForwardIterator> inline void -CompressedSimpleSparsityPattern::add_entries (const unsigned int row, +CompressedSimpleSparsityPattern::add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted) { - Assert (row < rows, ExcIndexRange (row, 0, rows)); + Assert (row < rows, ExcIndexRangeType<size_type> (row, 0, rows)); if (rowset.size() > 0 && !rowset.is_element(row)) return; - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.index_within_set(row); lines[rowindex].add_entries (begin, end, indices_are_sorted); } @@ -545,14 +561,14 @@ CompressedSimpleSparsityPattern::Line::Line () inline -unsigned int -CompressedSimpleSparsityPattern::row_length (const unsigned int row) const +types::global_dof_index +CompressedSimpleSparsityPattern::row_length (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); if (rowset.size() > 0 && !rowset.is_element(row)) return 0; - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.index_within_set(row); return lines[rowindex].entries.size(); } @@ -560,16 +576,16 @@ CompressedSimpleSparsityPattern::row_length (const unsigned int row) const inline -unsigned int -CompressedSimpleSparsityPattern::column_number (const unsigned int row, - const unsigned int index) const +types::global_dof_index +CompressedSimpleSparsityPattern::column_number (const size_type row, + const size_type index) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); Assert( rowset.size() == 0 || rowset.is_element(row), ExcInternalError()); - const unsigned int local_row = rowset.size() ? rowset.index_within_set(row) : row; + const size_type local_row = rowset.size() ? rowset.index_within_set(row) : row; Assert (index < lines[local_row].entries.size(), - ExcIndexRange (index, 0, lines[local_row].entries.size())); + ExcIndexRangeType<size_type> (index, 0, lines[local_row].entries.size())); return lines[local_row].entries[index]; } @@ -577,10 +593,10 @@ CompressedSimpleSparsityPattern::column_number (const unsigned int row, inline CompressedSimpleSparsityPattern::row_iterator -CompressedSimpleSparsityPattern::row_begin (const unsigned int row) const +CompressedSimpleSparsityPattern::row_begin (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); - const unsigned int local_row = rowset.size() ? rowset.index_within_set(row) : row; + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); + const size_type local_row = rowset.size() ? rowset.index_within_set(row) : row; return lines[local_row].entries.begin(); } @@ -588,10 +604,10 @@ CompressedSimpleSparsityPattern::row_begin (const unsigned int row) const inline CompressedSimpleSparsityPattern::row_iterator -CompressedSimpleSparsityPattern::row_end (const unsigned int row) const +CompressedSimpleSparsityPattern::row_end (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); - const unsigned int local_row = rowset.size() ? rowset.index_within_set(row) : row; + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); + const size_type local_row = rowset.size() ? rowset.index_within_set(row) : row; return lines[local_row].entries.end(); } 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 94ade69251..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 @@ -88,13 +93,18 @@ template <typename number> class SparseMatrix; class CompressedSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * An iterator that can be used to * iterate over the elements of a single * row. The result of dereferencing such * an iterator is a column index. */ - typedef std::vector<unsigned int>::const_iterator row_iterator; + typedef std::vector<size_type>::const_iterator row_iterator; /** * Initialize the matrix empty, @@ -131,14 +141,14 @@ public: * matrix with @p m rows and * @p n columns. */ - CompressedSparsityPattern (const unsigned int m, - const unsigned int n); + CompressedSparsityPattern (const size_type m, + const size_type n); /** * Initialize a square matrix of * dimension @p n. */ - CompressedSparsityPattern (const unsigned int n); + CompressedSparsityPattern (const size_type n); /** * Copy operator. For this the @@ -158,8 +168,8 @@ public: * max_entries_per_row() nonzero * entries per row. */ - void reinit (const unsigned int m, - const unsigned int n); + void reinit (const size_type m, + const size_type n); /** * Since this object is kept @@ -187,15 +197,15 @@ public: * this number may change as * entries are added. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the * matrix. If the entry already * exists, nothing bad happens. */ - void add (const unsigned int i, - const unsigned int j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the @@ -204,17 +214,17 @@ public: * happens. */ template <typename ForwardIterator> - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_unique_and_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_unique_and_sorted = false); /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const unsigned int i, - const unsigned int j) const; + bool exists (const size_type i, + const size_type j) const; /** * Make the sparsity pattern @@ -270,27 +280,27 @@ public: * matrix, which equals the dimension * of the image space. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Access to column number field. * Return the column number of * the @p indexth entry in @p row. */ - unsigned int column_number (const unsigned int row, - const unsigned int index) const; + size_type column_number (const size_type row, + const size_type index) const; /** * Return an iterator that can loop over @@ -298,12 +308,12 @@ public: * row. Dereferencing the iterator yields * a column index. */ - row_iterator row_begin (const unsigned int row) const; + row_iterator row_begin (const size_type row) const; /** * Returns the end of the current row. */ - row_iterator row_end (const unsigned int row) const; + row_iterator row_end (const size_type row) const; /** * Compute the bandwidth of the matrix @@ -313,14 +323,14 @@ public: * $(i,j)$ represents a nonzero entry * of the matrix. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements * allocated through this sparsity * pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether this object stores only @@ -345,13 +355,13 @@ private: * Number of rows that this sparsity * structure shall represent. */ - unsigned int rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - unsigned int cols; + size_type cols; /** * Store some data for each row @@ -425,13 +435,13 @@ private: * the cache. This array is always * kept sorted. */ - mutable std::vector<unsigned int> entries; + mutable std::vector<size_type> entries; /** * Cache of entries that have not yet * been written to #entries; */ - mutable unsigned int cache[cache_size]; + mutable size_type cache[cache_size]; /** * Number of entries in the cache. @@ -447,7 +457,7 @@ private: * Add the given column number to * this line. */ - void add (const unsigned int col_num); + void add (const size_type col_num); /** * Add the columns specified by the @@ -480,7 +490,7 @@ private: inline void -CompressedSparsityPattern::Line::add (const unsigned int j) +CompressedSparsityPattern::Line::add (const size_type j) { // first check whether this entry is // already in the cache. if so, we can @@ -502,7 +512,7 @@ CompressedSparsityPattern::Line::add (const unsigned int j) inline -unsigned int +types::global_dof_index CompressedSparsityPattern::n_rows () const { return rows; @@ -511,7 +521,7 @@ CompressedSparsityPattern::n_rows () const inline -unsigned int +types::global_dof_index CompressedSparsityPattern::n_cols () const { return cols; @@ -521,11 +531,11 @@ CompressedSparsityPattern::n_cols () const inline void -CompressedSparsityPattern::add (const unsigned int i, - const unsigned int j) +CompressedSparsityPattern::add (const size_type i, + const size_type j) { - Assert (i<rows, ExcIndexRange(i, 0, rows)); - Assert (j<cols, ExcIndexRange(j, 0, cols)); + Assert (i<rows, ExcIndexRangeType<size_type>(i, 0, rows)); + Assert (j<cols, ExcIndexRangeType<size_type>(j, 0, cols)); lines[i].add (j); } @@ -535,7 +545,7 @@ CompressedSparsityPattern::add (const unsigned int i, template <typename ForwardIterator> inline void -CompressedSparsityPattern::add_entries (const unsigned int row, +CompressedSparsityPattern::add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted) @@ -556,10 +566,10 @@ CompressedSparsityPattern::Line::Line () inline -unsigned int -CompressedSparsityPattern::row_length (const unsigned int row) const +types::global_dof_index +CompressedSparsityPattern::row_length (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); if (lines[row].cache_entries != 0) lines[row].flush_cache (); @@ -569,13 +579,13 @@ CompressedSparsityPattern::row_length (const unsigned int row) const inline -unsigned int -CompressedSparsityPattern::column_number (const unsigned int row, - const unsigned int index) const +types::global_dof_index +CompressedSparsityPattern::column_number (const size_type row, + const size_type index) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); Assert (index < lines[row].entries.size(), - ExcIndexRange (index, 0, lines[row].entries.size())); + ExcIndexRangeType<size_type> (index, 0, lines[row].entries.size())); if (lines[row].cache_entries != 0) lines[row].flush_cache (); @@ -586,9 +596,9 @@ CompressedSparsityPattern::column_number (const unsigned int row, inline CompressedSparsityPattern::row_iterator -CompressedSparsityPattern::row_begin (const unsigned int row) const +CompressedSparsityPattern::row_begin (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); if (lines[row].cache_entries != 0) lines[row].flush_cache (); @@ -599,9 +609,9 @@ CompressedSparsityPattern::row_begin (const unsigned int row) const inline CompressedSparsityPattern::row_iterator -CompressedSparsityPattern::row_end (const unsigned int row) const +CompressedSparsityPattern::row_end (const size_type row) const { - Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); + Assert (row < n_rows(), ExcIndexRangeType<size_type> (row, 0, n_rows())); return lines[row].entries.end(); } diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index ce286f57c6..8237b943d9 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 @@ -54,8 +59,8 @@ namespace internals //TODO[WB]: We should have a function of the kind -// ConstraintMatrix::add_constraint (const unsigned int constrained_dof, -// const std::vector<std::pair<unsigned int, double> > &entries, +// ConstraintMatrix::add_constraint (const size_type constrained_dof, +// const std::vector<std::pair<size_type, double> > &entries, // const double inhomogeneity = 0); // rather than building up constraints piecemeal through add_line/add_entry // etc. This would also eliminate the possibility of accidentally changing @@ -139,6 +144,11 @@ namespace internals class ConstraintMatrix : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef types::global_dof_index size_type; + /** * An enum that describes what should * happen if the two ConstraintMatrix @@ -221,7 +231,7 @@ public: * line. Always returns true if not in * the distributed case. */ - bool can_store_line (const unsigned int line_index) const; + bool can_store_line (const size_type line_index) const; /** * This function copies the content of @p @@ -271,7 +281,7 @@ public: * line already exists, then the function * simply returns without doing anything. */ - void add_line (const unsigned int line); + void add_line (const size_type line); /** * Call the first add_line() function for @@ -315,7 +325,7 @@ public: * inhomogeneities using * set_inhomogeneity(). */ - void add_lines (const std::set<unsigned int> &lines); + void add_lines (const std::set<size_type> &lines); /** * Call the first add_line() function for @@ -360,8 +370,8 @@ public: * same. Thus, it does no harm to * enter a constraint twice. */ - void add_entry (const unsigned int line, - const unsigned int column, + void add_entry (const size_type line, + const size_type column, const double value); /** @@ -373,8 +383,8 @@ public: * function several times, but is * faster. */ - void add_entries (const unsigned int line, - const std::vector<std::pair<unsigned int,double> > &col_val_pairs); + void add_entries (const size_type line, + const std::vector<std::pair<size_type,double> > &col_val_pairs); /** * Set an imhomogeneity to the @@ -385,8 +395,8 @@ public: * @note the line needs to be added with * one of the add_line() calls first. */ - void set_inhomogeneity (const unsigned int line, - const double value); + void set_inhomogeneity (const size_type line, + const double value); /** * Close the filling of entries. Since @@ -471,7 +481,7 @@ public: * finally merge() them together * again. */ - void shift (const unsigned int offset); + void shift (const size_type offset); /** * Clear all entries of this @@ -499,7 +509,7 @@ public: * Return number of constraints stored in * this matrix. */ - unsigned int n_constraints () const; + size_type n_constraints () const; /** * Return whether the degree of freedom @@ -515,7 +525,7 @@ public: * called, we have to perform a linear * search through all entries. */ - bool is_constrained (const unsigned int index) const; + bool is_constrained (const size_type index) const; /** * Return whether the dof is @@ -536,7 +546,7 @@ public: * freedom but with a weight different * from one. */ - bool is_identity_constrained (const unsigned int index) const; + bool is_identity_constrained (const size_type index) const; /** * Return the maximum number of other @@ -555,7 +565,7 @@ public: * constrained node are indirected to * the nodes it is constrained to. */ - unsigned int max_constraint_indirections () const; + size_type max_constraint_indirections () const; /** * Returns <tt>true</tt> in case the @@ -563,7 +573,7 @@ public: * non-trivial inhomogeneous valeus set * to the dof. */ - bool is_inhomogeneously_constrained (const unsigned int index) const; + bool is_inhomogeneously_constrained (const size_type index) const; /** * Returns <tt>false</tt> if all @@ -580,8 +590,8 @@ public: * zero pointer in case the dof is not * constrained. */ - const std::vector<std::pair<unsigned int,double> > * - get_constraint_entries (const unsigned int line) const; + const std::vector<std::pair<size_type,double> > * + get_constraint_entries (const size_type line) const; /** * Returns the value of the inhomogeneity @@ -589,7 +599,7 @@ public: * line. Unconstrained dofs also return a * zero value. */ - double get_inhomogeneity (const unsigned int line) const; + double get_inhomogeneity (const size_type line) const; /** * Print the constraint lines. Mainly @@ -985,9 +995,9 @@ public: */ template <class InVector, class OutVector> void - distribute_local_to_global (const InVector &local_vector, - const std::vector<unsigned int> &local_dof_indices, - OutVector &global_vector) const; + distribute_local_to_global (const InVector &local_vector, + const std::vector<size_type> &local_dof_indices, + OutVector &global_vector) const; /** * This function takes a vector of @@ -1062,10 +1072,10 @@ public: */ template <typename VectorType> void - distribute_local_to_global (const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, - VectorType &global_vector, - const FullMatrix<double> &local_matrix) const; + distribute_local_to_global (const Vector<double> &local_vector, + const std::vector<size_type> &local_dof_indices, + VectorType &global_vector, + const FullMatrix<double> &local_matrix) const; /** * Enter a single value into a @@ -1073,9 +1083,9 @@ public: */ template <class VectorType> void - distribute_local_to_global (const unsigned int index, - const double value, - VectorType &global_vector) const; + distribute_local_to_global (const size_type index, + const double value, + VectorType &global_vector) const; /** * This function takes a pointer to a @@ -1195,9 +1205,9 @@ public: */ template <typename MatrixType> void - distribute_local_to_global (const FullMatrix<double> &local_matrix, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix) const; + distribute_local_to_global (const FullMatrix<double> &local_matrix, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix) const; /** * Does the same as the function @@ -1206,10 +1216,10 @@ public: */ template <typename MatrixType> void - distribute_local_to_global (const FullMatrix<double> &local_matrix, - const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - MatrixType &global_matrix) const; + distribute_local_to_global (const FullMatrix<double> &local_matrix, + const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + MatrixType &global_matrix) const; /** * This function simultaneously @@ -1231,12 +1241,12 @@ public: */ template <typename MatrixType, typename VectorType> void - distribute_local_to_global (const FullMatrix<double> &local_matrix, - const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs = false) const; + distribute_local_to_global (const FullMatrix<double> &local_matrix, + const Vector<double> &local_vector, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs = false) const; /** * Do a similar operation as the @@ -1319,9 +1329,9 @@ public: */ template <typename SparsityType> void - add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries = true, + add_entries_local_to_global (const std::vector<size_type> &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries = true, const Table<2,bool> &dof_mask = default_empty_table) const; /** @@ -1332,11 +1342,11 @@ public: template <typename SparsityType> void - add_entries_local_to_global (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries = true, - const Table<2,bool> &dof_mask = default_empty_table) const; + add_entries_local_to_global (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries = true, + const Table<2,bool> &dof_mask = default_empty_table) const; /** * This function imports values from a @@ -1451,7 +1461,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcLineInexistant, - unsigned int, + size_type, << "The specified line " << arg1 << " does not exist."); /** @@ -1460,7 +1470,7 @@ public: * @ingroup Exceptions */ DeclException4 (ExcEntryAlreadyExists, - int, int, double, double, + size_type, size_type, double, double, << "The entry for the indices " << arg1 << " and " << arg2 << " already exists, but the values " << arg3 << " (old) and " << arg4 << " (new) differ " @@ -1481,7 +1491,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcDoFIsConstrainedFromBothObjects, - int, + size_type, << "Degree of freedom " << arg1 << " is constrained from both object in a merge operation."); /** @@ -1490,7 +1500,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcDoFIsConstrainedToConstrainedDoF, - int, + size_type, << "In the given argument a degree of freedom is constrained " << "to another DoF with number " << arg1 << ", which however is constrained by this object. This is not" @@ -1501,7 +1511,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcRowNotStoredHere, - int, + size_type, << "The index set given to this constraint matrix indicates " << "constraints for degree of freedom " << arg1 << " should not be stored by this object, but a constraint " @@ -1513,7 +1523,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 @@ -1524,7 +1534,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: /** @@ -1538,7 +1548,7 @@ private: * of entries that make up the homogenous * part of a constraint. */ - typedef std::vector<std::pair<unsigned int,double> > Entries; + typedef std::vector<std::pair<size_type,double> > Entries; /** * Number of this line. Since only @@ -1547,7 +1557,7 @@ private: * and have to store the line * number explicitly. */ - unsigned int line; + size_type line; /** * Row numbers and values of the @@ -1619,15 +1629,15 @@ private: std::vector<ConstraintLine> lines; /** - * A list of unsigned integers that + * A list of size_type that * contains the position of the * ConstraintLine of a constrained degree * of freedom, or - * numbers::invalid_unsigned_int if the + * numbers::invalid_size_type if the * degree of freedom is not * constrained. The - * numbers::invalid_unsigned_int - * return value returns thus whether + * numbers::invalid_size_type + * return value returns thus whether * there is a constraint line for a given * degree of freedom index. Note that * this class has no notion of how many @@ -1676,7 +1686,7 @@ private: * contributions into vectors and * matrices. */ - std::vector<unsigned int> lines_cache; + std::vector<size_type> lines_cache; /** * This IndexSet is used to limit the @@ -1699,7 +1709,7 @@ private: * index of line @p line in the vector * lines_cache using local_lines. */ - unsigned int calculate_line_index (const unsigned int line) const; + size_type calculate_line_index (const size_type line) const; /** * Return @p true if the weight of an @@ -1708,7 +1718,7 @@ private: * used to delete entries with zero * weight. */ - static bool check_zero_weight (const std::pair<unsigned int, double> &p); + static bool check_zero_weight (const std::pair<size_type, double> &p); /** * Dummy table that serves as default @@ -1724,12 +1734,12 @@ private: */ template <typename MatrixType, typename VectorType> void - distribute_local_to_global (const FullMatrix<double> &local_matrix, - const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs, + distribute_local_to_global (const FullMatrix<double> &local_matrix, + const Vector<double> &local_vector, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs, internal::bool2type<false>) const; /** @@ -1739,12 +1749,12 @@ private: */ template <typename MatrixType, typename VectorType> void - distribute_local_to_global (const FullMatrix<double> &local_matrix, - const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs, + distribute_local_to_global (const FullMatrix<double> &local_matrix, + const Vector<double> &local_vector, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs, internal::bool2type<true>) const; /** @@ -1754,10 +1764,10 @@ private: */ template <typename SparsityType> void - add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, + add_entries_local_to_global (const std::vector<size_type> &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type<false>) const; /** @@ -1767,10 +1777,10 @@ private: */ template <typename SparsityType> void - add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, + add_entries_local_to_global (const std::vector<size_type> &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type<true>) const; /** @@ -1784,7 +1794,7 @@ private: * row indices. */ void - make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, + make_sorted_row_list (const std::vector<size_type> &local_dof_indices, internals::GlobalRowsFromLocal &global_rows) const; /** @@ -1798,18 +1808,18 @@ private: * function. */ void - make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, - std::vector<unsigned int> &active_dofs) const; + make_sorted_row_list (const std::vector<size_type> &local_dof_indices, + std::vector<size_type> &active_dofs) const; /** * Internal helper function for * distribute_local_to_global function. */ double - resolve_vector_entry (const unsigned int i, + resolve_vector_entry (const size_type i, const internals::GlobalRowsFromLocal &global_rows, const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, + const std::vector<size_type> &local_dof_indices, const FullMatrix<double> &local_matrix) const; }; @@ -1840,7 +1850,7 @@ ConstraintMatrix::ConstraintMatrix (const ConstraintMatrix &constraint_matrix) inline void -ConstraintMatrix::add_line (const unsigned int line) +ConstraintMatrix::add_line (const size_type line) { Assert (sorted==false, ExcMatrixIsClosed()); @@ -1854,9 +1864,9 @@ ConstraintMatrix::add_line (const unsigned int line) // several terabytes of memory to // resize the various arrays below // :-) - Assert (line != numbers::invalid_unsigned_int, + Assert (line != numbers::invalid_size_type, ExcInternalError()); - const unsigned int line_index = calculate_line_index (line); + const size_type line_index = calculate_line_index (line); // check whether line already exists; it // may, in which case we can just quit @@ -1866,9 +1876,9 @@ ConstraintMatrix::add_line (const unsigned int line) // if necessary enlarge vector of // existing entries for cache if (line_index >= lines_cache.size()) - lines_cache.resize (std::max(2*static_cast<unsigned int>(lines_cache.size()), + lines_cache.resize (std::max(2*static_cast<size_type>(lines_cache.size()), line_index+1), - numbers::invalid_unsigned_int); + numbers::invalid_size_type); // push a new line to the end of the // list @@ -1882,9 +1892,9 @@ ConstraintMatrix::add_line (const unsigned int line) inline void -ConstraintMatrix::add_entry (const unsigned int line, - const unsigned int column, - const double value) +ConstraintMatrix::add_entry (const size_type line, + const size_type column, + const double value) { Assert (sorted==false, ExcMatrixIsClosed()); Assert (line != column, @@ -1898,7 +1908,7 @@ ConstraintMatrix::add_entry (const unsigned int line, // in any case: exit the function if an // entry for this column already exists, // since we don't want to enter it twice - Assert (lines_cache[calculate_line_index(line)] != numbers::invalid_unsigned_int, + Assert (lines_cache[calculate_line_index(line)] != numbers::invalid_size_type, ExcInternalError()); ConstraintLine *line_ptr = &lines[lines_cache[calculate_line_index(line)]]; Assert (line_ptr->line == line, ExcInternalError()); @@ -1919,12 +1929,12 @@ ConstraintMatrix::add_entry (const unsigned int line, inline void -ConstraintMatrix::set_inhomogeneity (const unsigned int line, - const double value) +ConstraintMatrix::set_inhomogeneity (const size_type line, + const double value) { - const unsigned int line_index = calculate_line_index(line); + const size_type line_index = calculate_line_index(line); Assert( line_index < lines_cache.size() && - lines_cache[line_index] != numbers::invalid_unsigned_int, + lines_cache[line_index] != numbers::invalid_size_type, ExcMessage("call add_line() before calling set_inhomogeneity()")); Assert(lines_cache[line_index] < lines.size(), ExcInternalError()); ConstraintLine *line_ptr = &lines[lines_cache[line_index]]; @@ -1934,7 +1944,7 @@ ConstraintMatrix::set_inhomogeneity (const unsigned int line, inline -unsigned int +types::global_dof_index ConstraintMatrix::n_constraints () const { return lines.size(); @@ -1944,26 +1954,26 @@ ConstraintMatrix::n_constraints () const inline bool -ConstraintMatrix::is_constrained (const unsigned int index) const +ConstraintMatrix::is_constrained (const size_type index) const { - const unsigned int line_index = calculate_line_index(index); + const size_type line_index = calculate_line_index(index); return ((line_index < lines_cache.size()) && - (lines_cache[line_index] != numbers::invalid_unsigned_int)); + (lines_cache[line_index] != numbers::invalid_size_type)); } inline bool -ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) const +ConstraintMatrix::is_inhomogeneously_constrained (const size_type index) const { // check whether the entry is // constrained. could use is_constrained, but // that means computing the line index twice - const unsigned int line_index = calculate_line_index(index); + const size_type line_index = calculate_line_index(index); if (line_index >= lines_cache.size() || - lines_cache[line_index] == numbers::invalid_unsigned_int) + lines_cache[line_index] == numbers::invalid_size_type) return false; else { @@ -1975,15 +1985,15 @@ ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) cons inline -const std::vector<std::pair<unsigned int,double> > * -ConstraintMatrix::get_constraint_entries (unsigned int line) const +const std::vector<std::pair<types::global_dof_index,double> > * +ConstraintMatrix::get_constraint_entries (const size_type line) const { // check whether the entry is // constrained. could use is_constrained, but // that means computing the line index twice - const unsigned int line_index = calculate_line_index(line); + const size_type line_index = calculate_line_index(line); if (line_index >= lines_cache.size() || - lines_cache[line_index] == numbers::invalid_unsigned_int) + lines_cache[line_index] == numbers::invalid_size_type) return 0; else return &lines[lines_cache[line_index]].entries; @@ -1993,14 +2003,14 @@ ConstraintMatrix::get_constraint_entries (unsigned int line) const inline double -ConstraintMatrix::get_inhomogeneity (const unsigned int line) const +ConstraintMatrix::get_inhomogeneity (const size_type line) const { // check whether the entry is // constrained. could use is_constrained, but // that means computing the line index twice - const unsigned int line_index = calculate_line_index(line); + const size_type line_index = calculate_line_index(line); if (line_index >= lines_cache.size() || - lines_cache[line_index] == numbers::invalid_unsigned_int) + lines_cache[line_index] == numbers::invalid_size_type) return 0; else return lines[lines_cache[line_index]].inhomogeneity; @@ -2008,8 +2018,8 @@ ConstraintMatrix::get_inhomogeneity (const unsigned int line) const -inline unsigned int -ConstraintMatrix::calculate_line_index (const unsigned int line) const +inline types::global_dof_index +ConstraintMatrix::calculate_line_index (const size_type line) const { //IndexSet is unused (serial case) if (!local_lines.size()) @@ -2024,7 +2034,7 @@ ConstraintMatrix::calculate_line_index (const unsigned int line) const inline bool -ConstraintMatrix::can_store_line (unsigned int line_index) const +ConstraintMatrix::can_store_line (size_type line_index) const { return !local_lines.size() || local_lines.is_element(line_index); } @@ -2034,9 +2044,9 @@ ConstraintMatrix::can_store_line (unsigned int line_index) const template <class VectorType> inline void ConstraintMatrix::distribute_local_to_global ( - const unsigned int index, - const double value, - VectorType &global_vector) const + const size_type index, + const double value, + VectorType &global_vector) const { Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); @@ -2046,7 +2056,7 @@ void ConstraintMatrix::distribute_local_to_global ( { const ConstraintLine &position = lines[lines_cache[calculate_line_index(index)]]; - for (unsigned int j=0; j<position.entries.size(); ++j) + for (size_type j=0; j<position.entries.size(); ++j) global_vector(position.entries[j].first) += value * position.entries[j].second; } @@ -2072,7 +2082,7 @@ void ConstraintMatrix::distribute_local_to_global ( { const ConstraintLine &position = lines[lines_cache[calculate_line_index(*local_indices_begin)]]; - for (unsigned int j=0; j<position.entries.size(); ++j) + for (size_type j=0; j<position.entries.size(); ++j) global_vector(position.entries[j].first) += *local_vector_begin * position.entries[j].second; } @@ -2084,9 +2094,9 @@ template <class InVector, class OutVector> inline void ConstraintMatrix::distribute_local_to_global ( - const InVector &local_vector, - const std::vector<unsigned int> &local_dof_indices, - OutVector &global_vector) const + const InVector &local_vector, + const std::vector<size_type> &local_dof_indices, + OutVector &global_vector) const { Assert (local_vector.size() == local_dof_indices.size(), ExcDimensionMismatch(local_vector.size(), local_dof_indices.size())); @@ -2115,7 +2125,7 @@ void ConstraintMatrix::get_dof_values (const VectorType &global_vector, const ConstraintLine &position = lines[lines_cache[calculate_line_index(*local_indices_begin)]]; typename VectorType::value_type value = position.inhomogeneity; - for (unsigned int j=0; j<position.entries.size(); ++j) + for (size_type j=0; j<position.entries.size(); ++j) value += (global_vector(position.entries[j].first) * position.entries[j].second); *local_vector_begin = value; @@ -2129,9 +2139,9 @@ template <typename MatrixType> inline void ConstraintMatrix:: -distribute_local_to_global (const FullMatrix<double> &local_matrix, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix) const +distribute_local_to_global (const FullMatrix<double> &local_matrix, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix) const { // create a dummy and hand on to the // function actually implementing this @@ -2148,12 +2158,12 @@ template <typename MatrixType, typename VectorType> inline void ConstraintMatrix:: -distribute_local_to_global (const FullMatrix<double> &local_matrix, - const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs) const +distribute_local_to_global (const FullMatrix<double> &local_matrix, + const Vector<double> &local_vector, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs) const { // enter the internal function with the // respective block information set, the @@ -2170,10 +2180,10 @@ template <typename SparsityType> inline void ConstraintMatrix:: -add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask) const +add_entries_local_to_global (const std::vector<size_type> &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask) const { // enter the internal function with the // respective block information set, the 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 037b2f9535..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 @@ -24,6 +29,9 @@ #include <deal.II/lac/block_sparse_matrix.h> #include <deal.II/lac/parallel_vector.h> #include <deal.II/lac/parallel_block_vector.h> +#include <deal.II/lac/petsc_parallel_vector.h> +#include <deal.II/lac/petsc_vector.h> +#include <deal.II/lac/trilinos_vector.h> #include <iomanip> @@ -80,15 +88,15 @@ ConstraintMatrix::condense (const VectorType &uncondensed, new_line.reserve (uncondensed.size()); std::vector<ConstraintLine>::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - unsigned int n_rows = uncondensed.size(); + size_type shift = 0; + size_type n_rows = uncondensed.size(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -100,7 +108,7 @@ ConstraintMatrix::condense (const VectorType &uncondensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; i<n_rows; ++i) + for (size_type i=row+1; i<n_rows; ++i) new_line.push_back (i-shift); break; }; @@ -116,7 +124,7 @@ ConstraintMatrix::condense (const VectorType &uncondensed, // only evaluated so often as there are // entries in new_line[*] which tells us // which constraints exist - for (unsigned int row=0; row<uncondensed.size(); ++row) + for (size_type row=0; row<uncondensed.size(); ++row) if (new_line[row] != -1) // line not constrained // copy entry @@ -125,7 +133,7 @@ ConstraintMatrix::condense (const VectorType &uncondensed, else // line must be distributed { - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed(new_line[next_constraint->entries[q].first]) += uncondensed(row) * next_constraint->entries[q].second; @@ -159,7 +167,7 @@ ConstraintMatrix::condense (VectorType &vec) const "without any matrix specified.")); const typename VectorType::value_type old_value = vec(constraint_line->line); - for (unsigned int q=0; q!=constraint_line->entries.size(); ++q) + for (size_type q=0; q!=constraint_line->entries.size(); ++q) if (vec.in_local_range(constraint_line->entries[q].first) == true) vec(constraint_line->entries[q].first) += (static_cast<typename VectorType::value_type> @@ -219,15 +227,15 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, new_line.reserve (uncondensed_struct.n_rows()); std::vector<ConstraintLine>::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - const unsigned int n_rows = uncondensed_struct.n_rows(); + size_type shift = 0; + const size_type n_rows = uncondensed_struct.n_rows(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -239,7 +247,7 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; i<n_rows; ++i) + for (size_type i=row+1; i<n_rows; ++i) new_line.push_back (i-shift); break; }; @@ -256,7 +264,7 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, // only evaluated so often as there are // entries in new_line[*] which tells us // which constraints exist - for (unsigned int row=0; row<uncondensed_struct.n_rows(); ++row) + for (size_type row=0; row<uncondensed_struct.n_rows(); ++row) if (new_line[row] != -1) { // line not constrained @@ -278,7 +286,7 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, while (c->line != p->column()) ++c; - for (unsigned int q=0; q!=c->entries.size(); ++q) + for (size_type q=0; q!=c->entries.size(); ++q) // distribute to rows with // appropriate weight condensed.add (new_line[row], new_line[c->entries[q].first], @@ -307,7 +315,7 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, // for each column: distribute if (new_line[p->column()] != -1) // column is not constrained - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[p->column()], p->value() * @@ -323,8 +331,8 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, while (c->line != p->column()) ++c; - for (unsigned int r=0; r!=c->entries.size(); ++r) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type r=0; r!=c->entries.size(); ++r) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[c->entries[r].first], p->value() * @@ -332,7 +340,7 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, c->entries[r].second); if (use_vectors == true) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed_vector (new_line[next_constraint->entries[q].first]) -= p->value() * next_constraint->entries[q].second * @@ -341,7 +349,7 @@ ConstraintMatrix::condense (const SparseMatrix<number> &uncondensed, // condense the vector if (use_vectors == true) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed_vector(new_line[next_constraint->entries[q].first]) += uncondensed_vector(row) * next_constraint->entries[q].second; @@ -372,33 +380,33 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, AssertDimension (vec.size(), sparsity.n_rows()); double average_diagonal = 0; - for (unsigned int i=0; i<uncondensed.m(); ++i) + for (size_type i=0; i<uncondensed.m(); ++i) average_diagonal += std::fabs (uncondensed.diag_element(i)); average_diagonal /= uncondensed.m(); // store for each index whether it must be // distributed or not. If entry is - // invalid_unsigned_int, no distribution is + // invalid_size_type, no distribution is // necessary. otherwise, the number states // which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over cols { for (typename SparseMatrix<number>::iterator entry = uncondensed.begin(row); entry != uncondensed.end(row); ++entry) { - const unsigned int column = entry->column(); + const size_type column = entry->column(); // end of row reached? // this should not @@ -408,7 +416,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, Assert (column != SparsityPattern::invalid_entry, ExcMatrixNotClosed()); - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) // distribute entry at // regular row @p row // and irregular column @@ -416,7 +424,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, // set old entry to // zero { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) uncondensed.add (row, lines[distribute[column]].entries[q].first, @@ -444,7 +452,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, entry = uncondensed.begin(row); entry != uncondensed.end(row); ++entry) { - const unsigned int column = entry->column(); + const size_type column = entry->column(); // end of row reached? // this should not @@ -454,7 +462,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, Assert (column != SparsityPattern::invalid_entry, ExcMatrixNotClosed()); - if (distribute[column] == numbers::invalid_unsigned_int) + if (distribute[column] == numbers::invalid_size_type) // distribute entry at // irregular row // @p row and regular @@ -462,7 +470,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, // column. set // old entry to zero { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[q].first, column, @@ -480,9 +488,9 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, // to one on main // diagonal, zero otherwise { - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[p].first, lines[distribute[column]].entries[q].first, @@ -505,7 +513,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed, // take care of vector if (use_vectors == true) { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) vec(lines[distribute[row]].entries[q].first) += (vec(row) * lines[distribute[row]].entries[q].second); @@ -527,7 +535,7 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, // the other function above. const bool use_vectors = vec.n_blocks() == 0 ? false : true; - const unsigned int blocks = uncondensed.n_block_rows(); + const size_type blocks = uncondensed.n_block_rows(); const BlockSparsityPattern & sparsity = uncondensed.get_sparsity_pattern (); @@ -550,8 +558,8 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, } double average_diagonal = 0; - for (unsigned int b=0; b<uncondensed.n_block_rows(); ++b) - for (unsigned int i=0; i<uncondensed.block(b,b).m(); ++i) + for (size_type b=0; b<uncondensed.n_block_rows(); ++b) + for (size_type i=0; i<uncondensed.block(b,b).m(); ++i) average_diagonal += std::fabs (uncondensed.block(b,b).diag_element(i)); average_diagonal /= uncondensed.m(); @@ -560,27 +568,27 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, // store for each index whether it must be // distributed or not. If entry is - // numbers::invalid_unsigned_int, + // numbers::invalid_size_type, // no distribution is necessary. // otherwise, the number states which line // in the constraint matrix handles this // index - std::vector<unsigned int> distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { // get index of this row // within the blocks - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; + const size_type block_row = block_index.first; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over // all columns and see // whether this column must @@ -593,17 +601,17 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, // this blockrow and the // corresponding row // therein - for (unsigned int block_col=0; block_col<blocks; ++block_col) + for (size_type block_col=0; block_col<blocks; ++block_col) { for (typename SparseMatrix<number>::iterator entry = uncondensed.block(block_row, block_col).begin(block_index.second); entry != uncondensed.block(block_row, block_col).end(block_index.second); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col,entry->column()); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at // regular row @p row // and irregular column @@ -612,7 +620,7 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, { const double old_value = entry->value (); - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) uncondensed.add (row, lines[distribute[global_col]].entries[q].first, @@ -640,18 +648,18 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, // whole row into the // chunks defined by the // blocks - for (unsigned int block_col=0; block_col<blocks; ++block_col) + for (size_type block_col=0; block_col<blocks; ++block_col) { for (typename SparseMatrix<number>::iterator entry = uncondensed.block(block_row, block_col).begin(block_index.second); entry != uncondensed.block(block_row, block_col).end(block_index.second); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, entry->column()); if (distribute[global_col] == - numbers::invalid_unsigned_int) + numbers::invalid_size_type) // distribute // entry at // irregular @@ -664,7 +672,7 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, { const double old_value = entry->value(); - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[q].first, global_col, @@ -684,9 +692,9 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, { const double old_value = entry->value (); - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) { - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[p].first, lines[distribute[global_col]].entries[q].first, old_value * @@ -707,7 +715,7 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed, // take care of vector if (use_vectors == true) { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) vec(lines[distribute[row]].entries[q].first) += (vec(row) * lines[distribute[row]].entries[q].second); @@ -730,33 +738,61 @@ namespace internal { namespace { - // TODO: in general we should iterate over the constraints and not over all DoFs - // for performance reasons + typedef types::global_dof_index size_type; + template<class VEC> - void set_zero_parallel(const dealii::ConstraintMatrix &cm, VEC &vec, unsigned int shift = 0) + void set_zero_parallel(const std::vector<size_type> &cm, VEC &vec, size_type shift = 0) { - Assert(!vec.has_ghost_elements(), ExcInternalError());//ExcGhostsPresent()); - - const unsigned int - start = vec.local_range().first, - end = vec.local_range().second; - for (unsigned int i=start; i<end; ++i) - if (cm.is_constrained (shift + i)) - vec(i) = 0; + Assert(!vec.has_ghost_elements(), ExcInternalError()); + IndexSet locally_owned = vec.locally_owned_elements(); + for (typename std::vector<size_type>::const_iterator it = cm.begin(); + it != cm.end(); ++it) + { + // 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)<shift) + continue; + size_type idx = *it - shift; + if (idx<vec.size() && locally_owned.is_element(idx)) + vec(idx) = 0.; + } + } + + template<typename Number> + void set_zero_parallel(const std::vector<size_type> &cm, parallel::distributed::Vector<Number> &vec, size_type shift = 0) + { + for (typename std::vector<size_type>::const_iterator it = cm.begin(); + it != cm.end(); ++it) + { + // 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)<shift) + continue; + size_type idx = *it - shift; + if (vec.in_local_range(idx)) + vec(idx) = 0.; + } + vec.zero_out_ghosts(); } template<class VEC> - void set_zero_in_parallel(const dealii::ConstraintMatrix &cm, VEC &vec, internal::bool2type<false>) + void set_zero_in_parallel(const std::vector<size_type> &cm, VEC &vec, internal::bool2type<false>) { set_zero_parallel(cm, vec, 0); } // in parallel for BlockVectors template<class VEC> - void set_zero_in_parallel(const dealii::ConstraintMatrix &cm, VEC &vec, internal::bool2type<true>) + void set_zero_in_parallel(const std::vector<size_type> &cm, VEC &vec, internal::bool2type<true>) { - unsigned int start_shift = 0; - for (unsigned int j=0; j<vec.n_blocks(); ++j) + size_type start_shift = 0; + for (size_type j=0; j<vec.n_blocks(); ++j) { set_zero_parallel(cm, vec.block(j), start_shift); start_shift += vec.block(j).size(); @@ -764,19 +800,15 @@ namespace internal } template<class VEC> - void set_zero_serial(const dealii::ConstraintMatrix &cm, VEC &vec) + void set_zero_serial(const std::vector<size_type> &cm, VEC &vec) { - // TODO would be faster: - /* std::vector<dealii::ConstraintMatrix::ConstraintLine>::const_iterator constraint_line = cm.lines.begin(); - for (; constraint_line!=cm.lines.end(); ++constraint_line) - vec(constraint_line->line) = 0.;*/ - for (unsigned int i=0; i<vec.size(); ++i) - if (cm.is_constrained (i)) - vec(i) = 0; + for (typename std::vector<size_type>::const_iterator it = cm.begin(); + it != cm.end(); ++it) + vec(*it) = 0.; } template<class VEC> - void set_zero_all(const dealii::ConstraintMatrix &cm, VEC &vec) + void set_zero_all(const std::vector<size_type> &cm, VEC &vec) { set_zero_in_parallel<VEC>(cm, vec, internal::bool2type<IsBlockVector<VEC>::value>()); vec.compress(VectorOperation::insert); @@ -784,31 +816,16 @@ namespace internal template<class T> - void set_zero_all(const dealii::ConstraintMatrix &cm, dealii::Vector<T> &vec) + void set_zero_all(const std::vector<size_type> &cm, dealii::Vector<T> &vec) { set_zero_serial(cm, vec); } template<class T> - void set_zero_all(const dealii::ConstraintMatrix &cm, dealii::BlockVector<T> &vec) + void set_zero_all(const std::vector<size_type> &cm, dealii::BlockVector<T> &vec) { set_zero_serial(cm, vec); } - - - template<class T> - void set_zero_all(const dealii::ConstraintMatrix &, dealii::parallel::distributed::Vector<T> &) - { - // should use the general template above, but requires that - // some member functions are added to parallel::distributed::Vector - Assert (false, ExcNotImplemented()); - } - - template<class T> - void set_zero_all(const dealii::ConstraintMatrix &, dealii::parallel::distributed::BlockVector<T> &) - { - Assert (false, ExcNotImplemented()); - } } } } @@ -818,7 +835,12 @@ template <class VectorType> void ConstraintMatrix::set_zero (VectorType &vec) const { - internal::ConstraintMatrix::set_zero_all(*this, vec); + // since we lines is a private member, we cannot pass it to the functions + // above. therefore, copy the content which is cheap + std::vector<size_type> constrained_lines(lines.size()); + for (unsigned int i=0; i<lines.size(); ++i) + constrained_lines[i] = lines[i].line; + internal::ConstraintMatrix::set_zero_all(constrained_lines, vec); } @@ -828,7 +850,7 @@ template <typename VectorType> void ConstraintMatrix:: distribute_local_to_global (const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, + const std::vector<size_type> &local_dof_indices, VectorType &global_vector, const FullMatrix<double> &local_matrix) const { @@ -837,11 +859,11 @@ distribute_local_to_global (const Vector<double> &local_vector, AssertDimension (local_matrix.m(), local_dof_indices.size()); AssertDimension (local_matrix.n(), local_dof_indices.size()); - const unsigned int n_local_dofs = local_vector.size(); + const size_type n_local_dofs = local_vector.size(); if (lines.empty()) global_vector.add(local_dof_indices, local_vector); else - for (unsigned int i=0; i<n_local_dofs; ++i) + for (size_type i=0; i<n_local_dofs; ++i) { // check whether the current index is // constrained. if not, just write the entry @@ -855,7 +877,7 @@ distribute_local_to_global (const Vector<double> &local_vector, // find the constraint line to the given // global dof index - const unsigned int line_index = calculate_line_index (local_dof_indices[i]); + const size_type line_index = calculate_line_index (local_dof_indices[i]); const ConstraintLine *position = lines_cache.size() <= line_index ? 0 : &lines[lines_cache[line_index]]; @@ -865,7 +887,7 @@ distribute_local_to_global (const Vector<double> &local_vector, // constrained. If so, distribute the constraint const double val = position->inhomogeneity; if (val != 0) - for (unsigned int j=0; j<n_local_dofs; ++j) + for (size_type j=0; j<n_local_dofs; ++j) if (is_constrained(local_dof_indices[j]) == false) global_vector(local_dof_indices[j]) -= val * local_matrix(j,i); else @@ -876,7 +898,7 @@ distribute_local_to_global (const Vector<double> &local_vector, const ConstraintLine &position_j = lines[lines_cache[calculate_line_index(local_dof_indices[j])]]; - for (unsigned int q=0; q<position_j.entries.size(); ++q) + for (size_type q=0; q<position_j.entries.size(); ++q) { Assert (!(!local_lines.size() || local_lines.is_element(position_j.entries[q].first)) @@ -890,7 +912,7 @@ distribute_local_to_global (const Vector<double> &local_vector, // now distribute the constraint, // but make sure we don't touch // the entries of fixed dofs - for (unsigned int j=0; j<position->entries.size(); ++j) + for (size_type j=0; j<position->entries.size(); ++j) { Assert (!(!local_lines.size() || local_lines.is_element(position->entries[j].first)) @@ -921,15 +943,15 @@ ConstraintMatrix::distribute (const VectorType &condensed, old_line.reserve (uncondensed.size()); std::vector<ConstraintLine>::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - unsigned int n_rows = uncondensed.size(); + size_type shift = 0; + size_type n_rows = uncondensed.size(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) old_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -941,10 +963,10 @@ ConstraintMatrix::distribute (const VectorType &condensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; i<n_rows; ++i) + for (size_type i=row+1; i<n_rows; ++i) old_line.push_back (i-shift); break; - }; + } } else old_line.push_back (row-shift); @@ -957,7 +979,7 @@ ConstraintMatrix::distribute (const VectorType &condensed, // only evaluated so often as there are // entries in new_line[*] which tells us // which constraints exist - for (unsigned int line=0; line<uncondensed.size(); ++line) + for (size_type line=0; line<uncondensed.size(); ++line) if (old_line[line] != -1) // line was not condensed away uncondensed(line) = condensed(old_line[line]); @@ -969,7 +991,7 @@ ConstraintMatrix::distribute (const VectorType &condensed, uncondensed(line) = next_constraint->inhomogeneity; // then add the different // contributions - for (unsigned int i=0; i<next_constraint->entries.size(); ++i) + for (size_type i=0; i<next_constraint->entries.size(); ++i) uncondensed(line) += (condensed(old_line[next_constraint->entries[i].first]) * next_constraint->entries[i].second); ++next_constraint; @@ -977,87 +999,183 @@ ConstraintMatrix::distribute (const VectorType &condensed, } +namespace internal +{ + namespace + { + // create an output vector that consists of the input vector's locally owned + // elements plus some ghost elements that need to be imported from elsewhere + // + // this is an operation that is different for all vector types and so we + // need a few overloads +#ifdef DEAL_II_WITH_TRILINOS + void + import_vector_with_ghost_elements (const TrilinosWrappers::MPI::Vector &vec, + const IndexSet &/*locally_owned_elements*/, + const IndexSet &needed_elements, + TrilinosWrappers::MPI::Vector &output, + const internal::bool2type<false> /*is_block_vector*/) + { + Assert(!vec.has_ghost_elements(), + TrilinosWrappers::VectorBase::ExcGhostsPresent()); +#ifdef DEAL_II_WITH_MPI + const Epetra_MpiComm *mpi_comm + = dynamic_cast<const Epetra_MpiComm *>(&vec.trilinos_vector().Comm()); + + Assert (mpi_comm != 0, ExcInternalError()); + output.reinit (needed_elements, mpi_comm->GetMpiComm()); +#else + output.reinit (needed_elements, MPI_COMM_WORLD); +#endif + output = vec; + } +#endif -template<class VectorType> +#ifdef DEAL_II_WITH_PETSC + void + import_vector_with_ghost_elements (const PETScWrappers::MPI::Vector &vec, + const IndexSet &locally_owned_elements, + const IndexSet &needed_elements, + PETScWrappers::MPI::Vector &output, + const internal::bool2type<false> /*is_block_vector*/) + { + output.reinit (vec.get_mpi_communicator(), locally_owned_elements, needed_elements); + output = vec; + } +#endif + + template <typename number> + void + import_vector_with_ghost_elements (const parallel::distributed::Vector<number> &vec, + const IndexSet &locally_owned_elements, + const IndexSet &needed_elements, + parallel::distributed::Vector<number> &output, + const internal::bool2type<false> /*is_block_vector*/) + { + // TODO: the in vector might already have all elements. need to find a + // way to efficiently avoid the copy then + const_cast<parallel::distributed::Vector<number>&>(vec).zero_out_ghosts(); + output.reinit (locally_owned_elements, needed_elements, vec.get_mpi_communicator()); + output = vec; + output.update_ghost_values(); + } + + + // all other vector non-block vector types are sequential and we should + // not have this function called at all -- so throw an exception + template <typename Vector> + void + import_vector_with_ghost_elements (const Vector &/*vec*/, + const IndexSet &/*locally_owned_elements*/, + const IndexSet &/*needed_elements*/, + Vector &/*output*/, + const internal::bool2type<false> /*is_block_vector*/) + { + Assert (false, ExcMessage ("We shouldn't even get here!")); + } + + + // for block vectors, simply dispatch to the individual blocks + template <class VectorType> + void + import_vector_with_ghost_elements (const VectorType &vec, + const IndexSet &locally_owned_elements, + const IndexSet &needed_elements, + VectorType &output, + const internal::bool2type<true> /*is_block_vector*/) + { + output.reinit (vec.n_blocks()); + + types::global_dof_index block_start = 0; + for (unsigned int b=0; b<vec.n_blocks(); ++b) + { + import_vector_with_ghost_elements (vec.block(b), + locally_owned_elements.get_view (block_start, block_start+vec.block(b).size()), + needed_elements.get_view (block_start, block_start+vec.block(b).size()), + output.block(b), + internal::bool2type<false>()); + block_start += vec.block(b).size(); + } + + output.collect_sizes (); + } + } +} + + +template <class VectorType> void ConstraintMatrix::distribute (VectorType &vec) const { - Assert (sorted==true, ExcMatrixIsClosed()); - - // if the vector type supports parallel storage and if the - // vector actually does it, we need to be a bit more - // careful about how we do things - if ((vec.supports_distributed_data == true) - && - (vec.locally_owned_elements() != complete_index_set(vec.size()))) + Assert (sorted==true, ExcMatrixNotClosed()); + + // if the vector type supports parallel storage and if the vector actually + // does store only part of the vector, distributing is slightly more + // complicated. we might be able to skip the complicated part if one + // processor owns everything and pretend that this is a sequential vector, + // but it is difficult for the other processors to know whether they should + // not do anything or if other processors will create a temporary vector, + // exchange data (requiring communication, maybe even with the processors + // that do not own anything because of that particular parallel model), and + // call compress() finally. the first case here is for the complicated case, + // the last else is for the simple case (sequential vector) + const IndexSet vec_owned_elements = vec.locally_owned_elements(); + if (vec.supports_distributed_data == true) { - const IndexSet vec_owned_elements = vec.locally_owned_elements(); + // This processor owns only part of the vector. one may think that + // every processor should be able to simply communicate those elements + // it owns and for which it knows that they act as sources to constrained + // DoFs to the owner of these DoFs. This would lead to a scheme where all + // we need to do is to add some local elements to (possibly non-local) ones + // and then call compress(). + // + // Alas, this scheme does not work as evidenced by the disaster of bug #51, + // see http://code.google.com/p/dealii/issues/detail?id=51 and the + // reversion of one attempt that implements this in r29662. Rather, we + // need to get a vector that has all the *sources* or constraints we + // own locally, possibly as ghost vector elements, then read from them, + // and finally throw away the ghosted vector. Implement this in the following. + IndexSet needed_elements = vec_owned_elements; typedef std::vector<ConstraintLine>::const_iterator constraint_iterator; - -#ifdef DEBUG - { - // the algorithm below pushes contributions c_ij x_j to a constrained - // DoF x_j *from the side of the owner of x_j*, as opposed to pulling - // it from the owner of the target side x_i. this relies on the - // assumption that both target and source know about the constraint - // on x_i. - // - // the disadvantage is that it is incredibly difficult to find out what - // is happening if the assumption is not satisfied. to help debug - // problems of this kind, we do the following in a first step if - // debugging is enabled: - // - every processor who owns an x_j where c_ij!=0 sends a one - // to the owner of x_i to add up - // - the owner of x_i knows how many nonzero entries exist, so can - // verify that the correct number of ones has been added - // - if the sum is not correct, then apparently one of the owners - // of the x_j's did not know to send its one and, consequently, - // will also not know to send the correct c_ij*x_j later on, - // leading to a bug - set_zero (vec); - for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) + for (constraint_iterator it = lines.begin(); + it != lines.end(); ++it) + if (vec_owned_elements.is_element(it->line)) for (unsigned int i=0; i<it->entries.size(); ++i) - if (vec_owned_elements.is_element (it->entries[i].first)) - vec(it->line) += 1; - vec.compress (VectorOperation::add); - - for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) - if (vec_owned_elements.is_element(it->line)) - Assert (vec(it->line) == it->entries.size(), - ExcIncorrectConstraint(it->line, it->entries.size())); - } -#endif + if (!vec_owned_elements.is_element(it->entries[i].first)) + needed_elements.add_index(it->entries[i].first); - // set the values of all constrained DoFs to zero, then add the - // contributions for each constrained DoF of all the ones we - // own locally - set_zero (vec); + VectorType ghosted_vector; + internal::import_vector_with_ghost_elements (vec, + vec_owned_elements, needed_elements, + ghosted_vector, + internal::bool2type<IsBlockVector<VectorType>::value>()); for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) - for (unsigned int i=0; i<it->entries.size(); ++i) - if (vec_owned_elements.is_element(it->entries[i].first)) - vec(it->line) += it->entries[i].second * - vec(it->entries[i].first); - - // in a final step, add the inhomogeneities to the elements we - // own locally - for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) + it != lines.end(); ++it) if (vec_owned_elements.is_element(it->line)) - vec(it->line) += it->inhomogeneity; + { + typename VectorType::value_type + new_value = it->inhomogeneity; + for (unsigned int i=0; i<it->entries.size(); ++i) + new_value += (static_cast<typename VectorType::value_type> + (ghosted_vector(it->entries[i].first)) * + it->entries[i].second); + Assert(numbers::is_finite(new_value), ExcNumberNotFinite()); + vec(it->line) = new_value; + } // now compress to communicate the entries that we added to // and that weren't to local processors to the owner - vec.compress (VectorOperation::add); + // + // this shouldn't be strictly necessary but it probably doesn't + // hurt either + vec.compress (VectorOperation::insert); } else // purely sequential vector (either because the type doesn't // support anything else or because it's completely stored - // locally + // locally) { std::vector<ConstraintLine>::const_iterator next_constraint = lines.begin(); for (; next_constraint != lines.end(); ++next_constraint) @@ -1070,7 +1188,7 @@ ConstraintMatrix::distribute (VectorType &vec) const for (unsigned int i=0; i<next_constraint->entries.size(); ++i) new_value += (static_cast<typename VectorType::value_type> (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; } @@ -1083,6 +1201,8 @@ ConstraintMatrix::distribute (VectorType &vec) const // local_to_global functions. namespace internals { + typedef types::global_dof_index size_type; + // this struct contains all the information // we need to store about each of the // global entries (global_row): are they @@ -1112,8 +1232,8 @@ namespace internals // comes from a constraint. struct Distributing { - Distributing (const unsigned int global_row = numbers::invalid_unsigned_int, - const unsigned int local_row = numbers::invalid_unsigned_int); + Distributing (const size_type global_row = numbers::invalid_size_type, + const size_type local_row = numbers::invalid_size_type); Distributing (const Distributing &in); Distributing &operator = (const Distributing &in); bool operator < (const Distributing &in) const @@ -1121,22 +1241,22 @@ namespace internals return global_row<in.global_row; }; - unsigned int global_row; - unsigned int local_row; - mutable unsigned int constraint_position; + size_type global_row; + size_type local_row; + mutable size_type constraint_position; }; inline - Distributing::Distributing (const unsigned int global_row, - const unsigned int local_row) : + Distributing::Distributing (const size_type global_row, + const size_type local_row) : global_row (global_row), local_row (local_row), - constraint_position (numbers::invalid_unsigned_int) {} + constraint_position (numbers::invalid_size_type) {} inline Distributing::Distributing (const Distributing &in) : - constraint_position (numbers::invalid_unsigned_int) + constraint_position (numbers::invalid_size_type) { *this = (in); } @@ -1148,13 +1268,13 @@ namespace internals local_row = in.local_row; // the constraints pointer should not // contain any data here. - Assert (constraint_position == numbers::invalid_unsigned_int, + Assert (constraint_position == numbers::invalid_size_type, ExcInternalError()); - if (in.constraint_position != numbers::invalid_unsigned_int) + if (in.constraint_position != numbers::invalid_size_type) { constraint_position = in.constraint_position; - in.constraint_position = numbers::invalid_unsigned_int; + in.constraint_position = numbers::invalid_size_type; } return *this; } @@ -1189,52 +1309,52 @@ namespace internals { Assert (element_size == 0, ExcInternalError()); element_size = 6; - data = new std::pair<unsigned int,double> [20*6]; + data = new std::pair<size_type,double> [20*6]; individual_size.resize(20); n_used_elements = 0; } - unsigned int element_size; + size_type element_size; - std::pair<unsigned int,double> *data; + std::pair<size_type,double> *data; - std::vector<unsigned int> individual_size; + std::vector<size_type> individual_size; - unsigned int n_used_elements; + size_type n_used_elements; - unsigned int insert_new_index (const std::pair<unsigned int,double> &pair) + size_type insert_new_index (const std::pair<size_type,double> &pair) { if (element_size == 0) reinit(); if (n_used_elements == individual_size.size()) { - std::pair<unsigned int,double> *new_data = - new std::pair<unsigned int,double> [2*individual_size.size()*element_size]; + std::pair<size_type,double> *new_data = + new std::pair<size_type,double> [2*individual_size.size()*element_size]; memcpy (new_data, data, individual_size.size()*element_size* - sizeof(std::pair<unsigned int,double>)); + sizeof(std::pair<size_type,double>)); delete [] data; data = new_data; individual_size.resize (2*individual_size.size(), 0); } - unsigned int index = n_used_elements; + size_type index = n_used_elements; data[index*element_size] = pair; individual_size[index] = 1; ++n_used_elements; return index; } - void append_index (const unsigned int index, - const std::pair<unsigned int,double> &pair) + void append_index (const size_type index, + const std::pair<size_type,double> &pair) { AssertIndexRange (index, n_used_elements); - const unsigned int my_size = individual_size[index]; + const size_type my_size = individual_size[index]; if (my_size == element_size) { - std::pair<unsigned int,double> *new_data = - new std::pair<unsigned int,double> [2*individual_size.size()*element_size]; - for (unsigned int i=0; i<n_used_elements; ++i) + std::pair<size_type,double> *new_data = + new std::pair<size_type,double> [2*individual_size.size()*element_size]; + for (size_type i=0; i<n_used_elements; ++i) memcpy (&new_data[i*element_size*2], &data[i*element_size], - element_size*sizeof(std::pair<unsigned int,double>)); + element_size*sizeof(std::pair<size_type,double>)); delete [] data; data = new_data; element_size *= 2; @@ -1243,14 +1363,14 @@ namespace internals individual_size[index]++; } - unsigned int - get_size (const unsigned int index) const + size_type + get_size (const size_type index) const { return individual_size[index]; } - const std::pair<unsigned int,double> * - get_entry (const unsigned int index) const + const std::pair<size_type,double> * + get_entry (const size_type index) const { return &data[index*element_size]; } @@ -1299,7 +1419,7 @@ namespace internals class GlobalRowsFromLocal { public: - GlobalRowsFromLocal (const unsigned int n_local_rows) + GlobalRowsFromLocal (const size_type n_local_rows) : total_row_indices (n_local_rows), n_active_rows (n_local_rows), @@ -1308,8 +1428,8 @@ namespace internals // implemented below - void insert_index (const unsigned int global_row, - const unsigned int local_row, + void insert_index (const size_type global_row, + const size_type local_row, const double constraint_value); void sort (); @@ -1321,15 +1441,15 @@ namespace internals << "Constr rows " << n_constraints() << std::endl << "Inhom rows " << n_inhomogeneous_rows << std::endl << "Local: "; - for (unsigned int i=0 ; i<total_row_indices.size() ; ++i) + for (size_type i=0 ; i<total_row_indices.size() ; ++i) os << ' ' << std::setw(4) << total_row_indices[i].local_row; os << std::endl << "Global:"; - for (unsigned int i=0 ; i<total_row_indices.size() ; ++i) + for (size_type i=0 ; i<total_row_indices.size() ; ++i) os << ' ' << std::setw(4) << total_row_indices[i].global_row; os << std::endl << "ConPos:"; - for (unsigned int i=0 ; i<total_row_indices.size() ; ++i) + for (size_type i=0 ; i<total_row_indices.size() ; ++i) os << ' ' << std::setw(4) << total_row_indices[i].constraint_position; os << std::endl; } @@ -1340,14 +1460,14 @@ namespace internals // returns the number of global indices in the // struct - unsigned int size () const + size_type size () const { return n_active_rows; } // returns the global index of the // counter_index-th entry in the list - unsigned int &global_row (const unsigned int counter_index) + size_type &global_row (const size_type counter_index) { return total_row_indices[counter_index].global_row; } @@ -1355,10 +1475,10 @@ namespace internals // returns the number of constraints that are // associated to the counter_index-th entry in // the list - unsigned int size (const unsigned int counter_index) const + size_type size (const size_type counter_index) const { return (total_row_indices[counter_index].constraint_position == - numbers::invalid_unsigned_int ? + numbers::invalid_size_type ? 0 : data_cache.get_size(total_row_indices[counter_index]. constraint_position)); @@ -1366,22 +1486,22 @@ namespace internals // returns the global row associated with the // counter_index-th entry in the list - const unsigned int &global_row (const unsigned int counter_index) const + const size_type &global_row (const size_type counter_index) const { return total_row_indices[counter_index].global_row; } // returns the local row in the cell matrix // associated with the counter_index-th entry - // in the list. Returns invalid_unsigned_int - // for invalid unsigned ints - const unsigned int &local_row (const unsigned int counter_index) const + // in the list. Returns invalid_size_type + // for invalid size_types + const size_type &local_row (const size_type counter_index) const { return total_row_indices[counter_index].local_row; } // writable index - unsigned int &local_row (const unsigned int counter_index) + size_type &local_row (const size_type counter_index) { return total_row_indices[counter_index].local_row; } @@ -1390,8 +1510,8 @@ namespace internals // associated with the counter_index-th entry // in the list in the index_in_constraint-th // position of constraints - unsigned int local_row (const unsigned int counter_index, - const unsigned int index_in_constraint) const + size_type local_row (const size_type counter_index, + const size_type index_in_constraint) const { return (data_cache.get_entry(total_row_indices[counter_index].constraint_position) [index_in_constraint]).first; @@ -1401,8 +1521,8 @@ namespace internals // counter_index-th entry in the list in the // index_in_constraint-th position of // constraints - double constraint_value (const unsigned int counter_index, - const unsigned int index_in_constraint) const + double constraint_value (const size_type counter_index, + const size_type index_in_constraint) const { return (data_cache.get_entry(total_row_indices[counter_index].constraint_position) [index_in_constraint]).second; @@ -1421,7 +1541,7 @@ namespace internals // constrained. This means that // there is one less nontrivial // row - void insert_constraint (const unsigned int constrained_local_dof) + void insert_constraint (const size_type constrained_local_dof) { --n_active_rows; total_row_indices[n_active_rows].local_row = constrained_local_dof; @@ -1433,7 +1553,7 @@ namespace internals // the matrix, but are needed in order // to set matrix diagonals and resolve // inhomogeneities - unsigned int n_constraints () const + size_type n_constraints () const { return total_row_indices.size()-n_active_rows; } @@ -1441,7 +1561,7 @@ namespace internals // returns the number of constrained // dofs in the structure that have an // inhomogeneity - unsigned int n_inhomogeneities () const + size_type n_inhomogeneities () const { return n_inhomogeneous_rows; } @@ -1453,7 +1573,7 @@ namespace internals // sides, so to have fast access to // them, put them before homogeneous // constraints - void set_ith_constraint_inhomogeneous (const unsigned int i) + void set_ith_constraint_inhomogeneous (const size_type i) { Assert (i >= n_inhomogeneous_rows, ExcInternalError()); std::swap (total_row_indices[n_active_rows+i], @@ -1467,7 +1587,7 @@ namespace internals // easily when the // GlobalRowsToLocal has been // set up - unsigned int constraint_origin (unsigned int i) const + size_type constraint_origin (size_type i) const { return total_row_indices[n_active_rows+i].local_row; } @@ -1486,35 +1606,35 @@ namespace internals // how many rows there are, // constraints disregarded - unsigned int n_active_rows; + size_type n_active_rows; // the number of rows with // inhomogeneous constraints - unsigned int n_inhomogeneous_rows; + size_type n_inhomogeneous_rows; }; // a function that appends an additional // row to the list of values, or appends a // value to an already existing // row. Similar functionality as for - // std::map<unsigned int,Distributing>, but + // std::map<size_type,Distributing>, but // here done for a // std::vector<Distributing>, much faster // for short lists as we have them here inline void - GlobalRowsFromLocal::insert_index (const unsigned int global_row, - const unsigned int local_row, - const double constraint_value) + GlobalRowsFromLocal::insert_index (const size_type global_row, + const size_type local_row, + const double constraint_value) { typedef std::vector<Distributing>::iterator index_iterator; index_iterator pos, pos1; Distributing row_value (global_row); - std::pair<unsigned int,double> constraint (local_row, constraint_value); + std::pair<size_type,double> constraint (local_row, constraint_value); // check whether the list was really // sorted before entering here - for (unsigned int i=1; i<n_active_rows; ++i) + for (size_type i=1; i<n_active_rows; ++i) Assert (total_row_indices[i-1] < total_row_indices[i], ExcInternalError()); pos = Utilities::lower_bound (total_row_indices.begin(), @@ -1528,7 +1648,7 @@ namespace internals ++n_active_rows; } - if (pos1->constraint_position == numbers::invalid_unsigned_int) + if (pos1->constraint_position == numbers::invalid_size_type) pos1->constraint_position = data_cache.insert_new_index (constraint); else data_cache.append_index (pos1->constraint_position, constraint); @@ -1548,19 +1668,19 @@ namespace internals void GlobalRowsFromLocal::sort () { - unsigned int i, j, j2, temp, templ, istep; - unsigned int step; + size_type i, j, j2, temp, templ, istep; + size_type step; // check whether the // constraints are really empty. - const unsigned int length = size(); + const size_type length = size(); // make sure that we are in the // range of the vector AssertIndexRange (length, total_row_indices.size()+1); - for (unsigned int i=0; i<length; ++i) + for (size_type i=0; i<length; ++i) Assert (total_row_indices[i].constraint_position == - numbers::invalid_unsigned_int, + numbers::invalid_size_type, ExcInternalError()); step = length/2; @@ -1603,21 +1723,21 @@ namespace internals template <class BlockType> inline void - make_block_starts (const BlockType &block_object, - GlobalRowsFromLocal &global_rows, - std::vector<unsigned int> &block_starts) + make_block_starts (const BlockType &block_object, + GlobalRowsFromLocal &global_rows, + std::vector<size_type> &block_starts) { AssertDimension (block_starts.size(), block_object.n_block_rows()+1); typedef std::vector<Distributing>::iterator row_iterator; row_iterator block_indices = global_rows.total_row_indices.begin(); - const unsigned int num_blocks = block_object.n_block_rows(); - const unsigned int n_active_rows = global_rows.size(); + const size_type num_blocks = block_object.n_block_rows(); + const size_type n_active_rows = global_rows.size(); // find end of rows. block_starts[0] = 0; - for (unsigned int i=1; i<num_blocks; ++i) + for (size_type i=1; i<num_blocks; ++i) { row_iterator first_block = Utilities::lower_bound (block_indices, @@ -1629,7 +1749,7 @@ namespace internals // transform row indices to block-local // index space - for (unsigned int i=block_starts[1]; i<n_active_rows; ++i) + for (size_type i=block_starts[1]; i<n_active_rows; ++i) global_rows.global_row(i) = block_object.get_row_indices(). global_to_local(global_rows.global_row(i)).second; } @@ -1643,20 +1763,20 @@ namespace internals template <class BlockType> inline void - make_block_starts (const BlockType &block_object, - std::vector<unsigned int> &row_indices, - std::vector<unsigned int> &block_starts) + make_block_starts (const BlockType &block_object, + std::vector<size_type> &row_indices, + std::vector<size_type> &block_starts) { AssertDimension (block_starts.size(), block_object.n_block_rows()+1); - typedef std::vector<unsigned int>::iterator row_iterator; + typedef std::vector<size_type>::iterator row_iterator; row_iterator col_indices = row_indices.begin(); - const unsigned int num_blocks = block_object.n_block_rows(); + const size_type num_blocks = block_object.n_block_rows(); // find end of rows. block_starts[0] = 0; - for (unsigned int i=1; i<num_blocks; ++i) + for (size_type i=1; i<num_blocks; ++i) { row_iterator first_block = Utilities::lower_bound (col_indices, @@ -1668,7 +1788,7 @@ namespace internals // transform row indices to local index // space - for (unsigned int i=block_starts[1]; i<row_indices.size(); ++i) + for (size_type i=block_starts[1]; i<row_indices.size(); ++i) row_indices[i] = block_object.get_row_indices(). global_to_local(row_indices[i]).second; } @@ -1682,26 +1802,26 @@ namespace internals static inline double resolve_matrix_entry (const GlobalRowsFromLocal &global_rows, const GlobalRowsFromLocal &global_cols, - const unsigned int i, - const unsigned int j, - const unsigned int loc_row, + const size_type i, + const size_type j, + const size_type loc_row, const FullMatrix<double> &local_matrix) { - const unsigned int loc_col = global_cols.local_row(j); + const size_type loc_col = global_cols.local_row(j); double col_val; // case 1: row has direct contribution in // local matrix. decide whether col has a // direct contribution. if not, // set the value to zero. - if (loc_row != numbers::invalid_unsigned_int) + if (loc_row != numbers::invalid_size_type) { - col_val = ((loc_col != numbers::invalid_unsigned_int) ? + col_val = ((loc_col != numbers::invalid_size_type) ? local_matrix(loc_row, loc_col) : 0); // account for indirect contributions by // constraints in column - for (unsigned int p=0; p<global_cols.size(j); ++p) + for (size_type p=0; p<global_cols.size(j); ++p) col_val += (local_matrix(loc_row, global_cols.local_row(j,p)) * global_cols.constraint_value(j,p)); } @@ -1715,12 +1835,12 @@ namespace internals // constraints in row, going trough the // direct and indirect references in the // given column. - for (unsigned int q=0; q<global_rows.size(i); ++q) + for (size_type q=0; q<global_rows.size(i); ++q) { - double add_this = (loc_col != numbers::invalid_unsigned_int) + double add_this = (loc_col != numbers::invalid_size_type) ? local_matrix(global_rows.local_row(i,q), loc_col) : 0; - for (unsigned int p=0; p<global_cols.size(j); ++p) + for (size_type p=0; p<global_cols.size(j); ++p) add_this += (local_matrix(global_rows.local_row(i,q), global_cols.local_row(j,p)) * @@ -1741,18 +1861,18 @@ namespace internals void resolve_matrix_row (const GlobalRowsFromLocal &global_rows, const GlobalRowsFromLocal &global_cols, - const unsigned int i, - const unsigned int column_start, - const unsigned int column_end, - const FullMatrix<double> &local_matrix, - unsigned int *&col_ptr, - number *&val_ptr) + const size_type i, + const size_type column_start, + const size_type column_end, + const FullMatrix<double> &local_matrix, + size_type *&col_ptr, + number *&val_ptr) { if (column_end == column_start) return; AssertIndexRange (column_end-1, global_cols.size()); - const unsigned int loc_row = global_rows.local_row(i); + const size_type loc_row = global_rows.local_row(i); // fast function if there are no indirect // references to any of the local rows at @@ -1766,9 +1886,9 @@ namespace internals AssertIndexRange(loc_row, local_matrix.m()); const double *matrix_ptr = &local_matrix(loc_row, 0); - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { - const unsigned int loc_col = global_cols.local_row(j); + const size_type loc_col = global_cols.local_row(j); AssertIndexRange(loc_col, local_matrix.n()); const double col_val = matrix_ptr[loc_col]; if (col_val != 0.) @@ -1784,7 +1904,7 @@ namespace internals // to do some more checks. else { - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { double col_val = resolve_matrix_entry (global_rows, global_cols, i, j, loc_row, local_matrix); @@ -1809,8 +1929,8 @@ namespace internals template <typename SparseMatrixIterator> static inline void add_value (const double value, - const unsigned int row, - const unsigned int column, + const size_type row, + const size_type column, SparseMatrixIterator &matrix_values) { if (value != 0.) @@ -1834,11 +1954,11 @@ namespace internals inline void resolve_matrix_row (const GlobalRowsFromLocal &global_rows, - const unsigned int i, - const unsigned int column_start, - const unsigned int column_end, - const FullMatrix<double> &local_matrix, - SparseMatrix<number> *sparse_matrix) + const size_type i, + const size_type column_start, + const size_type column_end, + const FullMatrix<double> &local_matrix, + SparseMatrix<number> *sparse_matrix) { if (column_end == column_start) return; @@ -1849,11 +1969,11 @@ namespace internals if (sparsity.n_nonzero_elements() == 0) return; - const unsigned int row = global_rows.global_row(i); - const unsigned int loc_row = global_rows.local_row(i); + const size_type row = global_rows.global_row(i); + const size_type loc_row = global_rows.local_row(i); typename SparseMatrix<number>::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 @@ -1869,9 +1989,9 @@ namespace internals AssertIndexRange (loc_row, local_matrix.m()); const double *matrix_ptr = &local_matrix(loc_row, 0); - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { - const unsigned int loc_col = global_rows.local_row(j); + const size_type loc_col = global_rows.local_row(j); const double col_val = matrix_ptr[loc_col]; dealiiSparseMatrix::add_value (col_val, row, global_rows.global_row(j), @@ -1880,7 +2000,7 @@ namespace internals } else { - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { double col_val = resolve_matrix_entry (global_rows, global_rows, i, j, loc_row, local_matrix); @@ -1899,17 +2019,17 @@ namespace internals const double *matrix_ptr = &local_matrix(loc_row, 0); sparse_matrix->begin(row)->value() += matrix_ptr[loc_row]; - for (unsigned int j=column_start; j<i; ++j) + for (size_type j=column_start; j<i; ++j) { - const unsigned int loc_col = global_rows.local_row(j); + const size_type loc_col = global_rows.local_row(j); const double col_val = matrix_ptr[loc_col]; dealiiSparseMatrix::add_value(col_val, row, global_rows.global_row(j), matrix_values); } - for (unsigned int j=i+1; j<column_end; ++j) + for (size_type j=i+1; j<column_end; ++j) { - const unsigned int loc_col = global_rows.local_row(j); + const size_type loc_col = global_rows.local_row(j); const double col_val = matrix_ptr[loc_col]; dealiiSparseMatrix::add_value(col_val, row, global_rows.global_row(j), @@ -1921,7 +2041,7 @@ namespace internals sparse_matrix->begin(row)->value() += resolve_matrix_entry (global_rows, global_rows, i, i, loc_row, local_matrix); - for (unsigned int j=column_start; j<i; ++j) + for (size_type j=column_start; j<i; ++j) { double col_val = resolve_matrix_entry (global_rows, global_rows, i, j, loc_row, local_matrix); @@ -1929,7 +2049,7 @@ namespace internals global_rows.global_row(j), matrix_values); } - for (unsigned int j=i+1; j<column_end; ++j) + for (size_type j=i+1; j<column_end; ++j) { double col_val = resolve_matrix_entry (global_rows, global_rows, i, j, loc_row, local_matrix); @@ -1947,9 +2067,9 @@ namespace internals AssertIndexRange (loc_row, local_matrix.m()); const double *matrix_ptr = &local_matrix(loc_row, 0); - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { - const unsigned int loc_col = global_rows.local_row(j); + const size_type loc_col = global_rows.local_row(j); const double col_val = matrix_ptr[loc_col]; if (row==global_rows.global_row(j)) sparse_matrix->begin(row)->value() += col_val; @@ -1962,7 +2082,7 @@ namespace internals else { ++matrix_values; // jump over diagonal element - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { double col_val = resolve_matrix_entry (global_rows, global_rows, i, j, loc_row, local_matrix); @@ -1985,16 +2105,16 @@ namespace internals inline void resolve_matrix_row (const GlobalRowsFromLocal &global_rows, - const unsigned int i, - const unsigned int column_start, - const unsigned int column_end, + const size_type i, + const size_type column_start, + const size_type column_end, const Table<2,bool> &dof_mask, - std::vector<unsigned int>::iterator &col_ptr) + std::vector<size_type>::iterator &col_ptr) { if (column_end == column_start) return; - const unsigned int loc_row = global_rows.local_row(i); + const size_type loc_row = global_rows.local_row(i); // fast function if there are no indirect // references to any of the local rows at @@ -2004,9 +2124,9 @@ namespace internals Assert(loc_row < dof_mask.n_rows(), ExcInternalError()); - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { - const unsigned int loc_col = global_rows.local_row(j); + const size_type loc_col = global_rows.local_row(j); Assert(loc_col < dof_mask.n_cols(), ExcInternalError()); if (dof_mask(loc_row,loc_col) == true) @@ -2019,34 +2139,34 @@ namespace internals // to do some more checks. else { - for (unsigned int j=column_start; j<column_end; ++j) + for (size_type j=column_start; j<column_end; ++j) { - const unsigned int loc_col = global_rows.local_row(j); - if (loc_row != numbers::invalid_unsigned_int) + const size_type loc_col = global_rows.local_row(j); + if (loc_row != numbers::invalid_size_type) { Assert (loc_row < dof_mask.n_rows(), ExcInternalError()); - if (loc_col != numbers::invalid_unsigned_int) + if (loc_col != numbers::invalid_size_type) { Assert (loc_col < dof_mask.n_cols(), ExcInternalError()); if (dof_mask(loc_row,loc_col) == true) goto add_this_index; } - for (unsigned int p=0; p<global_rows.size(j); ++p) + for (size_type p=0; p<global_rows.size(j); ++p) if (dof_mask(loc_row,global_rows.local_row(j,p)) == true) goto add_this_index; } - for (unsigned int q=0; q<global_rows.size(i); ++q) + for (size_type q=0; q<global_rows.size(i); ++q) { - if (loc_col != numbers::invalid_unsigned_int) + if (loc_col != numbers::invalid_size_type) { Assert (loc_col < dof_mask.n_cols(), ExcInternalError()); if (dof_mask(global_rows.local_row(i,q),loc_col) == true) goto add_this_index; } - for (unsigned int p=0; p<global_rows.size(j); ++p) + for (size_type p=0; p<global_rows.size(j); ++p) if (dof_mask(global_rows.local_row(i,q), global_rows.local_row(j,p)) == true) goto add_this_index; @@ -2093,7 +2213,7 @@ add_this_index: template <typename MatrixType, typename VectorType> inline void set_matrix_diagonals (const internals::GlobalRowsFromLocal &global_rows, - const std::vector<unsigned int> &local_dof_indices, + const std::vector<size_type> &local_dof_indices, const FullMatrix<double> &local_matrix, const ConstraintMatrix &constraints, MatrixType &global_matrix, @@ -2103,14 +2223,14 @@ add_this_index: if (global_rows.n_constraints() > 0) { double average_diagonal = 0; - for (unsigned int i=0; i<local_matrix.m(); ++i) + for (size_type i=0; i<local_matrix.m(); ++i) average_diagonal += std::fabs (local_matrix(i,i)); average_diagonal /= static_cast<double>(local_matrix.m()); - for (unsigned int i=0; i<global_rows.n_constraints(); i++) + for (size_type i=0; i<global_rows.n_constraints(); i++) { - const unsigned int local_row = global_rows.constraint_origin(i); - const unsigned int global_row = local_dof_indices[local_row]; + const size_type local_row = global_rows.constraint_origin(i); + const size_type global_row = local_dof_indices[local_row]; const typename MatrixType::value_type new_diagonal = (std::fabs(local_matrix(local_row,local_row)) != 0 ? std::fabs(local_matrix(local_row,local_row)) : average_diagonal); @@ -2141,7 +2261,7 @@ add_this_index: template <typename SparsityType> inline void set_sparsity_diagonals (const internals::GlobalRowsFromLocal &global_rows, - const std::vector<unsigned int> &local_dof_indices, + const std::vector<size_type> &local_dof_indices, const Table<2,bool> &dof_mask, const bool keep_constrained_entries, SparsityType &sparsity_pattern) @@ -2153,13 +2273,13 @@ add_this_index: // that have been left out above if (global_rows.n_constraints() > 0) { - for (unsigned int i=0; i<global_rows.n_constraints(); i++) + for (size_type i=0; i<global_rows.n_constraints(); i++) { - const unsigned int local_row = global_rows.constraint_origin(i); - const unsigned int global_row = local_dof_indices[local_row]; + const size_type local_row = global_rows.constraint_origin(i); + const size_type global_row = local_dof_indices[local_row]; if (keep_constrained_entries == true) { - for (unsigned int j=0; j<local_dof_indices.size(); ++j) + for (size_type j=0; j<local_dof_indices.size(); ++j) { if (dof_mask(local_row,j) == true) sparsity_pattern.add(global_row, @@ -2189,10 +2309,10 @@ add_this_index: // are related to it. void ConstraintMatrix:: -make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, +make_sorted_row_list (const std::vector<size_type> &local_dof_indices, internals::GlobalRowsFromLocal &global_rows) const { - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); AssertDimension (n_local_dofs, global_rows.size()); // when distributing the local data to @@ -2225,13 +2345,13 @@ make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, // cache whether we have to resolve any // indirect rows generated from resolving // constrained dofs. - unsigned int added_rows = 0; + size_type added_rows = 0; // first add the indices in an unsorted // way and only keep track of the // constraints that appear. They are // resolved in a second step. - for (unsigned int i = 0; i<n_local_dofs; ++i) + for (size_type i = 0; i<n_local_dofs; ++i) { if (is_constrained(local_dof_indices[i]) == false) { @@ -2243,18 +2363,18 @@ make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, } global_rows.sort(); - const unsigned int n_constrained_rows = n_local_dofs-added_rows; - for (unsigned int i=0; i<n_constrained_rows; ++i) + const size_type n_constrained_rows = n_local_dofs-added_rows; + for (size_type i=0; i<n_constrained_rows; ++i) { - const unsigned int local_row = global_rows.constraint_origin(i); + const size_type local_row = global_rows.constraint_origin(i); AssertIndexRange(local_row, n_local_dofs); - const unsigned int global_row = local_dof_indices[local_row]; + const size_type global_row = local_dof_indices[local_row]; Assert (is_constrained(global_row), ExcInternalError()); const ConstraintLine &position = lines[lines_cache[calculate_line_index(global_row)]]; if (position.inhomogeneity != 0) global_rows.set_ith_constraint_inhomogeneous (i); - for (unsigned int q=0; q<position.entries.size(); ++q) + for (size_type q=0; q<position.entries.size(); ++q) global_rows.insert_index (position.entries[q].first, local_row, position.entries[q].second); @@ -2271,12 +2391,12 @@ make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, inline void ConstraintMatrix:: -make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, - std::vector<unsigned int> &active_dofs) const +make_sorted_row_list (const std::vector<size_type> &local_dof_indices, + std::vector<size_type> &active_dofs) const { - const unsigned int n_local_dofs = local_dof_indices.size(); - unsigned int added_rows = 0; - for (unsigned int i = 0; i<n_local_dofs; ++i) + const size_type n_local_dofs = local_dof_indices.size(); + size_type added_rows = 0; + for (size_type i = 0; i<n_local_dofs; ++i) { if (is_constrained(local_dof_indices[i]) == false) { @@ -2288,20 +2408,20 @@ make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, } std::sort (active_dofs.begin(), active_dofs.begin()+added_rows); - const unsigned int n_constrained_dofs = n_local_dofs-added_rows; - for (unsigned int i=n_constrained_dofs; i>0; --i) + const size_type n_constrained_dofs = n_local_dofs-added_rows; + for (size_type i=n_constrained_dofs; i>0; --i) { - const unsigned int local_row = active_dofs.back(); + const size_type local_row = active_dofs.back(); // remove constrained entry since we // are going to resolve it in place active_dofs.pop_back(); - const unsigned int global_row = local_dof_indices[local_row]; + const size_type global_row = local_dof_indices[local_row]; const ConstraintLine &position = lines[lines_cache[calculate_line_index(global_row)]]; - for (unsigned int q=0; q<position.entries.size(); ++q) + for (size_type q=0; q<position.entries.size(); ++q) { - const unsigned int new_index = position.entries[q].first; + const size_type new_index = position.entries[q].first; if (active_dofs[active_dofs.size()-i] < new_index) active_dofs.insert(active_dofs.end()-i+1,new_index); @@ -2310,7 +2430,7 @@ make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, // the list sorted else { - std::vector<unsigned int>::iterator it = + std::vector<size_type>::iterator it = Utilities::lower_bound(active_dofs.begin(), active_dofs.end()-i+1, new_index); @@ -2328,23 +2448,23 @@ make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices, inline double ConstraintMatrix:: -resolve_vector_entry (const unsigned int i, +resolve_vector_entry (const size_type i, const internals::GlobalRowsFromLocal &global_rows, const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, + const std::vector<size_type> &local_dof_indices, const FullMatrix<double> &local_matrix) const { - const unsigned int loc_row = global_rows.local_row(i); - const unsigned int n_inhomogeneous_rows = global_rows.n_inhomogeneities(); + const size_type loc_row = global_rows.local_row(i); + const size_type n_inhomogeneous_rows = global_rows.n_inhomogeneities(); double val = 0; // has a direct contribution from some local // entry. If we have inhomogeneous // constraints, compute the contribution of // the inhomogeneity in the current row. - if (loc_row != numbers::invalid_unsigned_int) + if (loc_row != numbers::invalid_size_type) { val = local_vector(loc_row); - for (unsigned int i=0; i<n_inhomogeneous_rows; ++i) + for (size_type i=0; i<n_inhomogeneous_rows; ++i) val -= (lines[lines_cache[calculate_line_index(local_dof_indices [global_rows.constraint_origin(i)])]]. inhomogeneity * @@ -2352,11 +2472,11 @@ resolve_vector_entry (const unsigned int i, } // go through the indirect contributions - for (unsigned int q=0; q<global_rows.size(i); ++q) + for (size_type q=0; q<global_rows.size(i); ++q) { - const unsigned int loc_row_q = global_rows.local_row(i,q); + const size_type loc_row_q = global_rows.local_row(i,q); double add_this = local_vector (loc_row_q); - for (unsigned int k=0; k<n_inhomogeneous_rows; ++k) + for (size_type k=0; k<n_inhomogeneous_rows; ++k) add_this -= (lines[lines_cache[calculate_line_index (local_dof_indices [global_rows.constraint_origin(k)])]]. @@ -2376,7 +2496,7 @@ void ConstraintMatrix::distribute_local_to_global ( const FullMatrix<double> &local_matrix, const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, + const std::vector<size_type> &local_dof_indices, MatrixType &global_matrix, VectorType &global_vector, bool use_inhomogeneities_for_rhs, @@ -2401,18 +2521,18 @@ ConstraintMatrix::distribute_local_to_global ( } Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); // create arrays for the column data // (indices and values) that will then be // written into the matrix. Shortcut for // deal.II sparse matrix - std::vector<unsigned int> cols; - std::vector<number> vals; + std::vector<size_type> cols; + std::vector<number> vals; SparseMatrix<number> *sparse_matrix = dynamic_cast<SparseMatrix<number> *>(&global_matrix); if (use_dealii_matrix == false) @@ -2427,21 +2547,21 @@ ConstraintMatrix::distribute_local_to_global ( // the global rows that we will touch and // call resolve_matrix_row for each of // those. - for (unsigned int i=0; i<n_actual_dofs; ++i) + for (size_type i=0; i<n_actual_dofs; ++i) { - const unsigned int row = global_rows.global_row(i); + const size_type row = global_rows.global_row(i); // calculate all the data that will be // written into the matrix row. if (use_dealii_matrix == false) { - unsigned int *col_ptr = &cols[0]; + size_type *col_ptr = &cols[0]; number *val_ptr = &vals[0]; internals::resolve_matrix_row (global_rows, global_rows, i, 0, n_actual_dofs, local_matrix, col_ptr, val_ptr); - const unsigned int n_values = col_ptr - &cols[0]; - Assert (n_values == (unsigned int)(val_ptr - &vals[0]), + const size_type n_values = col_ptr - &cols[0]; + Assert (n_values == (size_type)(val_ptr - &vals[0]), ExcInternalError()); if (n_values > 0) global_matrix.add(row, n_values, &cols[0], &vals[0], false, true); @@ -2480,10 +2600,10 @@ ConstraintMatrix::distribute_local_to_global ( template <typename MatrixType> void ConstraintMatrix::distribute_local_to_global ( - const FullMatrix<double> &local_matrix, - const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - MatrixType &global_matrix) const + const FullMatrix<double> &local_matrix, + const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + MatrixType &global_matrix) const { typedef double number; @@ -2491,37 +2611,37 @@ ConstraintMatrix::distribute_local_to_global ( AssertDimension (local_matrix.n(), col_indices.size()); //Assert (sorted == true, ExcMatrixNotClosed()); - const unsigned int n_local_row_dofs = row_indices.size(); - const unsigned int n_local_col_dofs = col_indices.size(); + const size_type n_local_row_dofs = row_indices.size(); + const size_type n_local_col_dofs = col_indices.size(); internals::GlobalRowsFromLocal global_rows (n_local_row_dofs); internals::GlobalRowsFromLocal global_cols (n_local_col_dofs); make_sorted_row_list (row_indices, global_rows); make_sorted_row_list (col_indices, global_cols); - const unsigned int n_actual_row_dofs = global_rows.size(); - const unsigned int n_actual_col_dofs = global_cols.size(); + const size_type n_actual_row_dofs = global_rows.size(); + const size_type n_actual_col_dofs = global_cols.size(); // create arrays for the column data // (indices and values) that will then be // written into the matrix. Shortcut for // deal.II sparse matrix - std::vector<unsigned int> cols (n_actual_col_dofs); + std::vector<size_type> cols (n_actual_col_dofs); std::vector<number> vals (n_actual_col_dofs); // now do the actual job. - for (unsigned int i=0; i<n_actual_row_dofs; ++i) + for (size_type i=0; i<n_actual_row_dofs; ++i) { - const unsigned int row = global_rows.global_row(i); + const size_type row = global_rows.global_row(i); // calculate all the data that will be // written into the matrix row. - unsigned int *col_ptr = &cols[0]; + size_type *col_ptr = &cols[0]; number *val_ptr = &vals[0]; internals::resolve_matrix_row (global_rows, global_cols, i, 0, n_actual_col_dofs, local_matrix, col_ptr, val_ptr); - const unsigned int n_values = col_ptr - &cols[0]; - Assert (n_values == (unsigned int)(val_ptr - &vals[0]), + const size_type n_values = col_ptr - &cols[0]; + Assert (n_values == (size_type)(val_ptr - &vals[0]), ExcInternalError()); if (n_values > 0) global_matrix.add(row, n_values, &cols[0], &vals[0], false, true); @@ -2536,12 +2656,12 @@ ConstraintMatrix::distribute_local_to_global ( template <typename MatrixType, typename VectorType> void ConstraintMatrix:: -distribute_local_to_global (const FullMatrix<double> &local_matrix, - const Vector<double> &local_vector, - const std::vector<unsigned int> &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs, +distribute_local_to_global (const FullMatrix<double> &local_matrix, + const Vector<double> &local_vector, + const std::vector<size_type> &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs, internal::bool2type<true>) const { const bool use_vectors = (local_vector.size() == 0 && @@ -2562,26 +2682,26 @@ distribute_local_to_global (const FullMatrix<double> &local_matrix, } Assert (sorted == true, ExcMatrixNotClosed()); - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); - std::vector<unsigned int> global_indices; + std::vector<size_type> global_indices; if (use_vectors == true) { global_indices.resize(n_actual_dofs); - for (unsigned int i=0; i<n_actual_dofs; ++i) + for (size_type i=0; i<n_actual_dofs; ++i) global_indices[i] = global_rows.global_row(i); } // additional construct that also takes // care of block indices. - const unsigned int num_blocks = global_matrix.n_block_rows(); - std::vector<unsigned int> block_starts(num_blocks+1, n_actual_dofs); + const size_type num_blocks = global_matrix.n_block_rows(); + std::vector<size_type> block_starts(num_blocks+1, n_actual_dofs); internals::make_block_starts (global_matrix, global_rows, block_starts); - std::vector<unsigned int> cols; + std::vector<size_type> cols; std::vector<number> vals; if (use_dealii_matrix == false) { @@ -2594,26 +2714,26 @@ distribute_local_to_global (const FullMatrix<double> &local_matrix, // through the blocks of the matrix // separately, which allows us to set the // block entries individually - for (unsigned int block=0; block<num_blocks; ++block) + for (size_type block=0; block<num_blocks; ++block) { - const unsigned int next_block = block_starts[block+1]; - for (unsigned int i=block_starts[block]; i<next_block; ++i) + const size_type next_block = block_starts[block+1]; + for (size_type i=block_starts[block]; i<next_block; ++i) { - const unsigned int row = global_rows.global_row(i); + const size_type row = global_rows.global_row(i); - for (unsigned int block_col=0; block_col<num_blocks; ++block_col) + for (size_type block_col=0; block_col<num_blocks; ++block_col) { - const unsigned int start_block = block_starts[block_col], - end_block = block_starts[block_col+1]; + const size_type start_block = block_starts[block_col], + end_block = block_starts[block_col+1]; if (use_dealii_matrix == false) { - unsigned int *col_ptr = &cols[0]; + size_type *col_ptr = &cols[0]; number *val_ptr = &vals[0]; internals::resolve_matrix_row (global_rows, global_rows, i, start_block, end_block, local_matrix, col_ptr, val_ptr); - const unsigned int n_values = col_ptr - &cols[0]; - Assert (n_values == (unsigned int)(val_ptr - &vals[0]), + const size_type n_values = col_ptr - &cols[0]; + Assert (n_values == (size_type )(val_ptr - &vals[0]), ExcInternalError()); if (n_values > 0) global_matrix.block(block, block_col).add(row, n_values, @@ -2655,15 +2775,15 @@ distribute_local_to_global (const FullMatrix<double> &local_matrix, template <typename SparsityType> void ConstraintMatrix:: -add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, +add_entries_local_to_global (const std::vector<size_type> &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type<false> ) const { Assert (sparsity_pattern.n_rows() == sparsity_pattern.n_cols(), ExcNotQuadratic()); - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); bool dof_mask_is_active = false; if (dof_mask.n_rows() == n_local_dofs) { @@ -2680,15 +2800,15 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, // indices that come from constraints. if (dof_mask_is_active == false) { - std::vector<unsigned int> actual_dof_indices (n_local_dofs); + std::vector<size_type> actual_dof_indices (n_local_dofs); make_sorted_row_list (local_dof_indices, actual_dof_indices); - const unsigned int n_actual_dofs = actual_dof_indices.size(); + const size_type n_actual_dofs = actual_dof_indices.size(); // now add the indices we collected above // to the sparsity pattern. Very easy // here - just add the same array to all // the rows... - for (unsigned int i=0; i<n_actual_dofs; ++i) + for (size_type i=0; i<n_actual_dofs; ++i) sparsity_pattern.add_entries(actual_dof_indices[i], actual_dof_indices.begin(), actual_dof_indices.end(), @@ -2700,11 +2820,11 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, // the nice matrix structure we use // elsewhere, so manually add those // indices one by one. - for (unsigned int i=0; i<n_local_dofs; i++) + for (size_type i=0; i<n_local_dofs; i++) if (is_constrained(local_dof_indices[i])) { if (keep_constrained_entries == true) - for (unsigned int j=0; j<n_local_dofs; j++) + for (size_type j=0; j<n_local_dofs; j++) { sparsity_pattern.add (local_dof_indices[i], local_dof_indices[j]); sparsity_pattern.add (local_dof_indices[j], local_dof_indices[i]); @@ -2724,17 +2844,17 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, // for additional comments. internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); // create arrays for the column indices // that will then be written into the // sparsity pattern. - std::vector<unsigned int> cols (n_actual_dofs); + std::vector<size_type> cols (n_actual_dofs); - for (unsigned int i=0; i<n_actual_dofs; ++i) + for (size_type i=0; i<n_actual_dofs; ++i) { - std::vector<unsigned int>::iterator col_ptr = cols.begin(); - const unsigned int row = global_rows.global_row(i); + std::vector<size_type>::iterator col_ptr = cols.begin(); + const size_type row = global_rows.global_row(i); internals::resolve_matrix_row (global_rows, i, 0, n_actual_dofs, dof_mask, col_ptr); @@ -2757,14 +2877,14 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, template <typename SparsityType> void ConstraintMatrix:: -add_entries_local_to_global (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, +add_entries_local_to_global (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, SparsityType &sparsity_pattern, const bool keep_constrained_entries, const Table<2,bool> &dof_mask) const { - const unsigned int n_local_rows = row_indices.size(); - const unsigned int n_local_cols = col_indices.size(); + const size_type n_local_rows = row_indices.size(); + const size_type n_local_cols = col_indices.size(); bool dof_mask_is_active = false; if (dof_mask.n_rows() == n_local_rows && dof_mask.n_cols() == n_local_cols) dof_mask_is_active = true; @@ -2778,17 +2898,17 @@ add_entries_local_to_global (const std::vector<unsigned int> &row_indices, // indices that come from constraints. if (dof_mask_is_active == false) { - std::vector<unsigned int> actual_row_indices (n_local_rows); - std::vector<unsigned int> actual_col_indices (n_local_cols); + std::vector<size_type> actual_row_indices (n_local_rows); + std::vector<size_type> actual_col_indices (n_local_cols); make_sorted_row_list (row_indices, actual_row_indices); make_sorted_row_list (col_indices, actual_col_indices); - const unsigned int n_actual_rows = actual_row_indices.size(); + const size_type n_actual_rows = actual_row_indices.size(); // now add the indices we collected above // to the sparsity pattern. Very easy // here - just add the same array to all // the rows... - for (unsigned int i=0; i<n_actual_rows; ++i) + for (size_type i=0; i<n_actual_rows; ++i) sparsity_pattern.add_entries(actual_row_indices[i], actual_col_indices.begin(), actual_col_indices.end(), @@ -2801,13 +2921,13 @@ add_entries_local_to_global (const std::vector<unsigned int> &row_indices, // of those to the sparsity pattern if (keep_constrained_entries == true) { - for (unsigned int i=0; i<row_indices.size(); i++) + for (size_type i=0; i<row_indices.size(); i++) if (is_constrained(row_indices[i])) - for (unsigned int j=0; j<col_indices.size(); j++) + for (size_type j=0; j<col_indices.size(); j++) sparsity_pattern.add (row_indices[i], col_indices[j]); - for (unsigned int i=0; i<col_indices.size(); i++) + for (size_type i=0; i<col_indices.size(); i++) if (is_constrained(col_indices[i])) - for (unsigned int j=0; j<row_indices.size(); j++) + for (size_type j=0; j<row_indices.size(); j++) sparsity_pattern.add (row_indices[j], col_indices[i]); } @@ -2822,10 +2942,10 @@ add_entries_local_to_global (const std::vector<unsigned int> &row_indices, template <typename SparsityType> void ConstraintMatrix:: -add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, +add_entries_local_to_global (const std::vector<size_type> &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type<true> ) const { // just as the other @@ -2836,8 +2956,8 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, Assert (sparsity_pattern.n_block_rows() == sparsity_pattern.n_block_cols(), ExcNotQuadratic()); - const unsigned int n_local_dofs = local_dof_indices.size(); - const unsigned int num_blocks = sparsity_pattern.n_block_rows(); + const size_type n_local_dofs = local_dof_indices.size(); + const size_type num_blocks = sparsity_pattern.n_block_rows(); bool dof_mask_is_active = false; if (dof_mask.n_rows() == n_local_dofs) @@ -2848,29 +2968,29 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, if (dof_mask_is_active == false) { - std::vector<unsigned int> actual_dof_indices (n_local_dofs); + std::vector<size_type> actual_dof_indices (n_local_dofs); make_sorted_row_list (local_dof_indices, actual_dof_indices); - const unsigned int n_actual_dofs = actual_dof_indices.size(); + const size_type n_actual_dofs = actual_dof_indices.size(); // additional construct that also takes // care of block indices. - std::vector<unsigned int> block_starts(num_blocks+1, n_actual_dofs); + std::vector<size_type> block_starts(num_blocks+1, n_actual_dofs); internals::make_block_starts (sparsity_pattern, actual_dof_indices, block_starts); - for (unsigned int block=0; block<num_blocks; ++block) + for (size_type block=0; block<num_blocks; ++block) { - const unsigned int next_block = block_starts[block+1]; - for (unsigned int i=block_starts[block]; i<next_block; ++i) + const size_type next_block = block_starts[block+1]; + for (size_type i=block_starts[block]; i<next_block; ++i) { Assert (i<n_actual_dofs, ExcInternalError()); - const unsigned int row = actual_dof_indices[i]; + const size_type row = actual_dof_indices[i]; Assert (row < sparsity_pattern.block(block,0).n_rows(), ExcInternalError()); - std::vector<unsigned int>::iterator index_it = actual_dof_indices.begin(); - for (unsigned int block_col = 0; block_col<num_blocks; ++block_col) + std::vector<size_type>::iterator index_it = actual_dof_indices.begin(); + for (size_type block_col = 0; block_col<num_blocks; ++block_col) { - const unsigned int next_block_col = block_starts[block_col+1]; + const size_type next_block_col = block_starts[block_col+1]; sparsity_pattern.block(block,block_col). add_entries(row, index_it, @@ -2881,11 +3001,11 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, } } - for (unsigned int i=0; i<n_local_dofs; i++) + for (size_type i=0; i<n_local_dofs; i++) if (is_constrained(local_dof_indices[i])) { if (keep_constrained_entries == true) - for (unsigned int j=0; j<n_local_dofs; j++) + for (size_type j=0; j<n_local_dofs; j++) { sparsity_pattern.add (local_dof_indices[i], local_dof_indices[j]); sparsity_pattern.add (local_dof_indices[j], local_dof_indices[i]); @@ -2902,31 +3022,31 @@ add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices, // function for block matrices internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); // additional construct that also takes // care of block indices. - std::vector<unsigned int> block_starts(num_blocks+1, n_actual_dofs); + std::vector<size_type> block_starts(num_blocks+1, n_actual_dofs); internals::make_block_starts(sparsity_pattern, global_rows, block_starts); - std::vector<unsigned int> cols (n_actual_dofs); + std::vector<size_type> cols (n_actual_dofs); // the basic difference to the // non-block variant from now onwards // is that we go through the blocks // of the matrix separately. - for (unsigned int block=0; block<num_blocks; ++block) + for (size_type block=0; block<num_blocks; ++block) { - const unsigned int next_block = block_starts[block+1]; - for (unsigned int i=block_starts[block]; i<next_block; ++i) + const size_type next_block = block_starts[block+1]; + for (size_type i=block_starts[block]; i<next_block; ++i) { - const unsigned int row = global_rows.global_row(i); - for (unsigned int block_col=0; block_col<num_blocks; ++block_col) + const size_type row = global_rows.global_row(i); + for (size_type block_col=0; block_col<num_blocks; ++block_col) { - const unsigned int begin_block = block_starts[block_col], - end_block = block_starts[block_col+1]; - std::vector<unsigned int>::iterator col_ptr = cols.begin(); + const size_type begin_block = block_starts[block_col], + end_block = block_starts[block_col+1]; + std::vector<size_type>::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 f0c0ef8f0e..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 @@ -50,6 +55,11 @@ template <class VECTOR = Vector<double> > class EigenPower : private Solver<VECTOR> { public: + /** + * Declare type of container size. + */ + typedef types::global_dof_index size_type; + /** * Standardized data struct to * pipe additional data to the @@ -139,6 +149,11 @@ template <class VECTOR = Vector<double> > class EigenInverse : private Solver<VECTOR> { public: + /** + * Declare type of container size. + */ + typedef types::global_dof_index size_type; + /** * Standardized data struct to * pipe additional data to the @@ -270,7 +285,7 @@ EigenPower<VECTOR>::solve (double &value, // do a little trick to compute the sign // with not too much effect of round-off errors. double entry = 0.; - unsigned int i = 0; + size_type i = 0; double thresh = length/x.size(); do { @@ -365,7 +380,7 @@ EigenInverse<VECTOR>::solve (double &value, x.scale(1./length); // Main loop - for (unsigned int iter=0; conv==SolverControl::iterate; iter++) + for (size_type iter=0; conv==SolverControl::iterate; iter++) { solver.solve (A_s, y, x, prec); @@ -375,7 +390,7 @@ EigenInverse<VECTOR>::solve (double &value, // do a little trick to compute the sign // with not too much effect of round-off errors. double entry = 0.; - unsigned int i = 0; + size_type i = 0; double thresh = length/x.size(); do { 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 939b77e72e..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 @@ -206,6 +211,11 @@ class FilteredMatrix : public Subscriptor public: class const_iterator; + /** + * Declare the type of container size. + */ + typedef types::global_dof_index size_type; + /** * Accessor class for iterators */ @@ -218,7 +228,7 @@ public: * pointer is sufficient. */ Accessor (const FilteredMatrix<VECTOR> *matrix, - const unsigned int index); + const size_type index); public: /** @@ -226,14 +236,14 @@ public: * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of the right hand @@ -255,7 +265,7 @@ public: /** * Current row number. */ - unsigned int index; + size_type index; /* * Make enclosing class a * friend. @@ -273,7 +283,7 @@ public: * Constructor. */ const_iterator(const FilteredMatrix<VECTOR> *matrix, - const unsigned int index); + const size_type index); /** * Prefix increment. @@ -337,7 +347,7 @@ public: * freedom index and the value it * shall have. */ - typedef std::pair<unsigned int, double> IndexValuePair; + typedef std::pair<size_type, double> IndexValuePair; /** * @name Constructors and initialization @@ -416,7 +426,7 @@ public: * should have the value * <tt>v</tt>. */ - void add_constraint (const unsigned int i, const double v); + void add_constraint (const size_type i, const double v); /** * Add a list of constraints to @@ -655,7 +665,7 @@ template<class VECTOR> inline FilteredMatrix<VECTOR>::Accessor::Accessor( const FilteredMatrix<VECTOR> *matrix, - const unsigned int index) + const size_type index) : matrix(matrix), index(index) @@ -668,7 +678,7 @@ FilteredMatrix<VECTOR>::Accessor::Accessor( template<class VECTOR> inline -unsigned int +types::global_dof_index FilteredMatrix<VECTOR>::Accessor::row() const { return matrix->constraints[index].first; @@ -678,7 +688,7 @@ FilteredMatrix<VECTOR>::Accessor::row() const template<class VECTOR> inline -unsigned int +types::global_dof_index FilteredMatrix<VECTOR>::Accessor::column() const { return matrix->constraints[index].first; @@ -712,7 +722,7 @@ template<class VECTOR> inline FilteredMatrix<VECTOR>::const_iterator::const_iterator( const FilteredMatrix<VECTOR> *matrix, - const unsigned int index) + const size_type index) : accessor(matrix, index) {} @@ -860,7 +870,7 @@ FilteredMatrix<VECTOR>::operator = (const FilteredMatrix &fm) template <class VECTOR> inline void -FilteredMatrix<VECTOR>::add_constraint (const unsigned int index, const double value) +FilteredMatrix<VECTOR>::add_constraint (const size_type index, const double value) { // add new constraint to end constraints.push_back(IndexValuePair(index, value)); @@ -875,7 +885,7 @@ void FilteredMatrix<VECTOR>::add_constraints (const ConstraintList &new_constraints) { // add new constraints to end - const unsigned int old_size = constraints.size(); + const size_type old_size = constraints.size(); constraints.reserve (old_size + new_constraints.size()); constraints.insert (constraints.end(), new_constraints.begin(), diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index 7a01b5127a..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 @@ -60,6 +65,14 @@ template<typename number> class FullMatrix : public Table<2,number> { public: + /** + * Declare type of container size. + */ + // A FullMatrix will never require to use unsigned long long int instead of + // unsigned but because a ConstraintMatrix can be a SparseMatrix or a + // FullMatrix, we need have the same interface. + typedef types::global_dof_index size_type; + /** * Type of matrix entries. In analogy to * the STL container classes. @@ -104,22 +117,22 @@ public: * pointer is sufficient. */ Accessor (const FullMatrix<number> *matrix, - const unsigned int row, - const unsigned int col); + const size_type row, + const size_type col); /** * Row number of the element * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of this matrix entry. @@ -135,7 +148,7 @@ public: /** * Current row number. */ - unsigned int a_row; + size_type a_row; /** * Current column number. @@ -159,8 +172,8 @@ public: * Constructor. */ const_iterator(const FullMatrix<number> *matrix, - const unsigned int row, - const unsigned int col); + const size_type row, + const size_type col); /** * Prefix increment. @@ -237,15 +250,15 @@ public: * By default, no memory is * allocated. */ - explicit FullMatrix (const unsigned int n = 0); + explicit FullMatrix (const size_type n = 0); /** * Constructor. Initialize the * matrix as a rectangular * matrix. */ - FullMatrix (const unsigned int rows, - const unsigned int cols); + FullMatrix (const size_type rows, + const size_type cols); /** * Copy constructor. This @@ -274,8 +287,8 @@ public: * is arranged line by line. No * range checking is performed. */ - FullMatrix (const unsigned int rows, - const unsigned int cols, + FullMatrix (const size_type rows, + const size_type cols, const number *entries); /** @@ -391,12 +404,12 @@ public: template <int dim> void copy_from (const Tensor<2,dim> &T, - const unsigned int src_r_i=0, - const unsigned int src_r_j=dim-1, - const unsigned int src_c_i=0, - const unsigned int src_c_j=dim-1, - const unsigned int dst_r=0, - const unsigned int dst_c=0); + const size_type src_r_i=0, + const size_type src_r_j=dim-1, + const size_type src_c_i=0, + const size_type src_c_j=dim-1, + const size_type dst_r=0, + const size_type dst_c=0); /** * Insert a submatrix (also @@ -414,12 +427,12 @@ public: template <int dim> void copy_to(Tensor<2,dim> &T, - const unsigned int src_r_i=0, - const unsigned int src_r_j=dim-1, - const unsigned int src_c_i=0, - const unsigned int src_c_j=dim-1, - const unsigned int dst_r=0, - const unsigned int dst_c=0) const; + const size_type src_r_i=0, + const size_type src_r_j=dim-1, + const size_type src_c_i=0, + const size_type src_c_j=dim-1, + const size_type dst_r=0, + const size_type dst_c=0) const; /** * Copy a subset of the rows and columns of another matrix into the @@ -435,8 +448,8 @@ public: */ template <typename MatrixType> void extract_submatrix_from (const MatrixType &matrix, - const std::vector<unsigned int> &row_index_set, - const std::vector<unsigned int> &column_index_set); + const std::vector<size_type> &row_index_set, + const std::vector<size_type> &column_index_set); /** * Copy the elements of the current matrix object into a specified @@ -452,8 +465,8 @@ public: */ template <typename MatrixType> void - scatter_matrix_to (const std::vector<unsigned int> &row_index_set, - const std::vector<unsigned int> &column_index_set, + scatter_matrix_to (const std::vector<size_type> &row_index_set, + const std::vector<size_type> &column_index_set, MatrixType &matrix) const; /** @@ -476,10 +489,10 @@ public: */ template<typename number2> void fill (const FullMatrix<number2> &src, - const unsigned int dst_offset_i = 0, - const unsigned int dst_offset_j = 0, - const unsigned int src_offset_i = 0, - const unsigned int src_offset_j = 0); + const size_type dst_offset_i = 0, + const size_type dst_offset_j = 0, + const size_type src_offset_i = 0, + const size_type src_offset_j = 0); /** @@ -509,8 +522,8 @@ public: */ template<typename number2> void fill_permutation (const FullMatrix<number2> &src, - const std::vector<unsigned int> &p_rows, - const std::vector<unsigned int> &p_cols); + const std::vector<size_type> &p_rows, + const std::vector<size_type> &p_cols); /** * Set a particular entry of the matrix to a value. Thus, calling @@ -522,8 +535,8 @@ public: * @param j The columns index of the element to be set. * @param value The value to be written into the element. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const number value); /** * @} @@ -551,14 +564,14 @@ public: * To remember: this matrix is an * <i>m x n</i>-matrix. */ - unsigned int m () const; + size_type m () const; /** * Number of columns of this matrix. * To remember: this matrix is an * <i>m x n</i>-matrix. */ - unsigned int n () const; + size_type n () const; /** * Return whether the matrix @@ -777,12 +790,12 @@ public: * STL-like iterator with the * first entry of row <tt>r</tt>. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row <tt>r</tt>. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; //@} ///@name Modifying operators @@ -876,10 +889,10 @@ public: template<typename number2> void add (const FullMatrix<number2> &src, const number factor, - const unsigned int dst_offset_i = 0, - const unsigned int dst_offset_j = 0, - const unsigned int src_offset_i = 0, - const unsigned int src_offset_j = 0); + const size_type dst_offset_i = 0, + const size_type dst_offset_j = 0, + const size_type src_offset_i = 0, + const size_type src_offset_j = 0); /** * Weighted addition of the @@ -917,17 +930,17 @@ public: template<typename number2> void Tadd (const FullMatrix<number2> &src, const number factor, - const unsigned int dst_offset_i = 0, - const unsigned int dst_offset_j = 0, - const unsigned int src_offset_i = 0, - const unsigned int src_offset_j = 0); + const size_type dst_offset_i = 0, + const size_type dst_offset_j = 0, + const size_type src_offset_i = 0, + const size_type src_offset_j = 0); /** * Add a single element at the * given position. */ - void add (const unsigned int row, - const unsigned int column, + void add (const size_type row, + const size_type column, const number value); /** @@ -947,9 +960,9 @@ public: * implementation. */ template <typename number2> - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const number2 *values, const bool elide_zero_values = true, const bool col_indices_are_sorted = false); @@ -959,51 +972,51 @@ public: * s*A(j,1...n)</i>. Simple * addition of rows of this */ - void add_row (const unsigned int i, - const number s, - const unsigned int j); + void add_row (const size_type i, + const number s, + const size_type j); /** * <i>A(i,1...n) += s*A(j,1...n) + * t*A(k,1...n)</i>. Multiple * addition of rows of this. */ - void add_row (const unsigned int i, - const number s, const unsigned int j, - const number t, const unsigned int k); + void add_row (const size_type i, + const number s, const size_type j, + const number t, const size_type k); /** * <i>A(1...n,i) += s*A(1...n,j)</i>. * Simple addition of columns of this. */ - void add_col (const unsigned int i, - const number s, - const unsigned int j); + void add_col (const size_type i, + const number s, + const size_type j); /** * <i>A(1...n,i) += s*A(1...n,j) + * t*A(1...n,k)</i>. Multiple * addition of columns of this. */ - void add_col (const unsigned int i, - const number s, const unsigned int j, - const number t, const unsigned int k); + void add_col (const size_type i, + const number s, const size_type j, + const number t, const size_type k); /** * Swap <i>A(i,1...n) <-> * A(j,1...n)</i>. Swap rows i * and j of this */ - void swap_row (const unsigned int i, - const unsigned int j); + void swap_row (const size_type i, + const size_type j); /** * Swap <i>A(1...n,i) <-> * A(1...n,j)</i>. Swap columns * i and j of this */ - void swap_col (const unsigned int i, - const unsigned int j); + void swap_col (const size_type i, + const size_type j); /** * Add constant to diagonal @@ -1446,7 +1459,7 @@ public: * Exception */ DeclException3 (ExcInvalidDestination, - int, int, int, + size_type, size_type, size_type, << "Target region not in matrix: size in this direction=" << arg1 << ", size of new matrix=" << arg2 << ", offset=" << arg3); @@ -1473,7 +1486,7 @@ public: template <typename number> inline -unsigned int +typename FullMatrix<number>::size_type FullMatrix<number>::m() const { return this->n_rows(); @@ -1483,7 +1496,7 @@ FullMatrix<number>::m() const template <typename number> inline -unsigned int +typename FullMatrix<number>::size_type FullMatrix<number>::n() const { return this->n_cols(); @@ -1526,11 +1539,11 @@ FullMatrix<number>::copy_from (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { 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(); } } @@ -1547,11 +1560,11 @@ FullMatrix<number>::copy_transposed (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { 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(); } } @@ -1563,17 +1576,17 @@ template <typename MatrixType> inline void FullMatrix<number>::extract_submatrix_from (const MatrixType &matrix, - const std::vector<unsigned int> &row_index_set, - const std::vector<unsigned int> &column_index_set) + const std::vector<size_type> &row_index_set, + const std::vector<size_type> &column_index_set) { AssertDimension(row_index_set.size(), this->n_rows()); AssertDimension(column_index_set.size(), this->n_cols()); - const unsigned int n_rows_submatrix = row_index_set.size(); - const unsigned int n_cols_submatrix = column_index_set.size(); + const size_type n_rows_submatrix = row_index_set.size(); + const size_type n_cols_submatrix = column_index_set.size(); - for (unsigned int sub_row = 0; sub_row < n_rows_submatrix; ++sub_row) - for (unsigned int sub_col = 0; sub_col < n_cols_submatrix; ++sub_col) + for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row) + for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col) (*this)(sub_row, sub_col) = matrix.el(row_index_set[sub_row], column_index_set[sub_col]); } @@ -1583,18 +1596,18 @@ template <typename number> template <typename MatrixType> inline void -FullMatrix<number>::scatter_matrix_to (const std::vector<unsigned int> &row_index_set, - const std::vector<unsigned int> &column_index_set, +FullMatrix<number>::scatter_matrix_to (const std::vector<size_type> &row_index_set, + const std::vector<size_type> &column_index_set, MatrixType &matrix) const { AssertDimension(row_index_set.size(), this->n_rows()); AssertDimension(column_index_set.size(), this->n_cols()); - const unsigned int n_rows_submatrix = row_index_set.size(); - const unsigned int n_cols_submatrix = column_index_set.size(); + const size_type n_rows_submatrix = row_index_set.size(); + const size_type n_cols_submatrix = column_index_set.size(); - for (unsigned int sub_row = 0; sub_row < n_rows_submatrix; ++sub_row) - for (unsigned int sub_col = 0; sub_col < n_cols_submatrix; ++sub_col) + for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row) + for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col) matrix.set(row_index_set[sub_row], column_index_set[sub_col], (*this)(sub_row, sub_col)); @@ -1604,8 +1617,8 @@ FullMatrix<number>::scatter_matrix_to (const std::vector<unsigned int> &row_inde template <typename number> inline void -FullMatrix<number>::set (const unsigned int i, - const unsigned int j, +FullMatrix<number>::set (const size_type i, + const size_type j, const number value) { (*this)(i,j) = value; @@ -1640,8 +1653,8 @@ template <typename number> inline FullMatrix<number>::Accessor:: Accessor (const FullMatrix<number> *matrix, - const unsigned int r, - const unsigned int c) + const size_type r, + const size_type c) : matrix(matrix), a_row(r), @@ -1651,7 +1664,7 @@ Accessor (const FullMatrix<number> *matrix, template <typename number> inline -unsigned int +typename FullMatrix<number>::size_type FullMatrix<number>::Accessor::row() const { return a_row; @@ -1660,7 +1673,7 @@ FullMatrix<number>::Accessor::row() const template <typename number> inline -unsigned int +typename FullMatrix<number>::size_type FullMatrix<number>::Accessor::column() const { return a_col; @@ -1681,8 +1694,8 @@ template <typename number> inline FullMatrix<number>::const_iterator:: const_iterator(const FullMatrix<number> *matrix, - const unsigned int r, - const unsigned int c) + const size_type r, + const size_type c) : accessor(matrix, r, c) {} @@ -1787,7 +1800,7 @@ FullMatrix<number>::end () const template <typename number> inline typename FullMatrix<number>::const_iterator -FullMatrix<number>::begin (const unsigned int r) const +FullMatrix<number>::begin (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); return const_iterator(this, r, 0); @@ -1798,7 +1811,7 @@ FullMatrix<number>::begin (const unsigned int r) const template <typename number> inline typename FullMatrix<number>::const_iterator -FullMatrix<number>::end (const unsigned int r) const +FullMatrix<number>::end (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); return const_iterator(this, r+1, 0); @@ -1809,7 +1822,7 @@ FullMatrix<number>::end (const unsigned int r) const template <typename number> inline void -FullMatrix<number>::add (const unsigned int r, const unsigned int c, const number v) +FullMatrix<number>::add (const size_type r, const size_type c, const number v) { AssertIndexRange(r, this->m()); AssertIndexRange(c, this->n()); @@ -1823,15 +1836,15 @@ template <typename number> template <typename number2> inline void -FullMatrix<number>::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, +FullMatrix<number>::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, const bool, const bool) { AssertIndexRange(row, this->m()); - for (unsigned int col=0; col<n_cols; ++col) + for (size_type col=0; col<n_cols; ++col) { AssertIndexRange(col_indices[col], this->n()); this->operator()(row,col_indices[col]) += values[col]; @@ -1853,14 +1866,14 @@ FullMatrix<number>::print (STREAM &s, const unsigned int old_precision = s.precision (p); const unsigned int old_width = s.width (w); - for (unsigned int i=0; i<this->m(); ++i) + for (size_type i=0; i<this->m(); ++i) { - for (unsigned int j=0; j<this->n(); ++j) - { - s.width(w); - s.precision(p); - s << this->el(i,j); - } + for (size_type j=0; j<this->n(); ++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 41febef428..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 @@ -32,23 +37,23 @@ DEAL_II_NAMESPACE_OPEN template <typename number> -FullMatrix<number>::FullMatrix (const unsigned int n) +FullMatrix<number>::FullMatrix (const size_type n) : Table<2,number> (n,n) {} template <typename number> -FullMatrix<number>::FullMatrix (const unsigned int m, - const unsigned int n) +FullMatrix<number>::FullMatrix (const size_type m, + const size_type n) : Table<2,number> (m, n) {} template <typename number> -FullMatrix<number>::FullMatrix (const unsigned int m, - const unsigned int n, +FullMatrix<number>::FullMatrix (const size_type m, + const size_type n, const number *entries) : Table<2,number> (m, n) @@ -70,7 +75,7 @@ FullMatrix<number>::FullMatrix (const IdentityMatrix &id) : Table<2,number> (id.m(), id.n()) { - for (unsigned int i=0; i<id.m(); ++i) + for (size_type i=0; i<id.m(); ++i) (*this)(i,i) = 1; } @@ -100,7 +105,7 @@ FullMatrix<number> & FullMatrix<number>::operator = (const IdentityMatrix &id) { this->reinit (id.m(), id.n()); - for (unsigned int i=0; i<id.m(); ++i) + for (size_type i=0; i<id.m(); ++i) (*this)(i,i) = 1.; return *this; @@ -115,8 +120,8 @@ FullMatrix<number>::operator = (const LAPACKFullMatrix<number2> &M) { Assert (this->m() == M.n_rows(), ExcDimensionMismatch(this->m(), M.n_rows())); Assert (this->n() == M.n_cols(), ExcDimensionMismatch(this->n(), M.n_rows())); - for (unsigned int i=0; i<this->m(); ++i) - for (unsigned int j=0; j<this->n(); ++j) + for (size_type i=0; i<this->m(); ++i) + for (size_type j=0; j<this->n(); ++j) (*this)(i,j) = M(i,j); return *this; @@ -199,11 +204,11 @@ FullMatrix<number>::vmult (Vector<number2> &dst, // avoid copying it when using the () // operator const number2 *src_ptr = &(*const_cast<Vector<number2>*>(&src))(0); - const unsigned int size_m = m(), size_n = n(); - for (unsigned int i=0; i<size_m; ++i) + const size_type size_m = m(), size_n = n(); + for (size_type i=0; i<size_m; ++i) { number2 s = adding ? dst(i) : 0.; - for (unsigned int j=0; j<size_n; ++j) + for (size_type j=0; j<size_n; ++j) s += src_ptr[j] * number2(*(e++)); dst(i) = s; } @@ -226,19 +231,19 @@ void FullMatrix<number>::Tvmult (Vector<number2> &dst, const number *e = &this->values[0]; number2 *dst_ptr = &dst(0); - const unsigned int size_m = m(), size_n = n(); + const size_type size_m = m(), size_n = n(); // zero out data if we are not adding if (!adding) - for (unsigned int j=0; j<size_n; ++j) + for (size_type j=0; j<size_n; ++j) dst_ptr[j] = 0.; // write the loop in a way that we can // access the data contiguously - for (unsigned int i=0; i<size_m; ++i) + for (size_type i=0; i<size_m; ++i) { const number2 d = src(i); - for (unsigned int j=0; j<size_n; ++j) + for (size_type j=0; j<size_n; ++j) dst_ptr[j] += d * number2(*(e++)); }; } @@ -259,12 +264,12 @@ number FullMatrix<number>::residual (Vector<number2> &dst, Assert (&src != &dst, ExcSourceEqualsDestination()); number res = 0.; - const unsigned int size_m = m(), - size_n = n(); - for (unsigned int i=0; i<size_n; ++i) + const size_type size_m = m(), + size_n = n(); + for (size_type i=0; i<size_n; ++i) { number s = number(right(i)); - for (unsigned int j=0; j<size_m; ++j) + for (size_type j=0; j<size_m; ++j) s -= number(src(j)) * (*this)(i,j); dst(i) = s; res += s*s; @@ -284,8 +289,8 @@ void FullMatrix<number>::forward (Vector<number2> &dst, Assert (dst.size() == m(), ExcDimensionMismatch(dst.size(), m())); Assert (src.size() == n(), ExcDimensionMismatch(src.size(), n())); - unsigned int i,j; - unsigned int nu = ( (m()<n()) ? m() : n()); + size_type i,j; + size_type nu = ( (m()<n()) ? m() : n()); for (i=0; i<nu; ++i) { number s = number(src(i)); @@ -305,8 +310,8 @@ void FullMatrix<number>::backward (Vector<number2> &dst, { Assert (!this->empty(), ExcEmptyMatrix()); - unsigned int j; - unsigned int nu = (m()<n() ? m() : n()); + size_type j; + size_type nu = (m()<n() ? m() : n()); for (int i=nu-1; i>=0; --i) { number2 s = src(i); @@ -322,10 +327,10 @@ void FullMatrix<number>::backward (Vector<number2> &dst, template <typename number> template <typename number2> void FullMatrix<number>::fill (const FullMatrix<number2> &src, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j) + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j) { Assert (dst_offset_i < m(), ExcIndexRange (dst_offset_i, 0, m())); @@ -337,13 +342,13 @@ void FullMatrix<number>::fill (const FullMatrix<number2> &src, ExcIndexRange (src_offset_j, 0, src.n())); // Compute maximal size of copied block - const unsigned int rows = std::min (m() - dst_offset_i, - src.m() - src_offset_i); - const unsigned int cols = std::min (n() - dst_offset_j, - src.n() - src_offset_j); + const size_type rows = std::min (m() - dst_offset_i, + src.m() - src_offset_i); + const size_type cols = std::min (n() - dst_offset_j, + src.n() - src_offset_j); - for (unsigned int i=0; i<rows ; ++i) - for (unsigned int j=0; j<cols ; ++j) + for (size_type i=0; i<rows ; ++i) + for (size_type j=0; j<cols ; ++j) (*this)(dst_offset_i+i,dst_offset_j+j) = src(src_offset_i+i,src_offset_j+j); } @@ -352,16 +357,16 @@ void FullMatrix<number>::fill (const FullMatrix<number2> &src, template <typename number> template <typename number2> void FullMatrix<number>::fill_permutation (const FullMatrix<number2> &src, - const std::vector<unsigned int> &p_rows, - const std::vector<unsigned int> &p_cols) + const std::vector<size_type> &p_rows, + const std::vector<size_type> &p_cols) { Assert (p_rows.size() == this->n_rows(), ExcDimensionMismatch (p_rows.size(), this->n_rows())); Assert (p_cols.size() == this->n_cols(), ExcDimensionMismatch (p_cols.size(), this->n_cols())); - for (unsigned int i=0; i<this->n_rows(); ++i) - for (unsigned int j=0; j<this->n_cols(); ++j) + for (size_type i=0; i<this->n_rows(); ++i) + for (size_type j=0; j<this->n_cols(); ++j) (*this)(i,j) = src(p_rows[i], p_cols[j]); } @@ -378,75 +383,75 @@ void FullMatrix<number>::fill_permutation (const FullMatrix<number2> &src, template <typename number> -void FullMatrix<number>::add_row (const unsigned int i, +void FullMatrix<number>::add_row (const size_type i, const number s, - const unsigned int j) + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k<m(); ++k) + for (size_type k=0; k<m(); ++k) (*this)(i,k) += s*(*this)(j,k); } template <typename number> -void FullMatrix<number>::add_row (const unsigned int i, +void FullMatrix<number>::add_row (const size_type i, const number s, - const unsigned int j, + const size_type j, const number t, - const unsigned int k) + const size_type k) { Assert (!this->empty(), ExcEmptyMatrix()); - const unsigned int size_m = m(); - for (unsigned int l=0; l<size_m; ++l) + const size_type size_m = m(); + for (size_type l=0; l<size_m; ++l) (*this)(i,l) += s*(*this)(j,l) + t*(*this)(k,l); } template <typename number> -void FullMatrix<number>::add_col (const unsigned int i, const number s, - const unsigned int j) +void FullMatrix<number>::add_col (const size_type i, const number s, + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k<n(); ++k) + for (size_type k=0; k<n(); ++k) (*this)(k,i) += s*(*this)(k,j); } template <typename number> -void FullMatrix<number>::add_col (const unsigned int i, const number s, - const unsigned int j, const number t, - const unsigned int k) +void FullMatrix<number>::add_col (const size_type i, const number s, + const size_type j, const number t, + const size_type k) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int l=0; l<n(); ++l) + for (size_t l=0; l<n(); ++l) (*this)(l,i) += s*(*this)(l,j) + t*(*this)(l,k); } template <typename number> -void FullMatrix<number>::swap_row (const unsigned int i, - const unsigned int j) +void FullMatrix<number>::swap_row (const size_type i, + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k<n(); ++k) + for (size_type k=0; k<n(); ++k) std::swap ((*this)(i,k), (*this)(j,k)); } template <typename number> -void FullMatrix<number>::swap_col (const unsigned int i, - const unsigned int j) +void FullMatrix<number>::swap_col (const size_type i, + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k<m(); ++k) + for (size_type k=0; k<m(); ++k) std::swap ((*this)(k,i), (*this)(k,j)); } @@ -458,7 +463,7 @@ void FullMatrix<number>::diagadd (const number src) Assert (!this->empty(), ExcEmptyMatrix()); Assert (m() == n(), ExcDimensionMismatch(m(),n())); - for (unsigned int i=0; i<n(); ++i) + for (size_type i=0; i<n(); ++i) (*this)(i,i) += src; } @@ -473,8 +478,8 @@ void FullMatrix<number>::equ (const number a, Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m())); Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n())); - for (unsigned int i=0; i<m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<m(); ++i) + for (size_type j=0; j<n(); ++j) (*this)(i,j) = a * number(A(i,j)); } @@ -494,8 +499,8 @@ FullMatrix<number>::equ (const number a, Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m())); Assert (n() == B.n(), ExcDimensionMismatch(n(), B.n())); - for (unsigned int i=0; i<m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<m(); ++i) + for (size_type j=0; j<n(); ++j) (*this)(i,j) = a * number(A(i,j)) + b * number(B(i,j)); } @@ -519,8 +524,8 @@ FullMatrix<number>::equ (const number a, Assert (m() == C.m(), ExcDimensionMismatch(m(), C.m())); Assert (n() == C.n(), ExcDimensionMismatch(n(), C.n())); - for (unsigned int i=0; i<m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<m(); ++i) + for (size_type j=0; j<n(); ++j) (*this)(i,j) = a * number(A(i,j)) + b * number(B(i,j)) + c * number(C(i,j)); @@ -581,16 +586,16 @@ void FullMatrix<number>::mmult (FullMatrix<number2> &dst, #endif - const unsigned int m = this->m(), n = src.n(), l = this->n(); + const size_type m = this->m(), n = src.n(), l = this->n(); // arrange the loops in a way that we keep write operations low, (writing is // usually more costly than reading), even though we need to access the data // in src not in a contiguous way. - for (unsigned int i=0; i<m; i++) - for (unsigned int j=0; j<n; j++) + for (size_type i=0; i<m; i++) + for (size_type j=0; j<n; j++) { number2 add_value = adding ? dst(i,j) : 0.; - for (unsigned int k=0; k<l; k++) + for (size_type k=0; k<l; k++) add_value += (number2)(*this)(i,k) * (number2)(src(k,j)); dst(i,j) = add_value; } @@ -652,15 +657,15 @@ void FullMatrix<number>::Tmmult (FullMatrix<number2> &dst, #endif - const unsigned int m = n(), n = src.n(), l = this->m(); + const size_type m = n(), n = src.n(), l = this->m(); // symmetric matrix if the two matrices are the same if (PointerComparison::equal(this, &src)) - for (unsigned int i=0; i<m; ++i) - for (unsigned int j=i; j<m; ++j) + for (size_type i=0; i<m; ++i) + for (size_type j=i; j<m; ++j) { number2 add_value = 0.; - for (unsigned int k=0; k<l; ++k) + for (size_type k=0; k<l; ++k) add_value += (number2)(*this)(k,i) * (number2)(*this)(k,j); if (adding) { @@ -677,11 +682,11 @@ void FullMatrix<number>::Tmmult (FullMatrix<number2> &dst, // optimized gemm operation in case the matrix is big, so this shouldn't be // too bad. else - for (unsigned int i=0; i<m; i++) - for (unsigned int j=0; j<n; j++) + for (size_type i=0; i<m; i++) + for (size_type j=0; j<n; j++) { number2 add_value = adding ? dst(i,j) : 0.; - for (unsigned int k=0; k<l; k++) + for (size_type k=0; k<l; k++) add_value += (number2)(*this)(k,i) * (number2)(src(k,j)); dst(i,j) = add_value; } @@ -742,15 +747,15 @@ void FullMatrix<number>::mTmult (FullMatrix<number2> &dst, #endif - const unsigned int m = this->m(), n = src.m(), l = this->n(); + const size_type m = this->m(), n = src.m(), l = this->n(); // symmetric matrix if the two matrices are the same if (PointerComparison::equal(this, &src)) - for (unsigned int i=0; i<m; ++i) - for (unsigned int j=i; j<m; ++j) + for (size_type i=0; i<m; ++i) + for (size_type j=i; j<m; ++j) { number2 add_value = 0.; - for (unsigned int k=0; k<l; ++k) + for (size_type k=0; k<l; ++k) add_value += (number2)(*this)(i,k) * (number2)(*this)(j,k); if (adding) { @@ -764,11 +769,11 @@ void FullMatrix<number>::mTmult (FullMatrix<number2> &dst, else // arrange the loops in a way that we keep write operations low, (writing is // usually more costly than reading). - for (unsigned int i=0; i<m; i++) - for (unsigned int j=0; j<n; j++) + for (size_type i=0; i<m; i++) + for (size_type j=0; j<n; j++) { number2 add_value = adding ? dst(i,j) : 0.; - for (unsigned int k=0; k<l; k++) + for (size_type k=0; k<l; k++) add_value += (number2)(*this)(i,k) * (number2)(src(j,k)); dst(i,j) = add_value; } @@ -829,18 +834,18 @@ void FullMatrix<number>::TmTmult (FullMatrix<number2> &dst, #endif - const unsigned int m = n(), n = src.m(), l = this->m(); + const size_type m = n(), n = src.m(), l = this->m(); // arrange the loops in a way that we keep write operations low, (writing is // usually more costly than reading), even though we need to access the data // in the calling matrix in a non-contiguous way, possibly leading to cache // misses. However, we should usually end up in the optimized gemm operation // in case the matrix is big, so this shouldn't be too bad. - for (unsigned int i=0; i<m; i++) - for (unsigned int j=0; j<n; j++) + for (size_type i=0; i<m; i++) + for (size_type j=0; j<n; j++) { number2 add_value = adding ? dst(i,j) : 0.; - for (unsigned int k=0; k<l; k++) + for (size_type k=0; k<l; k++) add_value += (number2)(*this)(k,i) * (number2)(src(j,k)); dst(i,j) = add_value; } @@ -880,25 +885,25 @@ FullMatrix<number>::triple_product( // For all entries of the product // AD - for (unsigned int i=0; i<A.m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<A.m(); ++i) + for (size_type j=0; j<n(); ++j) { // Compute the entry number ADij = 0.; if (transpose_D) - for (unsigned int k=0; k<A.n(); ++k) + for (size_type k=0; k<A.n(); ++k) ADij += A(i,k)*D(j,k); else - for (unsigned int k=0; k<A.n(); ++k) + for (size_type k=0; k<A.n(); ++k) ADij += A(i,k)*D(k,j); // And add it to this after // multiplying with the right // factor from B if (transpose_B) - for (unsigned int k=0; k<m(); ++k) + for (size_type k=0; k<m(); ++k) this->operator()(k,j) += scaling * ADij * B(i,k); else - for (unsigned int k=0; k<m(); ++k) + for (size_type k=0; k<m(); ++k) this->operator()(k,j) += scaling * ADij * B(k,i); } } @@ -915,11 +920,11 @@ FullMatrix<number>::matrix_norm_square (const Vector<number2> &v) const Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); number2 sum = 0.; - const unsigned int n_rows = m(); + const size_type n_rows = m(); const number *val_ptr = &this->values[0]; const number2 *v_ptr; - for (unsigned int row=0; row<n_rows; ++row) + for (size_type row=0; row<n_rows; ++row) { number s = 0.; const number *const val_end_of_row = val_ptr+n_rows; @@ -946,12 +951,12 @@ FullMatrix<number>::matrix_scalar_product (const Vector<number2> &u, Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); number2 sum = 0.; - const unsigned int n_rows = m(); - const unsigned int n_cols = n(); + const size_type n_rows = m(); + const size_type n_cols = n(); const number *val_ptr = &this->values[0]; const number2 *v_ptr; - for (unsigned int row=0; row<n_rows; ++row) + for (size_type row=0; row<n_rows; ++row) { number s = 0.; const number *const val_end_of_row = val_ptr+n_cols; @@ -973,9 +978,9 @@ FullMatrix<number>::symmetrize () { Assert (m() == n(), ExcNotQuadratic()); - const unsigned int N = m(); - for (unsigned int i=0; i<N; ++i) - for (unsigned int j=i+1; j<N; ++j) + const size_type N = m(); + for (size_type i=0; i<N; ++i) + for (size_type j=i+1; j<N; ++j) { const number t = ((*this)(i,j) + (*this)(j,i)) / number(2.); (*this)(i,j) = (*this)(j,i) = t; @@ -990,12 +995,12 @@ FullMatrix<number>::l1_norm () const Assert (!this->empty(), ExcEmptyMatrix()); real_type sum=0, max=0; - const unsigned int n_rows = m(), n_cols = n(); + const size_type n_rows = m(), n_cols = n(); - for (unsigned int col=0; col<n_cols; ++col) + for (size_type col=0; col<n_cols; ++col) { sum=0; - for (unsigned int row=0; row<n_rows; ++row) + for (size_type row=0; row<n_rows; ++row) sum += std::abs((*this)(row,col)); if (sum > max) max = sum; @@ -1012,12 +1017,12 @@ FullMatrix<number>::linfty_norm () const Assert (!this->empty(), ExcEmptyMatrix()); real_type sum=0, max=0; - const unsigned int n_rows = m(), n_cols = n(); + const size_type n_rows = m(), n_cols = n(); - for (unsigned int row=0; row<n_rows; ++row) + for (size_type row=0; row<n_rows; ++row) { sum=0; - for (unsigned int col=0; col<n_cols; ++col) + for (size_type col=0; col<n_cols; ++col) sum += std::abs((*this)(row,col)); if (sum > max) max = sum; @@ -1038,8 +1043,8 @@ FullMatrix<number>::add (const number a, Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m())); Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n())); - for (unsigned int i=0; i<m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<m(); ++i) + for (size_type j=0; j<n(); ++j) (*this)(i,j) += a * number(A(i,j)); } @@ -1059,8 +1064,8 @@ FullMatrix<number>::add (const number a, Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m())); Assert (n() == B.n(), ExcDimensionMismatch(n(), B.n())); - for (unsigned int i=0; i<m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<m(); ++i) + for (size_type j=0; j<n(); ++j) (*this)(i,j) += a * number(A(i,j)) + b * number(B(i,j)); } @@ -1086,8 +1091,8 @@ FullMatrix<number>::add (const number a, Assert (n() == C.n(), ExcDimensionMismatch(n(), C.n())); - for (unsigned int i=0; i<m(); ++i) - for (unsigned int j=0; j<n(); ++j) + for (size_type i=0; i<m(); ++i) + for (size_type j=0; j<n(); ++j) (*this)(i,j) += a * number(A(i,j)) + b * number(B(i,j)) + c * number(C(i,j)); @@ -1099,10 +1104,10 @@ template <typename number> template <typename number2> void FullMatrix<number>::add (const FullMatrix<number2> &src, const number factor, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j) + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j) { Assert (dst_offset_i < m(), ExcIndexRange (dst_offset_i, 0, m())); @@ -1114,13 +1119,11 @@ void FullMatrix<number>::add (const FullMatrix<number2> &src, ExcIndexRange (src_offset_j, 0, src.n())); // Compute maximal size of copied block - const unsigned int rows = std::min (m() - dst_offset_i, - src.m() - src_offset_i); - const unsigned int cols = std::min (n() - dst_offset_j, - src.n() - src_offset_j); + const size_type rows = std::min (m() - dst_offset_i, src.m() - src_offset_i); + const size_type cols = std::min (n() - dst_offset_j, src.n() - src_offset_j); - for (unsigned int i=0; i<rows ; ++i) - for (unsigned int j=0; j<cols ; ++j) + for (size_type i=0; i<rows ; ++i) + for (size_type j=0; j<cols ; ++j) (*this)(dst_offset_i+i,dst_offset_j+j) += factor * number(src(src_offset_i+i,src_offset_j+j)); } @@ -1131,10 +1134,10 @@ template <typename number> template <typename number2> void FullMatrix<number>::Tadd (const FullMatrix<number2> &src, const number factor, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j) + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j) { Assert (dst_offset_i < m(), ExcIndexRange (dst_offset_i, 0, m())); @@ -1146,14 +1149,13 @@ void FullMatrix<number>::Tadd (const FullMatrix<number2> &src, ExcIndexRange (src_offset_j, 0, src.m())); // Compute maximal size of copied block - const unsigned int rows = std::min (m() - dst_offset_i, - src.n() - src_offset_j); - const unsigned int cols = std::min (n() - dst_offset_j, - src.m() - src_offset_i); + 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); - for (unsigned int i=0; i<rows ; ++i) - for (unsigned int j=0; j<cols ; ++j) + for (size_type i=0; i<rows ; ++i) + for (size_type j=0; j<cols ; ++j) (*this)(dst_offset_i+i,dst_offset_j+j) += factor * number(src(src_offset_i+j,src_offset_j+i)); } @@ -1172,8 +1174,8 @@ FullMatrix<number>::Tadd (const number a, Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m())); Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n())); - for (unsigned int i=0; i<n(); ++i) - for (unsigned int j=0; j<m(); ++j) + for (size_type i=0; i<n(); ++i) + for (size_type j=0; j<m(); ++j) (*this)(i,j) += a * number(A(j,i)); } @@ -1227,7 +1229,7 @@ FullMatrix<number>::trace () const ExcDimensionMismatch(this->n_cols(), this->n_rows())); number tr = 0; - for (unsigned int i=0; i<this->n_rows(); ++i) + for (size_type i=0; i<this->n_rows(); ++i) tr += (*this)(i,i); return tr; @@ -1242,7 +1244,7 @@ FullMatrix<number>::frobenius_norm () const Assert (!this->empty(), ExcEmptyMatrix()); real_type s = 0.; - for (unsigned int i=0; i<this->n_rows()*this->n_cols(); ++i) + for (size_type i=0; i<this->n_rows()*this->n_cols(); ++i) s += numbers::NumberTraits<number>::abs_square(this->values[i]); return std::sqrt(s); } @@ -1257,8 +1259,8 @@ FullMatrix<number>::relative_symmetry_norm2 () const real_type s = 0.; real_type a = 0.; - for (unsigned int i=0; i<this->n_rows(); ++i) - for (unsigned int j=0; j<this->n_cols(); ++j) + for (size_type i=0; i<this->n_rows(); ++i) + for (size_type j=0; j<this->n_cols(); ++j) { const number x_ij = (*this)(i,j); const number x_ji = (*this)(j,i); @@ -1472,13 +1474,13 @@ FullMatrix<number>::cholesky (const FullMatrix<number2> &A) this->reinit(A.m(), A.n()); double SLik2 = 0.0, SLikLjk = 0.0; - for (unsigned int i=0; i< this->n_cols(); i++) + for (size_type i=0; i< this->n_cols(); i++) { SLik2 = 0.0; - for (unsigned int j = 0; j < i; j++) + for (size_type j = 0; j < i; j++) { SLikLjk = 0.0; - for (unsigned int k =0; k<j; k++) + for (size_type k =0; k<j; k++) { SLikLjk += (*this)(i,k)*(*this)(j,k); }; @@ -1503,9 +1505,9 @@ FullMatrix<number>::outer_product (const Vector<number2> &V, Assert (V.size() == W.size(), ExcMessage("Vectors V, W must be the same size.")); this->reinit(V.size(), V.size()); - for (unsigned int i = 0; i<this->n(); i++) + for (size_type i = 0; i<this->n(); i++) { - for (unsigned int j = 0; j< this->n(); j++) + for (size_type j = 0; j< this->n(); j++) { (*this)(i,j) = V(i)*W(j); } @@ -1574,12 +1576,12 @@ template <typename number> template <int dim> void FullMatrix<number>::copy_from (const Tensor<2,dim> &T, - const unsigned int src_r_i, - const unsigned int src_r_j, - const unsigned int src_c_i, - const unsigned int src_c_j, - const unsigned int dst_r, - const unsigned int dst_c) + const size_type src_r_i, + const size_type src_r_j, + const size_type src_c_i, + const size_type src_c_j, + const size_type dst_r, + const size_type dst_c) { Assert (!this->empty(), ExcEmptyMatrix()); @@ -1592,8 +1594,8 @@ FullMatrix<number>::copy_from (const Tensor<2,dim> &T, Assert(src_r_j>=src_r_i, ExcIndexRange(src_r_j,0,src_r_i)); Assert(src_c_j>=src_c_i, ExcIndexRange(src_r_j,0,src_r_i)); - for (unsigned int i=0; i<src_r_j-src_r_i+1; i++) - for (unsigned int j=0; j<src_c_j-src_c_i+1; j++) + for (size_type i=0; i<src_r_j-src_r_i+1; i++) + for (size_type j=0; j<src_c_j-src_c_i+1; j++) (*this)(i+dst_r,j+dst_c) = number(T[i+src_r_i][j+src_c_i]); } @@ -1603,12 +1605,12 @@ template <typename number> template <int dim> void FullMatrix<number>::copy_to (Tensor<2,dim> &T, - const unsigned int src_r_i, - const unsigned int src_r_j, - const unsigned int src_c_i, - const unsigned int src_c_j, - const unsigned int dst_r, - const unsigned int dst_c) const + const size_type src_r_i, + const size_type src_r_j, + const size_type src_c_i, + const size_type src_c_j, + const size_type dst_r, + const size_type dst_c) const { Assert (!this->empty(), ExcEmptyMatrix()); Assert(dim-dst_r>src_r_j-src_r_i, @@ -1621,8 +1623,8 @@ FullMatrix<number>::copy_to (Tensor<2,dim> &T, Assert(src_c_j>=src_c_i, ExcIndexRange(src_r_j,0,src_r_i)); - for (unsigned int i=0; i<src_r_j-src_r_i+1; i++) - for (unsigned int j=0; j<src_c_j-src_c_i+1; j++) + for (size_type i=0; i<src_r_j-src_r_i+1; i++) + for (size_type j=0; j<src_c_j-src_c_i+1; j++) T[i+dst_r][j+dst_c] = double ((*this)(i+src_r_i,j+src_c_i)); } @@ -1639,12 +1641,12 @@ FullMatrix<number>::precondition_Jacobi (Vector<somenumber> &dst, Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n())); Assert (src.size() == n(), ExcDimensionMismatch (src.size(), n())); - const unsigned int n = src.size(); - somenumber *dst_ptr = dst.begin(); - const somenumber *src_ptr = src.begin(); + const size_t n = src.size(); + somenumber *dst_ptr = dst.begin(); + const somenumber *src_ptr = src.begin(); - for (unsigned int i=0; i<n; ++i, ++dst_ptr, ++src_ptr) - *dst_ptr = somenumber(om) * *src_ptr / somenumber((*this)(i,i)); + for (size_type i=0; i<n; ++i, ++dst_ptr, ++src_ptr) + *dst_ptr = somenumber(om) **src_ptr / somenumber((*this)(i,i)); } @@ -1683,9 +1685,9 @@ FullMatrix<number>::print_formatted ( width = precision+2; } - for (unsigned int i=0; i<m(); ++i) + for (size_type i=0; i<m(); ++i) { - for (unsigned int j=0; j<n(); ++j) + for (size_type j=0; j<n(); ++j) if (std::abs((*this)(i,j)) > threshold) out << std::setw(width) << (*this)(i,j) * number(denominator) << ' '; @@ -1772,7 +1774,7 @@ FullMatrix<number>::gauss_jordan () // Gauss-Jordan-Algorithmus from // Stoer & Bulirsch I (4th Edition) // p. 153 - const unsigned int N = n(); + const size_type N = n(); // first get an estimate of the // size of the elements of this @@ -1782,26 +1784,26 @@ FullMatrix<number>::gauss_jordan () // fear that the matrix is not // regular double diagonal_sum = 0; - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) diagonal_sum += std::abs((*this)(i,i)); const double typical_diagonal_element = diagonal_sum/N; // initialize the array that holds // the permutations that we find // during pivot search - std::vector<unsigned int> p(N); - for (unsigned int i=0; i<N; ++i) + std::vector<size_type> p(N); + for (size_type i=0; i<N; ++i) p[i] = i; - for (unsigned int j=0; j<N; ++j) + for (size_type j=0; j<N; ++j) { // pivot search: search that // part of the line on and // right of the diagonal for // the largest element real_type max = std::abs((*this)(j,j)); - unsigned int r = j; - for (unsigned int i=j+1; i<N; ++i) + size_type r = j; + for (size_type i=j+1; i<N; ++i) { if (std::abs((*this)(i,j)) > max) { @@ -1817,7 +1819,7 @@ FullMatrix<number>::gauss_jordan () // row interchange if (r>j) { - for (unsigned int k=0; k<N; ++k) + for (size_type k=0; k<N; ++k) std::swap ((*this)(j,k), (*this)(r,k)); std::swap (p[j], p[r]); @@ -1826,16 +1828,16 @@ FullMatrix<number>::gauss_jordan () // transformation const number hr = number(1.)/(*this)(j,j); (*this)(j,j) = hr; - for (unsigned int k=0; k<N; ++k) + for (size_type k=0; k<N; ++k) { if (k==j) continue; - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { if (i==j) continue; (*this)(i,k) -= (*this)(i,j)*(*this)(j,k)*hr; } } - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { (*this)(i,j) *= hr; (*this)(j,i) *= -hr; @@ -1844,11 +1846,11 @@ FullMatrix<number>::gauss_jordan () } // column interchange std::vector<number> hv(N); - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { - for (unsigned int k=0; k<N; ++k) + for (size_type k=0; k<N; ++k) hv[p[k]] = (*this)(i,k); - for (unsigned int k=0; k<N; ++k) + for (size_type k=0; k<N; ++k) (*this)(i,k) = hv[k]; } } diff --git a/deal.II/include/deal.II/lac/generic_linear_algebra.h b/deal.II/include/deal.II/lac/generic_linear_algebra.h new file mode 100644 index 0000000000..693d1b420b --- /dev/null +++ b/deal.II/include/deal.II/lac/generic_linear_algebra.h @@ -0,0 +1,239 @@ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + +#ifndef __deal2__generic_linear_algebra_h +#define __deal2__generic_linear_algebra_h + +#include <deal.II/base/config.h> + + +#include <deal.II/lac/vector.h> +#include <deal.II/lac/block_vector.h> +#include <deal.II/lac/sparse_matrix.h> +#include <deal.II/lac/precondition.h> +DEAL_II_NAMESPACE_OPEN + + +namespace LinearAlgebraDealII +{ + typedef Vector<double> Vector; + typedef BlockVector<double> BlockVector; + + typedef SparseMatrix<double> SparseMatrix; + + typedef PreconditionSSOR<SparseMatrix > PreconditionSSOR; + +} + + +// Dummy class. This used to check your program +// to make sure it is compatible with all +// linear algebra classes. In other words, +// this is the minimal interface. +// TODO: should we move this into tests/ only? +namespace LinearAlgebraDummy +{ + class Vector + { + void compress(); + }; + class BlockVector + { + void compress(); + }; + + class SparseMatrix + { + void compress(); + }; + + class PreconditionSSOR {}; + +} + + +DEAL_II_NAMESPACE_CLOSE + + +#ifdef DEAL_II_USE_PETSC + +#include <deal.II/lac/block_sparsity_pattern.h> +#include <deal.II/lac/petsc_vector.h> +#include <deal.II/lac/petsc_block_vector.h> +#include <deal.II/lac/petsc_parallel_sparse_matrix.h> +#include <deal.II/lac/petsc_sparse_matrix.h> +#include <deal.II/lac/petsc_parallel_block_sparse_matrix.h> +#include <deal.II/lac/petsc_precondition.h> +#include <deal.II/lac/petsc_solver.h> + +DEAL_II_NAMESPACE_OPEN + +namespace LinearAlgebraPETSc +{ + using namespace dealii; + + typedef PETScWrappers::Vector Vector; + typedef PETScWrappers::BlockVector BlockVector; + + typedef PETScWrappers::SparseMatrix SparseMatrix; + typedef PETScWrappers::PreconditionSSOR PreconditionSSOR; + + 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 used for the + * top left block of the Stokes matrix. + */ + typedef PETScWrappers::PreconditionBoomerAMG PreconditionAMG; + + /** + * Typedef for the Incomplete Cholesky preconditioner used + * for other blocks of the system matrix. + */ + typedef PETScWrappers::PreconditionICC PreconditionIC; + + /** + * Typedef for the Incomplete LU decomposition preconditioner used + * for other blocks of the system matrix. + */ + typedef PETScWrappers::PreconditionILU PreconditionILU; + + /** + * Typedef for the Incomplete Jacobi decomposition preconditioner used + * for other blocks of the system matrix. + */ + typedef PETScWrappers::PreconditionJacobi PreconditionJacobi; + + } + +} +DEAL_II_NAMESPACE_CLOSE + + +#endif // DEAL_II_USE_PETSC + +#ifdef DEAL_II_USE_TRILINOS + +#include <deal.II/lac/trilinos_vector.h> +#include <deal.II/lac/trilinos_block_vector.h> +#include <deal.II/lac/trilinos_block_sparse_matrix.h> +#include <deal.II/lac/trilinos_sparse_matrix.h> +#include <deal.II/lac/trilinos_precondition.h> +#include <deal.II/lac/block_sparsity_pattern.h> +#include <deal.II/lac/trilinos_solver.h> + +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 used for the + * top left block of the Stokes matrix. + */ + typedef TrilinosWrappers::PreconditionAMG PreconditionAMG; + + /** + * Typedef for the Incomplete Cholesky preconditioner used + * for other blocks of the system matrix. + */ + typedef TrilinosWrappers::PreconditionIC PreconditionIC; + + /** + * Typedef for the Incomplete LU decomposition preconditioner used + * for other blocks of the system matrix. + */ + typedef TrilinosWrappers::PreconditionILU PreconditionILU; + + /** + * Typedef for the Incomplete Jacobi decomposition preconditioner used + * for other blocks of the system matrix. + */ + typedef TrilinosWrappers::PreconditionJacobi PreconditionJacobi; + + + } + +} + +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 22a531b95c..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 @@ -51,6 +56,11 @@ template<typename number> class Householder : private FullMatrix<number> { public: + /** + * Declare type of container size. + */ + typedef types::global_dof_index size_type; + /** * Create an empty object. */ @@ -139,7 +149,7 @@ template <typename number2> void Householder<number>::initialize(const FullMatrix<number2> &M) { - const unsigned int m = M.n_rows(), n = M.n_cols(); + const size_type m = M.n_rows(), n = M.n_cols(); this->reinit(m, n); this->fill(M); Assert (!this->empty(), typename FullMatrix<number2>::ExcEmptyMatrix()); @@ -149,10 +159,10 @@ Householder<number>::initialize(const FullMatrix<number2> &M) Assert (this->n_cols() <= this->n_rows(), ExcDimensionMismatch(this->n_cols(), this->n_rows())); - for (unsigned int j=0 ; j<n ; ++j) + for (size_type j=0 ; j<n ; ++j) { number2 sigma = 0; - unsigned int i; + size_type i; // sigma = ||v||^2 for (i=j ; i<m ; ++i) sigma += this->el(i,j)*this->el(i,j); @@ -176,7 +186,7 @@ Householder<number>::initialize(const FullMatrix<number2> &M) // For all subsequent columns do // the Householder reflexion - for (unsigned int k=j+1 ; k<n ; ++k) + for (size_type k=j+1 ; k<n ; ++k) { number2 sum = diagonal[j]*this->el(j,k); for (i=j+1 ; i<m ; ++i) @@ -208,7 +218,7 @@ Householder<number>::least_squares (Vector<number2> &dst, AssertDimension(dst.size(), this->n()); AssertDimension(src.size(), this->m()); - const unsigned int m = this->m(), n = this->n(); + const size_type m = this->m(), n = this->n(); GrowingVectorMemory<Vector<number2> > mem; Vector<number2> *aux = mem.alloc(); @@ -218,20 +228,20 @@ Householder<number>::least_squares (Vector<number2> &dst, // Multiply Q_n ... Q_2 Q_1 src // Where Q_i = I-v_i v_i^T - for (unsigned int j=0; j<n; ++j) + for (size_type j=0; j<n; ++j) { // sum = v_i^T dst number2 sum = diagonal[j]* (*aux)(j); - for (unsigned int i=j+1 ; i<m ; ++i) - sum += this->el(i,j)*(*aux)(i); + for (size_type i=j+1 ; i<m ; ++i) + sum += static_cast<number2>(this->el(i,j))*(*aux)(i); // dst -= v * sum (*aux)(j) -= sum*diagonal[j]; - for (unsigned int i=j+1 ; i<m ; ++i) - (*aux)(i) -= sum*this->el(i,j); + for (size_type i=j+1 ; i<m ; ++i) + (*aux)(i) -= sum*static_cast<number2>(this->el(i,j)); } // Compute norm of residual number2 sum = 0.; - for (unsigned int i=n ; i<m ; ++i) + for (size_type i=n ; i<m ; ++i) sum += (*aux)(i) * (*aux)(i); Assert(numbers::is_finite(sum), ExcNumberNotFinite()); @@ -253,7 +263,7 @@ Householder<number>::least_squares (BlockVector<number2> &dst, AssertDimension(dst.size(), this->n()); AssertDimension(src.size(), this->m()); - const unsigned int m = this->m(), n = this->n(); + const size_type m = this->m(), n = this->n(); GrowingVectorMemory<BlockVector<number2> > mem; BlockVector<number2> *aux = mem.alloc(); @@ -263,20 +273,20 @@ Householder<number>::least_squares (BlockVector<number2> &dst, // Multiply Q_n ... Q_2 Q_1 src // Where Q_i = I-v_i v_i^T - for (unsigned int j=0; j<n; ++j) + for (size_type j=0; j<n; ++j) { // sum = v_i^T dst number2 sum = diagonal[j]* (*aux)(j); - for (unsigned int i=j+1 ; i<m ; ++i) + for (size_type i=j+1 ; i<m ; ++i) sum += this->el(i,j)*(*aux)(i); // dst -= v * sum (*aux)(j) -= sum*diagonal[j]; - for (unsigned int i=j+1 ; i<m ; ++i) + for (size_type i=j+1 ; i<m ; ++i) (*aux)(i) -= sum*this->el(i,j); } // Compute norm of residual number2 sum = 0.; - for (unsigned int i=n ; i<m ; ++i) + for (size_type i=n ; i<m ; ++i) sum += (*aux)(i) * (*aux)(i); Assert(numbers::is_finite(sum), ExcNumberNotFinite()); diff --git a/deal.II/include/deal.II/lac/identity_matrix.h b/deal.II/include/deal.II/lac/identity_matrix.h index a29e08c486..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 @@ -69,6 +74,11 @@ DEAL_II_NAMESPACE_OPEN class IdentityMatrix { public: + /** + * Declate type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor. Creates a * zero-sized matrix that should @@ -81,13 +91,13 @@ public: * Constructor. Creates a * identity matrix of size #n. */ - IdentityMatrix (const unsigned int n); + IdentityMatrix (const size_type n); /** * Resize the matrix to be of * size #n by #n. */ - void reinit (const unsigned int n); + void reinit (const size_type n); /** * Number of rows of this @@ -95,7 +105,7 @@ public: * matrix, the number of rows and * columns are equal, of course. */ - unsigned int m () const; + size_type m () const; /** * Number of columns of this @@ -103,7 +113,7 @@ public: * matrix, the number of rows and * columns are equal, of course. */ - unsigned int n () const; + size_type n () const; /** * Matrix-vector @@ -160,7 +170,7 @@ private: * Number of rows and columns of * this matrix. */ - unsigned int size; + size_type size; }; @@ -179,7 +189,7 @@ IdentityMatrix::IdentityMatrix () inline -IdentityMatrix::IdentityMatrix (const unsigned int n) +IdentityMatrix::IdentityMatrix (const size_type n) : size (n) {} @@ -188,7 +198,7 @@ IdentityMatrix::IdentityMatrix (const unsigned int n) inline void -IdentityMatrix::reinit (const unsigned int n) +IdentityMatrix::reinit (const size_type n) { size = n; } @@ -196,7 +206,7 @@ IdentityMatrix::reinit (const unsigned int n) inline -unsigned int +IdentityMatrix::size_type IdentityMatrix::m () const { return size; @@ -205,7 +215,7 @@ IdentityMatrix::m () const inline -unsigned int +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 66c415e0e5..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 @@ -49,6 +54,11 @@ template <typename number> class LAPACKFullMatrix : public TransposeTable<number> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Initialize the * matrix as a square matrix with @@ -63,15 +73,15 @@ public: * By default, no memory is * allocated. */ - explicit LAPACKFullMatrix (const unsigned int n = 0); + explicit LAPACKFullMatrix (const size_type n = 0); /** * Constructor. Initialize the * matrix as a rectangular * matrix. */ - LAPACKFullMatrix (const unsigned int rows, - const unsigned int cols); + LAPACKFullMatrix (const size_type rows, + const size_type cols); /** * Copy constructor. This @@ -158,10 +168,10 @@ public: */ template<class MATRIX> void fill (const MATRIX &src, - const unsigned int dst_offset_i = 0, - const unsigned int dst_offset_j = 0, - const unsigned int src_offset_i = 0, - const unsigned int src_offset_j = 0, + const size_type dst_offset_i = 0, + const size_type dst_offset_j = 0, + const size_type src_offset_i = 0, + const size_type src_offset_j = 0, const number factor = 1., const bool transpose = false); @@ -526,7 +536,7 @@ public: * called. */ std::complex<number> - eigenvalue (const unsigned int i) const; + eigenvalue (const size_type i) const; /** * Retrieve singular values after @@ -535,7 +545,7 @@ public: * called. */ number - singular_value (const unsigned int i) const; + singular_value (const size_type i) const; /** * Print the matrix and allow @@ -709,11 +719,11 @@ LAPACKFullMatrix<number>::copy_from (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { 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(); } @@ -727,26 +737,26 @@ template <class MATRIX> inline void LAPACKFullMatrix<number>::fill ( const MATRIX &M, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j, + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j, const number factor, const bool transpose) { // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class - for (unsigned int row = src_offset_i; row < M.m(); ++row) + for (size_type row = src_offset_i; row < M.m(); ++row) { 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 unsigned int i = transpose ? entry->column() : row; - const unsigned int j = transpose ? row : entry->column(); + const size_type i = transpose ? entry->column() : row; + const size_type j = transpose ? row : entry->column(); - const unsigned int dst_i=dst_offset_i+i-src_offset_i; - const unsigned int dst_j=dst_offset_j+j-src_offset_j; + const size_type dst_i=dst_offset_i+i-src_offset_i; + const size_type dst_j=dst_offset_j+j-src_offset_j; if (dst_i<this->n_rows() && dst_j<this->n_cols()) (*this)(dst_i, dst_j) = factor * entry->value(); } @@ -794,7 +804,7 @@ LAPACKFullMatrix<number>::Tvmult_add(VECTOR &, const VECTOR &) const template <typename number> inline std::complex<number> -LAPACKFullMatrix<number>::eigenvalue (const unsigned int i) const +LAPACKFullMatrix<number>::eigenvalue (const size_type i) const { Assert (state & LAPACKSupport::eigenvalues, ExcInvalidState()); Assert (wr.size() == this->n_rows(), ExcInternalError()); @@ -807,7 +817,7 @@ LAPACKFullMatrix<number>::eigenvalue (const unsigned int i) const template <typename number> inline number -LAPACKFullMatrix<number>::singular_value (const unsigned int i) const +LAPACKFullMatrix<number>::singular_value (const size_type i) const { Assert (state == LAPACKSupport::svd || state == LAPACKSupport::inverse_svd, LAPACKSupport::ExcState(state)); AssertIndexRange(i,wr.size()); 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 e2eb43ef72..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 @@ -48,7 +53,7 @@ namespace internal * system. Using the add() functions of this class, it is possible to * use the standard assembling functions used for block matrices, but * only enter in one of the blocks and still avoiding the index - * computations innvolved. + * computations involved. * The reason for this class is, that we may need a different number * of matrices for different blocks in a block system. For example, a @@ -77,7 +82,7 @@ namespace internal * * BlockMatrixArray matrix (n_blocks, n_blocks); * - * for (unsigned int i=0;i<blocks.size;++i) + * for (size_type i=0;i<blocks.size;++i) * matrix.enter(blocks.block(i).row, blocks.block(i).column, blocks.matrix(i)); * @endcode * @@ -101,6 +106,11 @@ class MatrixBlock : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor rendering an * uninitialized object. @@ -118,12 +128,12 @@ public: * initializing the matrix. */ - MatrixBlock(unsigned int i, unsigned int j); + MatrixBlock(size_type i, size_type j); /** * Reinitialize the matrix for a * new BlockSparsityPattern. This - * adujusts the #matrix as well + * adjusts the #matrix as well * as the #row_indices and * #column_indices. * @@ -143,8 +153,8 @@ public: * exist or if it is in a * different block. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const typename MATRIX::value_type value); /** @@ -178,9 +188,9 @@ public: * into the matrix. */ template <typename number> - void add (const std::vector<unsigned int> &indices, - const FullMatrix<number> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &indices, + const FullMatrix<number> &full_matrix, + const bool elide_zero_values = true); /** * Add all elements in a @@ -212,8 +222,8 @@ public: * into the matrix. */ template <typename number> - void add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, + void add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<number> &full_matrix, const bool elide_zero_values = true); @@ -252,10 +262,10 @@ public: * into the matrix. */ template <typename number> - void add (const unsigned int row_index, - const std::vector<unsigned int> &col_indices, - const std::vector<number> &values, - const bool elide_zero_values = true); + void add (const size_type row_index, + const std::vector<size_type> &col_indices, + const std::vector<number> &values, + const bool elide_zero_values = true); /** * Add an array of values given by @@ -275,12 +285,12 @@ public: * into the matrix. */ template <typename number> - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Matrix-vector-multiplication, @@ -338,7 +348,7 @@ public: * the block coordinates stored * in this object. */ - DeclException2(ExcBlockIndexMismatch, unsigned int, unsigned int, + DeclException2(ExcBlockIndexMismatch, size_type, size_type, << "Block index " << arg1 << " does not match " << arg2); /** @@ -346,14 +356,14 @@ public: * position of the data member * matrix on the global matrix. */ - unsigned int row; + size_type row; /** * Column coordinate. This is * the position of the data * member matrix on the global * matrix. */ - unsigned int column; + size_type column; /** * The matrix itself @@ -397,6 +407,11 @@ class MatrixBlockVector private NamedData<std_cxx1x::shared_ptr<MatrixBlock<MATRIX> > > { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * The type of object stored. */ @@ -407,7 +422,7 @@ public: * position <tt>(row,column)</tt> * in the block system. */ - void add(unsigned int row, unsigned int column, const std::string &name); + void add(size_type row, size_type column, const std::string &name); /** * For matrices using a @@ -446,20 +461,20 @@ public: * Access a constant reference to * the block at position <i>i</i>. */ - const value_type &block(unsigned int i) const; + const value_type &block(size_type i) const; /** * Access a reference to * the block at position <i>i</i>. */ - value_type &block(unsigned int i); + value_type &block(size_type i); /** * Access the matrix at position * <i>i</i> for read and write * access. */ - MATRIX &matrix(unsigned int i); + MATRIX &matrix(size_type i); /** * import functions from private base class @@ -485,6 +500,11 @@ class MGMatrixBlockVector : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * The type of object stored. */ @@ -520,8 +540,7 @@ public: * matrix a name for later * identification. */ - void add(unsigned int row, unsigned int column, - const std::string &name); + void add(size_type row, size_type column, const std::string &name); /** * For matrices using a @@ -582,61 +601,61 @@ public: * Access a constant reference to * the matrix block at position <i>i</i>. */ - const value_type &block(unsigned int i) const; + const value_type &block(size_type i) const; /** * Access a reference to * the matrix block at position <i>i</i>. */ - value_type &block(unsigned int i); + value_type &block(size_type i); /** * Access a constant reference to * the edge matrix block at position <i>i</i>. */ - const value_type &block_in(unsigned int i) const; + const value_type &block_in(size_type i) const; /** * Access a reference to * the edge matrix block at position <i>i</i>. */ - value_type &block_in(unsigned int i); + value_type &block_in(size_type i); /** * Access a constant reference to * the edge matrix block at position <i>i</i>. */ - const value_type &block_out(unsigned int i) const; + const value_type &block_out(size_type i) const; /** * Access a reference to * the edge matrix block at position <i>i</i>. */ - value_type &block_out(unsigned int i); + value_type &block_out(size_type i); /** * Access a constant reference to * the edge flux matrix block at position <i>i</i>. */ - const value_type &block_up(unsigned int i) const; + const value_type &block_up(size_type i) const; /** * Access a reference to * the edge flux matrix block at position <i>i</i>. */ - value_type &block_up(unsigned int i); + value_type &block_up(size_type i); /** * Access a constant reference to * the edge flux matrix block at position <i>i</i>. */ - const value_type &block_down(unsigned int i) const; + const value_type &block_down(size_type i) const; /** * Access a reference to * the edge flux matrix block at position <i>i</i>. */ - value_type &block_down(unsigned int i); + value_type &block_down(size_type i); /** * The memory used by this object. @@ -693,8 +712,8 @@ template <class MATRIX> inline MatrixBlock<MATRIX>::MatrixBlock() : - row(deal_II_numbers::invalid_unsigned_int), - column(deal_II_numbers::invalid_unsigned_int) + row(deal_II_numbers::invalid_size_type), + column(deal_II_numbers::invalid_size_type) {} @@ -713,7 +732,7 @@ MatrixBlock<MATRIX>::MatrixBlock(const MatrixBlock<MATRIX> &M) template <class MATRIX> inline -MatrixBlock<MATRIX>::MatrixBlock(unsigned int i, unsigned int j) +MatrixBlock<MATRIX>::MatrixBlock(size_type i, size_type j) : row(i), column(j) {} @@ -747,16 +766,16 @@ MatrixBlock<MATRIX>::operator const MATRIX &() const template <class MATRIX> inline void MatrixBlock<MATRIX>::add ( - const unsigned int gi, - const unsigned int gj, + const size_type gi, + const size_type gj, const typename MATRIX::value_type value) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); - const std::pair<unsigned int, unsigned int> bi + const std::pair<unsigned int, size_type> bi = row_indices.global_to_local(gi); - const std::pair<unsigned int, unsigned int> bj + const std::pair<unsigned int, size_type> bj = column_indices.global_to_local(gj); Assert (bi.first == row, ExcBlockIndexMismatch(bi.first, row)); @@ -770,10 +789,10 @@ template <class MATRIX> template <typename number> inline void -MatrixBlock<MATRIX>::add (const std::vector<unsigned int> &r_indices, - const std::vector<unsigned int> &c_indices, - const FullMatrix<number> &values, - const bool elide_zero_values) +MatrixBlock<MATRIX>::add (const std::vector<size_type> &r_indices, + const std::vector<size_type> &c_indices, + const FullMatrix<number> &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -781,7 +800,7 @@ MatrixBlock<MATRIX>::add (const std::vector<unsigned int> &r_indices, AssertDimension (r_indices.size(), values.m()); AssertDimension (c_indices.size(), values.n()); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) add (r_indices[i], c_indices.size(), &c_indices[0], &values(i,0), elide_zero_values); } @@ -791,17 +810,17 @@ template <class MATRIX> template <typename number> inline void -MatrixBlock<MATRIX>::add (const unsigned int b_row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, +MatrixBlock<MATRIX>::add (const size_type b_row, + const size_type n_cols, + const size_type *col_indices, + const number *values, const bool, const bool) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); - const std::pair<unsigned int, unsigned int> bi + const std::pair<unsigned int, size_type> bi = row_indices.global_to_local(b_row); // In debug mode, we check whether @@ -815,9 +834,9 @@ MatrixBlock<MATRIX>::add (const unsigned int b_row, //#ifdef DEBUG Assert(bi.first == row, ExcBlockIndexMismatch(bi.first, row)); - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { - const std::pair<unsigned int, unsigned int> bj + const std::pair<unsigned int, size_type> bj = column_indices.global_to_local(col_indices[j]); Assert(bj.first == column, ExcBlockIndexMismatch(bj.first, column)); @@ -831,9 +850,9 @@ template <class MATRIX> template <typename number> inline void -MatrixBlock<MATRIX>::add (const std::vector<unsigned int> &indices, - const FullMatrix<number> &values, - const bool elide_zero_values) +MatrixBlock<MATRIX>::add (const std::vector<size_type> &indices, + const FullMatrix<number> &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -841,7 +860,7 @@ MatrixBlock<MATRIX>::add (const std::vector<unsigned int> &indices, AssertDimension (indices.size(), values.m()); Assert (values.n() == values.m(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) add (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -852,10 +871,10 @@ template <class MATRIX> template <typename number> inline void -MatrixBlock<MATRIX>::add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number> &values, - const bool elide_zero_values) +MatrixBlock<MATRIX>::add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number> &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -921,7 +940,7 @@ MatrixBlock<MATRIX>::memory_consumption () const template <class MATRIX> inline void MatrixBlockVector<MATRIX>::add( - unsigned int row, unsigned int column, + size_type row, size_type column, const std::string &name) { std_cxx1x::shared_ptr<value_type> p(new value_type(row, column)); @@ -933,7 +952,7 @@ template <class MATRIX> inline void MatrixBlockVector<MATRIX>::reinit(const BlockSparsityPattern &sparsity) { - for (unsigned int i=0; i<this->size(); ++i) + for (size_type i=0; i<this->size(); ++i) { block(i).reinit(sparsity); } @@ -950,7 +969,7 @@ MatrixBlockVector<MATRIX>::clear(bool really_clean) } else { - for (unsigned int i=0; i<this->size(); ++i) + for (size_type i=0; i<this->size(); ++i) matrix(i).clear(); } } @@ -959,7 +978,7 @@ MatrixBlockVector<MATRIX>::clear(bool really_clean) template <class MATRIX> inline const MatrixBlock<MATRIX> & -MatrixBlockVector<MATRIX>::block(unsigned int i) const +MatrixBlockVector<MATRIX>::block(size_type i) const { return *this->read(i); } @@ -967,7 +986,7 @@ MatrixBlockVector<MATRIX>::block(unsigned int i) const template <class MATRIX> inline MatrixBlock<MATRIX> & -MatrixBlockVector<MATRIX>::block(unsigned int i) +MatrixBlockVector<MATRIX>::block(size_type i) { return *(*this)(i); } @@ -975,7 +994,7 @@ MatrixBlockVector<MATRIX>::block(unsigned int i) template <class MATRIX> inline MATRIX & -MatrixBlockVector<MATRIX>::matrix(unsigned int i) +MatrixBlockVector<MATRIX>::matrix(size_type i) { return (*this)(i)->matrix; } @@ -1006,7 +1025,7 @@ MGMatrixBlockVector<MATRIX>::size () const template <class MATRIX> inline void MGMatrixBlockVector<MATRIX>::add( - unsigned int row, unsigned int column, + size_type row, size_type column, const std::string &name) { MGLevelObject<MatrixBlock<MATRIX> > p(0, 1); @@ -1029,7 +1048,7 @@ MGMatrixBlockVector<MATRIX>::add( template <class MATRIX> inline const MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block(unsigned int i) const +MGMatrixBlockVector<MATRIX>::block(size_type i) const { return matrices.read(i); } @@ -1037,7 +1056,7 @@ MGMatrixBlockVector<MATRIX>::block(unsigned int i) const template <class MATRIX> inline MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block(unsigned int i) +MGMatrixBlockVector<MATRIX>::block(size_type i) { return matrices(i); } @@ -1045,7 +1064,7 @@ MGMatrixBlockVector<MATRIX>::block(unsigned int i) template <class MATRIX> inline const MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_in(unsigned int i) const +MGMatrixBlockVector<MATRIX>::block_in(size_type i) const { return matrices_in.read(i); } @@ -1053,7 +1072,7 @@ MGMatrixBlockVector<MATRIX>::block_in(unsigned int i) const template <class MATRIX> inline MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_in(unsigned int i) +MGMatrixBlockVector<MATRIX>::block_in(size_type i) { return matrices_in(i); } @@ -1061,7 +1080,7 @@ MGMatrixBlockVector<MATRIX>::block_in(unsigned int i) template <class MATRIX> inline const MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_out(unsigned int i) const +MGMatrixBlockVector<MATRIX>::block_out(size_type i) const { return matrices_out.read(i); } @@ -1069,7 +1088,7 @@ MGMatrixBlockVector<MATRIX>::block_out(unsigned int i) const template <class MATRIX> inline MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_out(unsigned int i) +MGMatrixBlockVector<MATRIX>::block_out(size_type i) { return matrices_out(i); } @@ -1077,7 +1096,7 @@ MGMatrixBlockVector<MATRIX>::block_out(unsigned int i) template <class MATRIX> inline const MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_up(unsigned int i) const +MGMatrixBlockVector<MATRIX>::block_up(size_type i) const { return flux_matrices_up.read(i); } @@ -1085,7 +1104,7 @@ MGMatrixBlockVector<MATRIX>::block_up(unsigned int i) const template <class MATRIX> inline MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_up(unsigned int i) +MGMatrixBlockVector<MATRIX>::block_up(size_type i) { return flux_matrices_up(i); } @@ -1093,7 +1112,7 @@ MGMatrixBlockVector<MATRIX>::block_up(unsigned int i) template <class MATRIX> inline const MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_down(unsigned int i) const +MGMatrixBlockVector<MATRIX>::block_down(size_type i) const { return flux_matrices_down.read(i); } @@ -1101,7 +1120,7 @@ MGMatrixBlockVector<MATRIX>::block_down(unsigned int i) const template <class MATRIX> inline MGLevelObject<MatrixBlock<MATRIX> > & -MGMatrixBlockVector<MATRIX>::block_down(unsigned int i) +MGMatrixBlockVector<MATRIX>::block_down(size_type i) { return flux_matrices_down(i); } @@ -1111,14 +1130,14 @@ template <class MATRIX> inline void MGMatrixBlockVector<MATRIX>::reinit_matrix(const MGLevelObject<BlockSparsityPattern> &sparsity) { - for (unsigned int i=0; i<this->size(); ++i) + for (size_type i=0; i<this->size(); ++i) { MGLevelObject<MatrixBlock<MATRIX> > &o = block(i); - const unsigned int row = o[o.min_level()].row; - const unsigned int col = o[o.min_level()].column; + const size_type row = o[o.min_level()].row; + const size_type col = o[o.min_level()].column; o.resize(sparsity.min_level(), sparsity.max_level()); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) { o[level].row = row; o[level].column = col; @@ -1132,15 +1151,15 @@ template <class MATRIX> inline void MGMatrixBlockVector<MATRIX>::reinit_edge(const MGLevelObject<BlockSparsityPattern> &sparsity) { - for (unsigned int i=0; i<this->size(); ++i) + for (size_type i=0; i<this->size(); ++i) { MGLevelObject<MatrixBlock<MATRIX> > &o = block(i); - const unsigned int row = o[o.min_level()].row; - const unsigned int col = o[o.min_level()].column; + const size_type row = o[o.min_level()].row; + const size_type col = o[o.min_level()].column; block_in(i).resize(sparsity.min_level(), sparsity.max_level()); block_out(i).resize(sparsity.min_level(), sparsity.max_level()); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) { block_in(i)[level].row = row; block_in(i)[level].column = col; @@ -1157,15 +1176,15 @@ template <class MATRIX> inline void MGMatrixBlockVector<MATRIX>::reinit_edge_flux(const MGLevelObject<BlockSparsityPattern> &sparsity) { - for (unsigned int i=0; i<this->size(); ++i) + for (size_type i=0; i<this->size(); ++i) { MGLevelObject<MatrixBlock<MATRIX> > &o = block(i); - const unsigned int row = o[o.min_level()].row; - const unsigned int col = o[o.min_level()].column; + const size_type row = o[o.min_level()].row; + const size_type col = o[o.min_level()].column; block_up(i).resize(sparsity.min_level(), sparsity.max_level()); block_down(i).resize(sparsity.min_level(), sparsity.max_level()); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) { block_up(i)[level].row = row; block_up(i)[level].column = col; @@ -1183,10 +1202,10 @@ template <class MATRIX> inline void MGMatrixBlockVector<MATRIX>::clear_object(NamedData<MGLevelObject<MatrixBlock<MATRIX> > > &mo) { - for (unsigned int i=0; i<mo.size(); ++i) + for (size_type i=0; i<mo.size(); ++i) { MGLevelObject<MatrixBlock<MATRIX> > &o = mo(i); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) o[level].matrix.clear(); } } diff --git a/deal.II/include/deal.II/lac/matrix_iterator.h b/deal.II/include/deal.II/lac/matrix_iterator.h index 03e67432cd..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 @@ -33,6 +38,11 @@ template <class ACCESSOR> class MatrixIterator { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Typedef for the matrix type * (including constness) we are to @@ -47,9 +57,9 @@ public: * <tt>row</tt> and the * <tt>index</tt> within it. */ - MatrixIterator (MatrixType *matrix, - const unsigned int row = 0, - const unsigned int index = 0); + MatrixIterator (MatrixType *matrix, + const size_type row = 0, + const size_type index = 0); /** * Copy from another matrix @@ -136,9 +146,9 @@ private: template <class ACCESSOR> inline MatrixIterator<ACCESSOR>:: -MatrixIterator (MatrixType *matrix, - const unsigned int r, - const unsigned int i) +MatrixIterator (MatrixType *matrix, + const size_type r, + const size_type i) : accessor(matrix, r, i) {} diff --git a/deal.II/include/deal.II/lac/matrix_lib.h b/deal.II/include/deal.II/lac/matrix_lib.h index 1990056b09..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 @@ -326,11 +331,16 @@ private: class MeanValueFilter : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor, optionally * selecting a component. */ - MeanValueFilter(unsigned int component = numbers::invalid_unsigned_int); + MeanValueFilter(size_type component = numbers::invalid_size_type); /** * Subtract mean value from @p v. @@ -395,7 +405,7 @@ private: /** * Component for filtering block vectors. */ - unsigned int component; + size_type component; }; 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 63fd1d83c8..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 @@ -24,7 +29,7 @@ MeanValueFilter::filter(Vector<number> &v) const { number mean = v.mean_value(); - for (unsigned int i=0; i<v.size(); ++i) + for (size_type i=0; i<v.size(); ++i) v(i) -= mean; } @@ -40,7 +45,7 @@ MeanValueFilter::vmult(Vector<number> &dst, number mean = src.mean_value(); - for (unsigned int i=0; i<dst.size(); ++i) + for (size_type i=0; i<dst.size(); ++i) dst(i) = src(i) - mean; } @@ -56,7 +61,7 @@ MeanValueFilter::vmult_add(Vector<number> &dst, number mean = src.mean_value(); - for (unsigned int i=0; i<dst.size(); ++i) + for (size_type i=0; i<dst.size(); ++i) dst(i) += src(i) - mean; } diff --git a/deal.II/include/deal.II/lac/matrix_out.h b/deal.II/include/deal.II/lac/matrix_out.h index 7284f9b0f1..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 @@ -88,6 +93,11 @@ DEAL_II_NAMESPACE_OPEN class MatrixOut : public DataOutInterface<2,2> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Class holding various * variables which are used to @@ -124,7 +134,7 @@ public: * * Default value is one. */ - unsigned int block_size; + size_type block_size; /** * If true, plot @@ -139,9 +149,9 @@ public: * structure to their default * values. */ - Options (const bool show_absolute_values = false, - const unsigned int block_size = 1, - const bool discontinuous = false); + Options (const bool show_absolute_values = false, + const size_type block_size = 1, + const bool discontinuous = false); }; /** @@ -250,8 +260,8 @@ private: */ template <typename number> static double get_element (const SparseMatrix<number> &matrix, - const unsigned int i, - const unsigned int j); + const size_type i, + const size_type j); /** * Return the element with given @@ -260,8 +270,8 @@ private: */ template <typename number> static double get_element (const BlockSparseMatrix<number> &matrix, - const unsigned int i, - const unsigned int j); + const size_type i, + const size_type j); /** * Return the element with given @@ -273,8 +283,8 @@ private: */ template <class Matrix> static double get_element (const Matrix &matrix, - const unsigned int i, - const unsigned int j); + const size_type i, + const size_type j); /** * Get the value of the matrix at @@ -291,8 +301,8 @@ private: */ template <class Matrix> static double get_gridpoint_value (const Matrix &matrix, - const unsigned int i, - const unsigned int j, + const size_type i, + const size_type j, const Options &options); }; @@ -304,8 +314,8 @@ template <typename number> inline double MatrixOut::get_element (const SparseMatrix<number> &matrix, - const unsigned int i, - const unsigned int j) + const size_type i, + const size_type j) { return matrix.el(i,j); } @@ -317,8 +327,8 @@ template <typename number> inline double MatrixOut::get_element (const BlockSparseMatrix<number> &matrix, - const unsigned int i, - const unsigned int j) + const size_type i, + const size_type j) { return matrix.el(i,j); } @@ -329,9 +339,9 @@ MatrixOut::get_element (const BlockSparseMatrix<number> &matrix, template <class Matrix> inline double -MatrixOut::get_element (const Matrix &matrix, - const unsigned int i, - const unsigned int j) +MatrixOut::get_element (const Matrix &matrix, + const size_type i, + const size_type j) { return matrix(i,j); } @@ -341,10 +351,10 @@ MatrixOut::get_element (const Matrix &matrix, template <class Matrix> inline double -MatrixOut::get_gridpoint_value (const Matrix &matrix, - const unsigned int i, - const unsigned int j, - const Options &options) +MatrixOut::get_gridpoint_value (const Matrix &matrix, + const size_type i, + const size_type j, + const Options &options) { // special case if block size is // one since we then don't need all @@ -360,10 +370,10 @@ MatrixOut::get_gridpoint_value (const Matrix &matrix, // if blocksize greater than one, // then compute average of elements double average = 0; - unsigned int n_elements = 0; - for (unsigned int row=i*options.block_size; + size_type n_elements = 0; + for (size_type row=i*options.block_size; row < std::min(matrix.m(), (i+1)*options.block_size); ++row) - for (unsigned int col=j*options.block_size; + for (size_type col=j*options.block_size; col < std::min(matrix.m(), (j+1)*options.block_size); ++col, ++n_elements) if (options.show_absolute_values == true) average += std::fabs(get_element (matrix, row, col)); @@ -381,7 +391,7 @@ MatrixOut::build_patches (const Matrix &matrix, const std::string &name, const Options options) { - unsigned int + size_type gridpoints_x = (matrix.n() / options.block_size + (matrix.n() % options.block_size != 0 ? 1 : 0)), @@ -403,9 +413,9 @@ MatrixOut::build_patches (const Matrix &matrix, patches.resize ((gridpoints_x) * (gridpoints_y)); // now build the patches - unsigned int index=0; - for (unsigned int i=0; i<gridpoints_y; ++i) - for (unsigned int j=0; j<gridpoints_x; ++j, ++index) + size_type index=0; + for (size_type i=0; i<gridpoints_y; ++i) + for (size_type j=0; j<gridpoints_x; ++j, ++index) { // within each patch, order // the points in such a way 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 63b2395979..d0f5387851 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 @@ -86,8 +91,8 @@ namespace parallel * Confer the other constructor further down if you intend to use * blocks of different sizes. */ - explicit BlockVector (const unsigned int num_blocks = 0, - const unsigned int block_size = 0); + explicit BlockVector (const size_type num_blocks = 0, + const size_type block_size = 0); /** * Copy-Constructor. Dimension set to that of V, all components are @@ -118,7 +123,7 @@ namespace parallel * Constructor. Set the number of blocks to <tt>block_sizes.size()</tt> * and initialize each block with <tt>block_sizes[i]</tt> zero elements. */ - BlockVector (const std::vector<unsigned int> &block_sizes); + BlockVector (const std::vector<size_type> &block_sizes); /** * Destructor. Clears memory. @@ -164,8 +169,8 @@ namespace parallel * * If <tt>fast==false</tt>, the vector is filled with zeros. */ - void reinit (const unsigned int num_blocks, - const unsigned int block_size = 0, + void reinit (const size_type num_blocks, + const size_type block_size = 0, const bool fast = false); /** @@ -186,8 +191,8 @@ namespace parallel * actions on this object may yield unpredictable results since they may * be routed to the wrong block. */ - void reinit (const std::vector<unsigned int> &N, - const bool fast=false); + void reinit (const std::vector<size_type> &N, + const bool fast=false); /** * Change the dimension to that of the vector <tt>V</tt>. The same @@ -335,8 +340,8 @@ namespace parallel template <typename Number> inline - BlockVector<Number>::BlockVector (const unsigned int n_blocks, - const unsigned int block_size) + BlockVector<Number>::BlockVector (const size_type n_blocks, + const size_type block_size) { reinit (n_blocks, block_size); } @@ -345,7 +350,7 @@ namespace parallel template <typename Number> inline - BlockVector<Number>::BlockVector (const std::vector<unsigned int> &n) + BlockVector<Number>::BlockVector (const std::vector<size_type> &n) { reinit (n, false); } @@ -361,7 +366,7 @@ namespace parallel this->components.resize (v.n_blocks()); this->block_indices = v.block_indices; - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.components[i]; } @@ -383,25 +388,25 @@ namespace parallel template <typename Number> inline - void BlockVector<Number>::reinit (const unsigned int n_bl, - const unsigned int bl_sz, + void BlockVector<Number>::reinit (const size_type n_bl, + const size_type bl_sz, const bool fast) { - std::vector<unsigned int> n(n_bl, bl_sz); + std::vector<size_type> n(n_bl, bl_sz); reinit(n, fast); } template <typename Number> inline - void BlockVector<Number>::reinit (const std::vector<unsigned int> &n, - const bool fast) + void BlockVector<Number>::reinit (const std::vector<size_type> &n, + const bool fast) { this->block_indices.reinit (n); if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].reinit(n[i], fast); } @@ -617,7 +622,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(); } @@ -702,7 +707,7 @@ namespace parallel Assert (this->n_blocks() == v.n_blocks(), ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) dealii::swap (this->components[i], v.components[i]); dealii::swap (this->block_indices, v.block_indices); } @@ -715,7 +720,7 @@ namespace parallel Assert (numbers::is_finite(factor), ExcNumberNotFinite()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i].scale(factor); } diff --git a/deal.II/include/deal.II/lac/parallel_vector.h b/deal.II/include/deal.II/lac/parallel_vector.h index 29d0b864b6..613fb61ab4 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 @@ -97,7 +101,7 @@ namespace parallel typedef const value_type *const_iterator; typedef value_type &reference; typedef const value_type &const_reference; - typedef size_t size_type; + typedef types::global_dof_index size_type; typedef typename numbers::NumberTraits<Number>::real_type real_type; /** @@ -131,7 +135,7 @@ namespace parallel * Constructs a parallel vector of the given global size without any * actual parallel distribution. */ - Vector (const unsigned int size); + Vector (const size_type size); /** * Constructs a parallel vector. The local range is specified by @p @@ -167,8 +171,8 @@ namespace parallel * Sets the global size of the vector to @p size without any actual * parallel distribution. */ - void reinit (const unsigned int size, - const bool fast = false); + void reinit (const size_type size, + const bool fast = false); /** * Uses the parallel layout of the input vector @p in_vector and @@ -437,26 +441,26 @@ namespace parallel * Returns the global size of the vector, equal to the sum of the number * of locally owned indices among all the processors. */ - types::global_dof_index size () const; + size_type size () const; /** * Returns the local size of the vector, i.e., the number of indices * owned locally. */ - unsigned int local_size() const; + size_type local_size() const; /** * Returns the half-open interval that specifies the locally owned range * of the vector. Note that <code>local_size() == local_range().second - * local_range().first</code>. */ - std::pair<types::global_dof_index, types::global_dof_index> local_range () const; + std::pair<size_type, size_type> local_range () const; /** * Returns true if the given global index is in the local range of this * processor. */ - bool in_local_range (const types::global_dof_index global_index) const; + bool in_local_range (const size_type global_index) const; /** * Return an index set that describes which elements of this vector @@ -477,7 +481,14 @@ namespace parallel /** * Returns the number of ghost elements present on the vector. */ - unsigned int n_ghost_entries () const; + size_type n_ghost_entries () const; + + /** + * Return an index set that describes which elements of this vector are + * not owned by the current processor but can be written into or read + * from locally (ghost elements). + */ + const IndexSet &ghost_elements() const; /** * Returns whether the given global index is a ghost index on the @@ -529,7 +540,7 @@ namespace parallel * a contiguous range and <tt>O(log(n<sub>ranges</sub>))</tt> for ghost * elements (quite fast, but slower than local_element()). */ - Number operator () (const types::global_dof_index global_index) const; + Number operator () (const size_type global_index) const; /** * Read and write access to the data in the position corresponding to @p @@ -540,7 +551,7 @@ namespace parallel * a contiguous range and <tt>O(log(n<sub>ranges</sub>))</tt> for ghost * elements (quite fast, but slower than local_element()). */ - Number &operator () (const types::global_dof_index global_index); + Number &operator () (const size_type global_index); /** * Read access to the data in the position corresponding to @p @@ -549,7 +560,7 @@ namespace parallel * * This function does the same thing as operator(). */ - Number operator [] (const types::global_dof_index global_index) const; + Number operator [] (const size_type global_index) const; /** * Read and write access to the data in the position corresponding to @p @@ -558,7 +569,7 @@ namespace parallel * * This function does the same thing as operator(). */ - Number &operator [] (const types::global_dof_index global_index); + Number &operator [] (const size_type global_index); /** * Read access to the data field specified by @p local_index. Locally @@ -568,7 +579,7 @@ namespace parallel * * Performance: Direct array access (fast). */ - Number local_element (const unsigned int local_index) const; + Number local_element (const size_type local_index) const; /** * Read and write access to the data field specified by @p @@ -578,7 +589,7 @@ namespace parallel * * Performance: Direct array access (fast). */ - Number &local_element (const unsigned int local_index); + Number &local_element (const size_type local_index); //@} @@ -602,7 +613,7 @@ namespace parallel * stored in @p values to the vector components specified by @p indices. */ template <typename OtherNumber> - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const std::vector<OtherNumber> &values); /** @@ -610,7 +621,7 @@ namespace parallel * function takes a deal.II vector of values. */ template <typename OtherNumber> - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const ::dealii::Vector<OtherNumber> &values); /** @@ -619,8 +630,8 @@ namespace parallel * the other two <tt>add()</tt> functions above. */ template <typename OtherNumber> - void add (const unsigned int n_elements, - const unsigned int *indices, + void add (const size_type n_elements, + const size_type *indices, const OtherNumber *values); /** @@ -763,7 +774,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 @@ -849,7 +860,7 @@ namespace parallel /** * The size that is currently allocated in the val array. */ - unsigned int allocated_size; + size_type allocated_size; /** * Pointer to the array of local elements of this vector. @@ -903,7 +914,7 @@ namespace parallel /** * A helper function that is used to resize the val array. */ - void resize_val (const unsigned int new_allocated_size); + void resize_val (const size_type new_allocated_size); /* * Make all other vector types friends. @@ -970,7 +981,7 @@ namespace parallel template <typename Number> inline - Vector<Number>::Vector (const unsigned int size) + Vector<Number>::Vector (const size_type size) : allocated_size (0), val (0), @@ -1030,8 +1041,8 @@ namespace parallel reinit (c, true); else if (partitioner.get() != c.partitioner.get()) { - unsigned int local_ranges_different_loc = (local_range() != - c.local_range()); + size_type local_ranges_different_loc = (local_range() != + c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, partitioner->get_communicator()) != 0) @@ -1062,8 +1073,8 @@ namespace parallel reinit (c, true); else if (partitioner.get() != c.partitioner.get()) { - unsigned int local_ranges_different_loc = (local_range() != - c.local_range()); + size_type local_ranges_different_loc = (local_range() != + c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, partitioner->get_communicator()) != 0) @@ -1198,8 +1209,8 @@ namespace parallel Vector<Number>::vectors_equal_local (const Vector<Number2> &v) const { return partitioner->local_size()>0 ? - vector_view.template operator == <Number2>(v.vector_view) - : true; + vector_view.template operator == <Number2>(v.vector_view) + : true; } @@ -1314,7 +1325,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; } @@ -1409,7 +1420,8 @@ namespace parallel template <typename Number> inline - types::global_dof_index Vector<Number>::size () const + typename Vector<Number>::size_type + Vector<Number>::size () const { return partitioner->size(); } @@ -1418,7 +1430,8 @@ namespace parallel template <typename Number> inline - unsigned int Vector<Number>::local_size () const + typename Vector<Number>::size_type + Vector<Number>::local_size () const { return partitioner->local_size(); } @@ -1427,8 +1440,9 @@ namespace parallel template <typename Number> inline - std::pair<types::global_dof_index, types::global_dof_index> - Vector<Number>::local_range () const + std::pair<typename Vector<Number>::size_type, + typename Vector<Number>::size_type> + Vector<Number>::local_range () const { return partitioner->local_range(); } @@ -1439,12 +1453,13 @@ namespace parallel inline bool Vector<Number>::in_local_range - (const types::global_dof_index global_index) const + (const size_type global_index) const { return partitioner->in_local_range (global_index); } + template <typename Number> inline IndexSet @@ -1462,7 +1477,7 @@ namespace parallel template <typename Number> inline - unsigned int + typename Vector<Number>::size_type Vector<Number>::n_ghost_entries () const { return partitioner->n_ghost_indices(); @@ -1470,10 +1485,20 @@ namespace parallel + template <typename Number> + inline + const IndexSet & + Vector<Number>::ghost_elements() const + { + return partitioner->ghost_indices(); + } + + + template <typename Number> inline bool - Vector<Number>::is_ghost_entry (const types::global_dof_index global_index) const + Vector<Number>::is_ghost_entry (const size_type global_index) const { return partitioner->is_ghost_entry (global_index); } @@ -1523,7 +1548,7 @@ namespace parallel template <typename Number> inline Number - Vector<Number>::operator() (const types::global_dof_index global_index) const + Vector<Number>::operator() (const size_type global_index) const { return val[partitioner->global_to_local(global_index)]; } @@ -1533,7 +1558,7 @@ namespace parallel template <typename Number> inline Number & - Vector<Number>::operator() (const types::global_dof_index global_index) + Vector<Number>::operator() (const size_type global_index) { return val[partitioner->global_to_local (global_index)]; } @@ -1543,7 +1568,7 @@ namespace parallel template <typename Number> inline Number - Vector<Number>::operator[] (const types::global_dof_index global_index) const + Vector<Number>::operator[] (const size_type global_index) const { return operator()(global_index); } @@ -1553,7 +1578,7 @@ namespace parallel template <typename Number> inline Number & - Vector<Number>::operator[] (const types::global_dof_index global_index) + Vector<Number>::operator[] (const size_type global_index) { return operator()(global_index); } @@ -1563,7 +1588,7 @@ namespace parallel template <typename Number> inline Number - Vector<Number>::local_element (const unsigned int local_index) const + Vector<Number>::local_element (const size_type local_index) const { AssertIndexRange (local_index, partitioner->local_size()+ @@ -1576,7 +1601,7 @@ namespace parallel template <typename Number> inline Number & - Vector<Number>::local_element (const unsigned int local_index) + Vector<Number>::local_element (const size_type local_index) { AssertIndexRange (local_index, partitioner->local_size()+ @@ -1639,7 +1664,7 @@ namespace parallel template <typename OtherNumber> inline void - Vector<Number>::add (const std::vector<unsigned int> &indices, + Vector<Number>::add (const std::vector<size_type> &indices, const std::vector<OtherNumber> &values) { AssertDimension (indices.size(), values.size()); @@ -1652,7 +1677,7 @@ namespace parallel template <typename OtherNumber> inline void - Vector<Number>::add (const std::vector<unsigned int> &indices, + Vector<Number>::add (const std::vector<size_type> &indices, const ::dealii::Vector<OtherNumber> &values) { AssertDimension (indices.size(), values.size()); @@ -1665,11 +1690,11 @@ namespace parallel template <typename OtherNumber> inline void - Vector<Number>::add (const unsigned int n_indices, - const unsigned int *indices, + Vector<Number>::add (const size_type n_indices, + const size_type *indices, const OtherNumber *values) { - for (unsigned int i=0; i<n_indices; ++i) + for (size_type i=0; i<n_indices; ++i) { Assert (numbers::is_finite(values[i]), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); @@ -1983,7 +2008,7 @@ namespace parallel template <typename Number> inline - const MPI_Comm& + const MPI_Comm & Vector<Number>::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 d71c786ea6..23f0734d03 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 @@ -29,10 +34,10 @@ namespace parallel Vector<Number>::clear_mpi_requests () { #ifdef DEAL_II_WITH_MPI - for (unsigned int j=0; j<compress_requests.size(); j++) + for (size_type j=0; j<compress_requests.size(); j++) MPI_Request_free(&compress_requests[j]); compress_requests.clear(); - for (unsigned int j=0; j<update_ghost_values_requests.size(); j++) + for (size_type j=0; j<update_ghost_values_requests.size(); j++) MPI_Request_free(&update_ghost_values_requests[j]); update_ghost_values_requests.clear(); #endif @@ -42,7 +47,7 @@ namespace parallel template <typename Number> void - Vector<Number>::resize_val (const unsigned int new_alloc_size) + Vector<Number>::resize_val (const size_type new_alloc_size) { if (new_alloc_size > allocated_size) { @@ -66,8 +71,8 @@ namespace parallel template <typename Number> void - Vector<Number>::reinit (const unsigned int size, - const bool fast) + Vector<Number>::reinit (const size_type size, + const bool fast) { clear_mpi_requests(); // check whether we need to reallocate @@ -107,8 +112,8 @@ namespace parallel if (partitioner.get() != v.partitioner.get()) { partitioner = v.partitioner; - const unsigned int new_allocated_size = partitioner->local_size() + - partitioner->n_ghost_indices(); + const size_type new_allocated_size = partitioner->local_size() + + partitioner->n_ghost_indices(); resize_val (new_allocated_size); vector_view.reinit (partitioner->local_size(), val); } @@ -157,8 +162,8 @@ namespace parallel partitioner = partitioner_in; // set vector size and allocate memory - const unsigned int new_allocated_size = partitioner->local_size() + - partitioner->n_ghost_indices(); + const size_type new_allocated_size = partitioner->local_size() + + partitioner->n_ghost_indices(); resize_val (new_allocated_size); vector_view.reinit (partitioner->local_size(), val); @@ -204,7 +209,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; @@ -220,8 +227,8 @@ namespace parallel // make this function thread safe Threads::Mutex::ScopedLock lock (mutex); - const unsigned int n_import_targets = part.import_targets().size(); - const unsigned int n_ghost_targets = part.ghost_targets().size(); + const size_type n_import_targets = part.import_targets().size(); + const size_type n_ghost_targets = part.ghost_targets().size(); // Need to send and receive the data. Use // non-blocking communication, where it is @@ -239,7 +246,7 @@ namespace parallel // up yet if (import_data == 0) import_data = new Number[part.n_import_indices()]; - for (unsigned int i=0; i<n_import_targets; i++) + for (size_type i=0; i<n_import_targets; i++) { MPI_Recv_init (&import_data[current_index_start], part.import_targets()[i].second*sizeof(Number), @@ -255,7 +262,7 @@ namespace parallel Assert (part.local_size() == vector_view.size(), ExcInternalError()); current_index_start = part.local_size(); - for (unsigned int i=0; i<n_ghost_targets; i++) + for (size_type i=0; i<n_ghost_targets; i++) { MPI_Send_init (&this->val[current_index_start], part.ghost_targets()[i].second*sizeof(Number), @@ -295,6 +302,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 @@ -305,8 +322,8 @@ namespace parallel // make this function thread safe Threads::Mutex::ScopedLock lock (mutex); - const unsigned int n_import_targets = part.import_targets().size(); - const unsigned int n_ghost_targets = part.ghost_targets().size(); + const size_type n_import_targets = part.import_targets().size(); + const size_type n_ghost_targets = part.ghost_targets().size(); if (operation != dealii::VectorOperation::insert) AssertDimension (n_ghost_targets+n_import_targets, @@ -321,7 +338,7 @@ namespace parallel Assert (ierr == MPI_SUCCESS, ExcInternalError()); Number *read_position = import_data; - std::vector<std::pair<unsigned int, unsigned int> >::const_iterator + std::vector<std::pair<size_type, size_type> >::const_iterator my_imports = part.import_indices().begin(); // If the operation is no insertion, add the imported data to the @@ -330,15 +347,15 @@ namespace parallel // the ones already present if (operation != dealii::VectorOperation::insert) for ( ; my_imports!=part.import_indices().end(); ++my_imports) - for (unsigned int j=my_imports->first; j<my_imports->second; j++) + for (size_type j=my_imports->first; j<my_imports->second; j++) local_element(j) += *read_position++; else for ( ; my_imports!=part.import_indices().end(); ++my_imports) - for (unsigned int j=my_imports->first; j<my_imports->second; + for (size_type j=my_imports->first; j<my_imports->second; 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<Number>::epsilon(), ExcMessage("Inserted elements do not match.")); AssertDimension(read_position-import_data,part.n_import_indices()); @@ -378,8 +395,8 @@ namespace parallel // make this function thread safe Threads::Mutex::ScopedLock lock (mutex); - const unsigned int n_import_targets = part.import_targets().size(); - const unsigned int n_ghost_targets = part.ghost_targets().size(); + const size_type n_import_targets = part.import_targets().size(); + const size_type n_ghost_targets = part.ghost_targets().size(); // Need to send and receive the data. Use // non-blocking communication, where it is @@ -389,9 +406,9 @@ namespace parallel { Assert (part.local_size() == vector_view.size(), ExcInternalError()); - unsigned int current_index_start = part.local_size(); + size_type current_index_start = part.local_size(); update_ghost_values_requests.resize (n_import_targets+n_ghost_targets); - for (unsigned int i=0; i<n_ghost_targets; i++) + for (size_type i=0; i<n_ghost_targets; i++) { // allow writing into ghost indices even // though we are in a const function @@ -413,7 +430,7 @@ namespace parallel if (import_data == 0 && part.n_import_indices() > 0) import_data = new Number[part.n_import_indices()]; current_index_start = 0; - for (unsigned int i=0; i<n_import_targets; i++) + for (size_type i=0; i<n_import_targets; i++) { MPI_Send_init (&import_data[current_index_start], part.import_targets()[i].second*sizeof(Number), @@ -433,10 +450,10 @@ namespace parallel { Assert (import_data != 0, ExcInternalError()); Number *write_position = import_data; - std::vector<std::pair<unsigned int, unsigned int> >::const_iterator + std::vector<std::pair<size_type, size_type> >::const_iterator my_imports = part.import_indices().begin(); for ( ; my_imports!=part.import_indices().end(); ++my_imports) - for (unsigned int j=my_imports->first; j<my_imports->second; j++) + for (size_type j=my_imports->first; j<my_imports->second; j++) *write_position++ = local_element(j); } @@ -561,40 +578,44 @@ namespace parallel // as there are processors and start writing // when it's our turn #ifdef DEAL_II_WITH_MPI - for (unsigned int i=0; i<partitioner->this_mpi_process(); i++) - MPI_Barrier (partitioner->get_communicator()); + if (partitioner->n_mpi_processes() > 1) + for (unsigned int i=0; i<partitioner->this_mpi_process(); i++) + MPI_Barrier (partitioner->get_communicator()); #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) - for (unsigned int i=0; i<partitioner->local_size(); ++i) + for (size_type i=0; i<partitioner->local_size(); ++i) out << local_element(i) << ' '; else - for (unsigned int i=0; i<partitioner->local_size(); ++i) + for (size_type i=0; i<partitioner->local_size(); ++i) out << local_element(i) << std::endl; out << std::endl; out << "Ghost entries (global index / value):" << std::endl; if (across) - for (unsigned int i=0; i<partitioner->n_ghost_indices(); ++i) + for (size_type i=0; i<partitioner->n_ghost_indices(); ++i) out << '(' << partitioner->ghost_indices().nth_index_in_set(i) << '/' << local_element(partitioner->local_size()+i) << ") "; else - for (unsigned int i=0; i<partitioner->n_ghost_indices(); ++i) + for (size_type i=0; i<partitioner->n_ghost_indices(); ++i) out << '(' << partitioner->ghost_indices().nth_index_in_set(i) << '/' << local_element(partitioner->local_size()+i) << ")" << std::endl; out << std::endl << std::flush; #ifdef DEAL_II_WITH_MPI - MPI_Barrier (partitioner->get_communicator()); + if (partitioner->n_mpi_processes() > 1) + { + MPI_Barrier (partitioner->get_communicator()); - for (unsigned int i=partitioner->this_mpi_process()+1; - i<partitioner->n_mpi_processes(); i++) - MPI_Barrier (partitioner->get_communicator()); + for (unsigned int i=partitioner->this_mpi_process()+1; + i<partitioner->n_mpi_processes(); i++) + MPI_Barrier (partitioner->get_communicator()); + } #endif AssertThrow (out, ExcIO()); 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 22e19d22c4..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 @@ -166,8 +171,8 @@ namespace PETScWrappers * user call whatever function * she desires. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + void reinit (const size_type n_block_rows, + const size_type n_block_columns); /** * This function collects the @@ -302,8 +307,8 @@ namespace PETScWrappers { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) this->block(r,c) = d; return *this; 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 788d8872b2..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 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 @@ -91,7 +96,7 @@ namespace PETScWrappers * sizes. */ explicit BlockVector (const unsigned int num_blocks = 0, - const unsigned int block_size = 0); + const size_type block_size = 0); /** * Copy-Constructor. Dimension set to @@ -123,7 +128,7 @@ namespace PETScWrappers * initialize each block with * <tt>n[i]</tt> zero elements. */ - BlockVector (const std::vector<unsigned int> &n); + BlockVector (const std::vector<size_type> &n); /** * Constructor. Set the number of @@ -144,9 +149,9 @@ namespace PETScWrappers * different blocks. */ template <typename InputIterator> - BlockVector (const std::vector<unsigned int> &n, - const InputIterator first, - const InputIterator end); + BlockVector (const std::vector<size_type> &n, + const InputIterator first, + const InputIterator end); /** * Destructor. Clears memory @@ -192,7 +197,7 @@ namespace PETScWrappers * is filled with zeros. */ void reinit (const unsigned int num_blocks, - const unsigned int block_size, + const size_type block_size, const bool fast = false); /** @@ -227,8 +232,8 @@ namespace PETScWrappers * since they may be routed to * the wrong block. */ - void reinit (const std::vector<unsigned int> &N, - const bool fast=false); + void reinit (const std::vector<size_type> &N, + const bool fast=false); /** * Change the dimension to that @@ -259,6 +264,19 @@ namespace PETScWrappers void reinit (const BlockVector &V, const bool fast=false); + /** + * Change the number of blocks to + * <tt>num_blocks</tt>. The individual + * blocks will get initialized with + * zero size, so it is assumed that + * the user resizes the + * individual blocks by herself + * in an appropriate way, and + * calls <tt>collect_sizes</tt> + * afterwards. + */ + void reinit (const unsigned int num_blocks); + /** * Swap the contents of this * vector and the other vector @@ -317,7 +335,7 @@ namespace PETScWrappers inline BlockVector::BlockVector (const unsigned int n_blocks, - const unsigned int block_size) + const size_type block_size) { reinit (n_blocks, block_size); } @@ -325,7 +343,7 @@ namespace PETScWrappers inline - BlockVector::BlockVector (const std::vector<unsigned int> &n) + BlockVector::BlockVector (const std::vector<size_type> &n) { reinit (n, false); } @@ -360,9 +378,9 @@ namespace PETScWrappers template <typename InputIterator> - BlockVector::BlockVector (const std::vector<unsigned int> &n, - const InputIterator first, - const InputIterator end) + BlockVector::BlockVector (const std::vector<size_type> &n, + const InputIterator first, + const InputIterator end) { // first set sizes of blocks, but // don't initialize them as we will @@ -374,7 +392,7 @@ namespace PETScWrappers InputIterator end = start; std::advance (end, static_cast<signed int>(n[b])); - for (unsigned int i=0; i<n[b]; ++i, ++start) + for (size_type i=0; i<n[b]; ++i, ++start) this->block(b)(i) = *start; } Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize()); @@ -420,10 +438,10 @@ namespace PETScWrappers inline void BlockVector::reinit (const unsigned int n_bl, - const unsigned int bl_sz, + const size_type bl_sz, const bool fast) { - std::vector<unsigned int> n(n_bl, bl_sz); + std::vector<size_type> n(n_bl, bl_sz); reinit(n, fast); } @@ -431,8 +449,8 @@ namespace PETScWrappers inline void - BlockVector::reinit (const std::vector<unsigned int> &n, - const bool fast) + BlockVector::reinit (const std::vector<size_type> &n, + const bool fast) { block_indices.reinit (n); if (this->components.size() != this->n_blocks()) @@ -458,6 +476,15 @@ namespace PETScWrappers + inline + void + BlockVector::reinit (const unsigned int num_blocks) + { + reinit (num_blocks, 0, true); + } + + + inline void BlockVector::swap (BlockVector &v) 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 d9752523d0..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 @@ -45,12 +50,17 @@ namespace PETScWrappers class FullMatrix : public MatrixBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Create a full matrix of dimensions * @p m times @p n. */ - FullMatrix (const unsigned int m, - const unsigned int n); + FullMatrix (const size_type m, + const size_type n); /** * Return a reference to the MPI 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 c5eafdb4d7..6ef2b51596 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,36 +69,41 @@ namespace PETScWrappers class Accessor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Since we use * accessors only for read * access, a const matrix * pointer is sufficient. */ - Accessor (const MatrixBase *matrix, - const unsigned int row, - const unsigned int index); + Accessor (const MatrixBase *matrix, + const size_type row, + const size_type index); /** * Row number of the element * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Index in row of the element * represented by this * object. */ - unsigned int index() const; + size_type index() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of this matrix entry. @@ -123,12 +133,12 @@ namespace PETScWrappers /** * Current row number. */ - unsigned int a_row; + size_type a_row; /** * Current index in row. */ - unsigned int a_index; + size_type a_index; /** * Cache where we store the @@ -154,7 +164,7 @@ namespace PETScWrappers * accessor can access this data * if necessary. */ - std_cxx1x::shared_ptr<const std::vector<unsigned int> > colnum_cache; + std_cxx1x::shared_ptr<const std::vector<size_type> > colnum_cache; /** * Similar cache for the values @@ -179,15 +189,19 @@ namespace PETScWrappers }; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * Constructor. Create an iterator * into the matrix @p matrix for the * given row and the index within it. */ - const_iterator (const MatrixBase *matrix, - const unsigned int row, - const unsigned int index); + const_iterator (const MatrixBase *matrix, + const size_type row, + const size_type index); /** * Prefix increment. @@ -293,6 +307,11 @@ namespace PETScWrappers */ typedef MatrixIterators::const_iterator const_iterator; + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Declare a typedef in analogy to all * the other container classes. @@ -350,8 +369,8 @@ namespace PETScWrappers * If <tt>value</tt> is not a finite * number an exception is thrown. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const PetscScalar value); /** @@ -389,9 +408,9 @@ namespace PETScWrappers * <tt>false</tt>, i.e., even zero * values are inserted/replaced. */ - void set (const std::vector<unsigned int> &indices, - const FullMatrix<PetscScalar> &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector<size_type> &indices, + const FullMatrix<PetscScalar> &full_matrix, + const bool elide_zero_values = false); /** * Same function as before, but now @@ -400,10 +419,10 @@ namespace PETScWrappers * different local-to-global indexing * on rows and columns, respectively. */ - void set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<PetscScalar> &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<PetscScalar> &full_matrix, + const bool elide_zero_values = false); /** * Set several elements in the @@ -431,10 +450,10 @@ namespace PETScWrappers * <tt>false</tt>, i.e., even zero * values are inserted/replaced. */ - void set (const unsigned int row, - const std::vector<unsigned int> &col_indices, + void set (const size_type row, + const std::vector<size_type > &col_indices, const std::vector<PetscScalar> &values, - const bool elide_zero_values = false); + const bool elide_zero_values = false); /** * Set several elements to values @@ -462,11 +481,11 @@ namespace PETScWrappers * <tt>false</tt>, i.e., even zero * values are inserted/replaced. */ - void set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void set (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values = false); + const bool elide_zero_values = false); /** * Add @p value to the element @@ -483,8 +502,8 @@ namespace PETScWrappers * If <tt>value</tt> is not a finite * number an exception is thrown. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const PetscScalar value); /** @@ -524,9 +543,9 @@ namespace PETScWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const std::vector<unsigned int> &indices, - const FullMatrix<PetscScalar> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &indices, + const FullMatrix<PetscScalar> &full_matrix, + const bool elide_zero_values = true); /** * Same function as before, but now @@ -535,10 +554,10 @@ namespace PETScWrappers * different local-to-global indexing * on rows and columns, respectively. */ - void add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<PetscScalar> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<PetscScalar> &full_matrix, + const bool elide_zero_values = true); /** * Set several elements in the @@ -567,10 +586,10 @@ namespace PETScWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const unsigned int row, - const std::vector<unsigned int> &col_indices, + void add (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<PetscScalar> &values, - const bool elide_zero_values = true); + const bool elide_zero_values = true); /** * Add an array of values given by @@ -599,12 +618,12 @@ namespace PETScWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Remove all elements from @@ -636,8 +655,8 @@ namespace PETScWrappers * to a value different from zero. The * default is to set it to zero. */ - void clear_row (const unsigned int row, - const PetscScalar new_diag_value = 0); + void clear_row (const size_type row, + const PetscScalar new_diag_value = 0); /** * Same as clear_row(), except that it @@ -652,8 +671,8 @@ namespace PETScWrappers * the diagonal entries, you have to * set them by hand. */ - void clear_rows (const std::vector<unsigned int> &rows, - const PetscScalar new_diag_value = 0); + void clear_rows (const std::vector<size_type> &rows, + const PetscScalar new_diag_value = 0); /** * PETSc matrices store their own @@ -695,8 +714,8 @@ namespace PETScWrappers * This function is therefore exactly * equivalent to the <tt>el()</tt> function. */ - PetscScalar operator () (const unsigned int i, - const unsigned int j) const; + PetscScalar operator () (const size_type i, + const size_type j) const; /** * Return the value of the matrix entry @@ -709,8 +728,8 @@ namespace PETScWrappers * solution, since the sparsity of the * matrix is not used. */ - PetscScalar el (const unsigned int i, - const unsigned int j) const; + PetscScalar el (const size_type i, + const size_type j) const; /** * Return the main diagonal @@ -727,19 +746,19 @@ namespace PETScWrappers * function for compatibility with the * SparseMatrix class. */ - PetscScalar diag_element (const unsigned int i) const; + PetscScalar diag_element (const size_type i) const; /** * Return the number of rows in this * matrix. */ - unsigned int m () const; + size_type m () const; /** * Return the number of columns in this * matrix. */ - unsigned int n () const; + size_type n () const; /** * Return the local dimension of the @@ -754,7 +773,7 @@ namespace PETScWrappers * exactly are stored locally, * use local_range(). */ - unsigned int local_size () const; + size_type local_size () const; /** * Return a pair of indices @@ -772,7 +791,7 @@ namespace PETScWrappers * a pair (i,i+n), where * <tt>n=local_size()</tt>. */ - std::pair<unsigned int, unsigned int> + std::pair<size_type, size_type> local_range () const; /** @@ -780,7 +799,7 @@ namespace PETScWrappers * in the local range or not, * see also local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return a reference to the MPI @@ -799,12 +818,12 @@ namespace PETScWrappers * the entries should happen to * be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Return the l1-norm of the matrix, that is @@ -916,7 +935,7 @@ namespace PETScWrappers * diagonal entries in the * matrix. */ - PetscReal trace () const; + PetscScalar trace () const; #endif /** @@ -935,8 +954,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: @@ -1084,7 +1103,7 @@ namespace PETScWrappers * iterator may not be dereferencable in * that case. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row <tt>r</tt>. It @@ -1097,7 +1116,7 @@ namespace PETScWrappers * particular the case if it is the end * iterator for the last row of a matrix. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; /** * Conversion operator to gain access @@ -1158,6 +1177,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. @@ -1278,6 +1304,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 @@ -1316,9 +1352,9 @@ namespace PETScWrappers inline const_iterator::Accessor:: - Accessor (const MatrixBase *matrix, - const unsigned int row, - const unsigned int index) + Accessor (const MatrixBase *matrix, + const size_type row, + const size_type index) : matrix(const_cast<MatrixBase *>(matrix)), a_row(row), @@ -1329,7 +1365,7 @@ namespace PETScWrappers inline - unsigned int + const_iterator::Accessor::size_type const_iterator::Accessor::row() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1338,7 +1374,7 @@ namespace PETScWrappers inline - unsigned int + const_iterator::Accessor::size_type const_iterator::Accessor::column() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1347,7 +1383,7 @@ namespace PETScWrappers inline - unsigned int + const_iterator::Accessor::size_type const_iterator::Accessor::index() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1366,9 +1402,9 @@ namespace PETScWrappers inline const_iterator:: - const_iterator(const MatrixBase *matrix, - const unsigned int row, - const unsigned int index) + const_iterator(const MatrixBase *matrix, + const size_type row, + const size_type index) : accessor(matrix, row, index) {} @@ -1470,9 +1506,9 @@ namespace PETScWrappers // compile time. inline void - MatrixBase::set (const unsigned int i, - const unsigned int j, - const PetscScalar value) + MatrixBase::set (const size_type i, + const size_type j, + const PetscScalar value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -1483,15 +1519,15 @@ namespace PETScWrappers inline void - MatrixBase::set (const std::vector<unsigned int> &indices, - const FullMatrix<PetscScalar> &values, - const bool elide_zero_values) + MatrixBase::set (const std::vector<size_type> &indices, + const FullMatrix<PetscScalar> &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) set (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -1500,17 +1536,17 @@ namespace PETScWrappers inline void - MatrixBase::set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<PetscScalar> &values, - const bool elide_zero_values) + MatrixBase::set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<PetscScalar> &values, + const bool elide_zero_values) { Assert (row_indices.size() == values.m(), ExcDimensionMismatch(row_indices.size(), values.m())); Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -1519,10 +1555,10 @@ namespace PETScWrappers inline void - MatrixBase::set (const unsigned int row, - const std::vector<unsigned int> &col_indices, + MatrixBase::set (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<PetscScalar> &values, - const bool elide_zero_values) + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1535,11 +1571,11 @@ namespace PETScWrappers inline void - MatrixBase::set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + MatrixBase::set (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values) + const bool elide_zero_values) { prepare_action(LastAction::insert); @@ -1570,7 +1606,7 @@ namespace PETScWrappers } n_columns = 0; - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const PetscScalar value = values[j]; Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -1597,9 +1633,9 @@ namespace PETScWrappers inline void - MatrixBase::add (const unsigned int i, - const unsigned int j, - const PetscScalar value) + MatrixBase::add (const size_type i, + const size_type j, + const PetscScalar value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -1628,15 +1664,15 @@ namespace PETScWrappers inline void - MatrixBase::add (const std::vector<unsigned int> &indices, - const FullMatrix<PetscScalar> &values, - const bool elide_zero_values) + MatrixBase::add (const std::vector<size_type> &indices, + const FullMatrix<PetscScalar> &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) add (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -1645,17 +1681,17 @@ namespace PETScWrappers inline void - MatrixBase::add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<PetscScalar> &values, - const bool elide_zero_values) + MatrixBase::add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<PetscScalar> &values, + const bool elide_zero_values) { Assert (row_indices.size() == values.m(), ExcDimensionMismatch(row_indices.size(), values.m())); Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -1664,10 +1700,10 @@ namespace PETScWrappers inline void - MatrixBase::add (const unsigned int row, - const std::vector<unsigned int> &col_indices, + MatrixBase::add (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<PetscScalar> &values, - const bool elide_zero_values) + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1680,11 +1716,11 @@ namespace PETScWrappers inline void - MatrixBase::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + MatrixBase::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values, + const bool elide_zero_values, const bool /*col_indices_are_sorted*/) { prepare_action(LastAction::add); @@ -1716,7 +1752,7 @@ namespace PETScWrappers } n_columns = 0; - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const PetscScalar value = values[j]; Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -1746,8 +1782,8 @@ namespace PETScWrappers inline PetscScalar - MatrixBase::operator() (const unsigned int i, - const unsigned int j) const + MatrixBase::operator() (const size_type i, + const size_type j) const { return el(i,j); } @@ -1772,7 +1808,7 @@ namespace PETScWrappers inline MatrixBase::const_iterator - MatrixBase::begin(const unsigned int r) const + MatrixBase::begin(const size_type r) const { Assert (r < m(), ExcIndexRange(r, 0, m())); if (row_length(r) > 0) @@ -1784,14 +1820,14 @@ namespace PETScWrappers inline MatrixBase::const_iterator - MatrixBase::end(const unsigned int r) const + MatrixBase::end(const size_type r) const { Assert (r < m(), ExcIndexRange(r, 0, m())); // place the iterator on the first entry // past this line, or at the end of the // matrix - for (unsigned int i=r+1; i<m(); ++i) + for (size_type i=r+1; i<m(); ++i) if (row_length(i) > 0) return const_iterator(this, i, 0); @@ -1804,7 +1840,7 @@ namespace PETScWrappers inline bool - MatrixBase::in_local_range (const unsigned int index) const + MatrixBase::in_local_range (const size_type index) const { PetscInt begin, end; @@ -1812,8 +1848,8 @@ namespace PETScWrappers &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return ((index >= static_cast<unsigned int>(begin)) && - (index < static_cast<unsigned int>(end))); + return ((index >= static_cast<size_type>(begin)) && + (index < static_cast<size_type>(end))); } 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 <tt>MatShell</tt> 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 * <tt>vmult(VectorBase &dst, const VectorBase &src)</tt> * 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 ac317b1fc0..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 <deal.II/base/table.h> # include <deal.II/lac/block_matrix_base.h> +# include <deal.II/lac/block_sparsity_pattern.h> # include <deal.II/lac/petsc_parallel_sparse_matrix.h> # include <deal.II/lac/petsc_parallel_block_vector.h> # include <deal.II/lac/exceptions.h> @@ -169,8 +175,33 @@ namespace PETScWrappers * user call whatever function * she desires. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + 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<IndexSet> &rows, + const std::vector<IndexSet> &cols, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com); + + + /** + * Same as above but for a symmetric structure only. + */ + void reinit(const std::vector<IndexSet> &sizes, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com); + + /** * Matrix-vector multiplication: @@ -292,8 +323,8 @@ namespace PETScWrappers { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) this->block(r,c) = d; return *this; 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 33482381d2..7d52ee3792 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 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 @@ -99,8 +104,8 @@ namespace PETScWrappers */ explicit BlockVector (const unsigned int n_blocks, const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size); + const size_type block_size, + const size_type local_size); /** * Copy-Constructor. Set all the @@ -122,9 +127,9 @@ namespace PETScWrappers * <tt>local_elements[i]</tt> * elements on the present process. */ - BlockVector (const std::vector<unsigned int> &block_sizes, - const MPI_Comm &communicator, - const std::vector<unsigned int> &local_elements); + BlockVector (const std::vector<size_type> &block_sizes, + const MPI_Comm &communicator, + const std::vector<size_type> &local_elements); /** * Create a BlockVector with parallel_partitioning.size() blocks, @@ -133,6 +138,15 @@ namespace PETScWrappers explicit BlockVector (const std::vector<IndexSet> &parallel_partitioning, const MPI_Comm &communicator = MPI_COMM_WORLD); + /** + * Same as above, but include ghost elements + */ + BlockVector (const std::vector<IndexSet> &parallel_partitioning, + const std::vector<IndexSet> &ghost_indices, + const MPI_Comm &communicator); + + + /** * Destructor. Clears memory */ @@ -199,8 +213,8 @@ namespace PETScWrappers */ void reinit (const unsigned int n_blocks, const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size, + const size_type block_size, + const size_type local_size, const bool fast = false); /** @@ -238,10 +252,10 @@ namespace PETScWrappers * since they may be routed to * the wrong block. */ - void reinit (const std::vector<unsigned int> &block_sizes, - const MPI_Comm &communicator, - const std::vector<unsigned int> &local_sizes, - const bool fast=false); + void reinit (const std::vector<size_type> &block_sizes, + const MPI_Comm &communicator, + const std::vector<size_type> &local_sizes, + const bool fast=false); /** * Change the dimension to that @@ -279,6 +293,26 @@ namespace PETScWrappers void reinit (const std::vector<IndexSet> &parallel_partitioning, const MPI_Comm &communicator); + /** + * Same as above but include ghost entries. + */ + void reinit (const std::vector<IndexSet> &parallel_partitioning, + const std::vector<IndexSet> &ghost_entries, + const MPI_Comm &communicator); + + /** + * Change the number of blocks to + * <tt>num_blocks</tt>. The individual + * blocks will get initialized with + * zero size, so it is assumed that + * the user resizes the + * individual blocks by herself + * in an appropriate way, and + * calls <tt>collect_sizes</tt> + * afterwards. + */ + void reinit (const unsigned int num_blocks); + /** * Return a reference to the MPI * communicator object in use with @@ -350,8 +384,8 @@ namespace PETScWrappers inline BlockVector::BlockVector (const unsigned int n_blocks, const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size) + const size_type block_size, + const size_type local_size) { reinit (n_blocks, communicator, block_size, local_size); } @@ -359,9 +393,9 @@ namespace PETScWrappers inline - BlockVector::BlockVector (const std::vector<unsigned int> &block_sizes, + BlockVector::BlockVector (const std::vector<size_type> &block_sizes, const MPI_Comm &communicator, - const std::vector<unsigned int> &local_elements) + const std::vector<size_type> &local_elements) { reinit (block_sizes, communicator, local_elements, false); } @@ -381,11 +415,18 @@ namespace PETScWrappers inline BlockVector::BlockVector (const std::vector<IndexSet> &parallel_partitioning, - const MPI_Comm &communicator) + const MPI_Comm &communicator) { reinit(parallel_partitioning, communicator); } + inline + BlockVector::BlockVector (const std::vector<IndexSet> &parallel_partitioning, + const std::vector<IndexSet> &ghost_indices, + const MPI_Comm &communicator) + { + reinit(parallel_partitioning, ghost_indices, communicator); + } inline BlockVector & @@ -416,13 +457,13 @@ namespace PETScWrappers void BlockVector::reinit (const unsigned int n_blocks, const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size, + const size_type block_size, + const size_type local_size, const bool fast) { - reinit(std::vector<unsigned int>(n_blocks, block_size), + reinit(std::vector<size_type>(n_blocks, block_size), communicator, - std::vector<unsigned int>(n_blocks, local_size), + std::vector<size_type>(n_blocks, local_size), fast); } @@ -430,10 +471,10 @@ namespace PETScWrappers inline void - BlockVector::reinit (const std::vector<unsigned int> &block_sizes, - const MPI_Comm &communicator, - const std::vector<unsigned int> &local_sizes, - const bool fast) + BlockVector::reinit (const std::vector<size_type> &block_sizes, + const MPI_Comm &communicator, + const std::vector<size_type> &local_sizes, + const bool fast) { this->block_indices.reinit (block_sizes); if (this->components.size() != this->n_blocks()) @@ -461,9 +502,9 @@ namespace PETScWrappers inline void BlockVector::reinit (const std::vector<IndexSet> &parallel_partitioning, - const MPI_Comm &communicator) + const MPI_Comm &communicator) { - std::vector<unsigned int> sizes(parallel_partitioning.size()); + std::vector<size_type> sizes(parallel_partitioning.size()); for (unsigned int i=0; i<parallel_partitioning.size(); ++i) sizes[i] = parallel_partitioning[i].size(); @@ -472,9 +513,28 @@ namespace PETScWrappers this->components.resize(this->n_blocks()); for (unsigned int i=0; i<this->n_blocks(); ++i) - block(i).reinit(communicator, parallel_partitioning[i]); + block(i).reinit(parallel_partitioning[i], communicator); } + inline + void + BlockVector::reinit (const std::vector<IndexSet> &parallel_partitioning, + const std::vector<IndexSet> &ghost_entries, + const MPI_Comm &communicator) + { + std::vector<types::global_dof_index> sizes(parallel_partitioning.size()); + for (unsigned int i=0; i<parallel_partitioning.size(); ++i) + sizes[i] = parallel_partitioning[i].size(); + + this->block_indices.reinit(sizes); + if (this->components.size() != this->n_blocks()) + this->components.resize(this->n_blocks()); + + for (unsigned int i=0; i<this->n_blocks(); ++i) + block(i).reinit(parallel_partitioning[i], ghost_entries[i], communicator); + } + + inline const MPI_Comm & 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 29dded8591..6bfa4df7dd 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 @@ -112,6 +117,10 @@ namespace PETScWrappers class SparseMatrix : public MatrixBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * A structure that describes some of @@ -179,13 +188,13 @@ namespace PETScWrappers * ICC. The default value of this flag * is @p false. */ - SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Initialize a rectangular matrix @@ -220,13 +229,13 @@ namespace PETScWrappers * true, only an ICC. The default * value of this flag is @p false. */ - SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric = false); + SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector<size_type> &row_lengths, + const bool is_symmetric = false); /** * Initialize using the given @@ -269,12 +278,12 @@ namespace PETScWrappers * the start. */ template <typename SparsityType> - SparseMatrix (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector<unsigned int> &local_rows_per_process, - const std::vector<unsigned int> &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations = true); + SparseMatrix (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector<size_type> &local_rows_per_process, + const std::vector<size_type> &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations = true); /** * This operator assigns a scalar to @@ -294,6 +303,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 @@ -303,12 +319,12 @@ namespace PETScWrappers * present function. */ void reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Throw away the present matrix and @@ -318,13 +334,13 @@ namespace PETScWrappers * the same argument list as the * present function. */ - void reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric = false); + void reinit (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector<size_type> &row_lengths, + const bool is_symmetric = false); /** * Initialize using the given @@ -361,12 +377,24 @@ namespace PETScWrappers * the start. */ template <typename SparsityType> - void reinit (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector<unsigned int> &local_rows_per_process, - const std::vector<unsigned int> &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations = true); + void reinit (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector<size_type> &local_rows_per_process, + const std::vector<size_type> &local_columns_per_process, + 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 <typename SparsityType> + void reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern, + const MPI_Comm &communicator); /** * Return a reference to the MPI @@ -445,32 +473,40 @@ namespace PETScWrappers * of the previous matrix is left to * the caller. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Same as previous function. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector<size_type> &row_lengths, + const bool is_symmetric = false); + + /** + * Same as previous functions. + */ + template <typename SparsityType> + void do_reinit (const SparsityType &sparsity_pattern, + const std::vector<size_type> &local_rows_per_process, + const std::vector<size_type> &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations); /** * Same as previous functions. */ template <typename SparsityType> - void do_reinit (const SparsityType &sparsity_pattern, - const std::vector<unsigned int> &local_rows_per_process, - const std::vector<unsigned int> &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations); + void do_reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern); /** * To allow calling protected 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 0ace189356..95cdddc214 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 @@ -153,6 +158,11 @@ namespace PETScWrappers class Vector : public VectorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * A variable that indicates whether this vector * supports distributed data storage. If true, then @@ -166,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 (); /** @@ -196,9 +206,9 @@ namespace PETScWrappers * vector is replaced by one of * length zero. */ - explicit Vector (const MPI_Comm &communicator, - const unsigned int n, - const unsigned int local_size); + explicit Vector (const MPI_Comm &communicator, + const size_type n, + const size_type local_size); /** @@ -217,9 +227,9 @@ namespace PETScWrappers * shall communicate */ template <typename Number> - explicit Vector (const MPI_Comm &communicator, + explicit Vector (const MPI_Comm &communicator, const dealii::Vector<Number> &v, - const unsigned int local_size); + const size_type local_size); /** @@ -238,7 +248,7 @@ namespace PETScWrappers */ explicit Vector (const MPI_Comm &communicator, const VectorBase &v, - const unsigned int local_size); + const size_type local_size); /** @@ -264,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 @@ -375,10 +417,10 @@ namespace PETScWrappers * elements are left an unspecified * state. */ - void reinit (const MPI_Comm &communicator, - const unsigned int N, - const unsigned int local_size, - const bool fast = false); + void reinit (const MPI_Comm &communicator, + const size_type N, + const size_type local_size, + const bool fast = false); /** * Change the dimension to that of @@ -404,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 @@ -412,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 @@ -455,8 +512,8 @@ namespace PETScWrappers * how many of these elements shall * be stored locally. */ - virtual void create_vector (const unsigned int n, - const unsigned int local_size); + virtual void create_vector (const size_type n, + const size_type local_size); @@ -468,8 +525,8 @@ namespace PETScWrappers * call update_ghost_values() before * accessing those. */ - virtual void create_vector (const unsigned int n, - const unsigned int local_size, + virtual void create_vector (const size_type n, + const size_type local_size, const IndexSet &ghostnodes); @@ -505,7 +562,7 @@ namespace PETScWrappers template <typename number> Vector::Vector (const MPI_Comm &communicator, const dealii::Vector<number> &v, - const unsigned int local_size) + const size_type local_size) : communicator (communicator) { @@ -603,7 +660,7 @@ namespace PETScWrappers // that would take a pointer to an array // of PetscScalar values and simply copy // n elements verbatim into the vector... - for (unsigned int i=0; i<v.size(); ++i) + for (size_type i=0; i<v.size(); ++i) (*this)(i) = v(i); compress (::dealii::VectorOperation::insert); diff --git a/deal.II/include/deal.II/lac/petsc_precondition.h b/deal.II/include/deal.II/lac/petsc_precondition.h index 2c2a51dc28..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 @@ -899,13 +904,8 @@ namespace PETScWrappers unsigned int symmetric; /** - * Patterns of powers of sparsified - * matrices can be approximate the - * pattern of large entries in the - * inverse of a matrix. Powers of a - * * The sparsity pattern used for the - * apprximate inverse is the pattern + * approximate inverse is the pattern * of a power <tt>B^m</tt> where <tt>B</tt> * has been sparsified from the given * matrix <tt>A</tt>, <tt>n_level</tt> 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 bd5e41fcae..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 @@ -97,10 +102,10 @@ namespace PETScWrappers * ICC. The default value of this flag * is @p false. */ - SparseMatrix (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + SparseMatrix (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Initialize a rectangular matrix with @@ -130,10 +135,10 @@ namespace PETScWrappers * ICC. The default value of this flag * is @p false. */ - SparseMatrix (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric = false); + SparseMatrix (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const bool is_symmetric = false); /** * Initialize a sparse matrix using the @@ -168,8 +173,8 @@ namespace PETScWrappers * the start. */ template <typename SparsityType> - 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 @@ -197,10 +202,10 @@ namespace PETScWrappers * the same argument list as the * present function. */ - void reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + void reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Throw away the present matrix and @@ -210,10 +215,10 @@ namespace PETScWrappers * the same argument list as the * present function. */ - void reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric = false); + void reinit (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const bool is_symmetric = false); /** * Initialize a sparse matrix using the @@ -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 @@ -328,18 +342,18 @@ namespace PETScWrappers * matrix. Getting rid of the previous * matrix is left to the caller. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Same as previous function. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const bool is_symmetric = false); /** * Same as previous function. diff --git a/deal.II/include/deal.II/lac/petsc_vector.h b/deal.II/include/deal.II/lac/petsc_vector.h index 7193166e27..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 @@ -47,6 +52,11 @@ namespace PETScWrappers class Vector : public VectorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * A variable that indicates whether this vector * supports distributed data storage. If true, then @@ -82,7 +92,7 @@ namespace PETScWrappers * i.e. the vector is replaced by one of * length zero. */ - explicit Vector (const unsigned int n); + explicit Vector (const size_type n); /** * Copy-constructor from deal.II @@ -195,8 +205,8 @@ namespace PETScWrappers * elements are left an unspecified * state. */ - void reinit (const unsigned int N, - const bool fast = false); + void reinit (const size_type N, + const bool fast = false); /** * Change the dimension to that of the @@ -219,7 +229,7 @@ namespace PETScWrappers * size of the vector to be * created. */ - void create_vector (const unsigned int n); + void create_vector (const size_type n); }; /*@}*/ @@ -411,7 +421,7 @@ namespace PETScWrappers // that would take a pointer to an array // of PetscScalar values and simply copy // n elements verbatim into the vector... - for (unsigned int i=0; i<v.size(); ++i) + for (size_type i=0; i<v.size(); ++i) (*this)(i) = v(i); compress (::dealii::VectorOperation::insert); 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 4222be10e1..8d0f7e056f 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 @@ -77,6 +82,12 @@ namespace PETScWrappers */ class VectorReference { + public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + private: /** * Constructor. It is made private so @@ -84,9 +95,11 @@ namespace PETScWrappers * class to create it. */ VectorReference (const VectorBase &vector, - const unsigned int index); + const size_type index); + public: + /** * This looks like a copy operator, * but does something different than @@ -201,7 +214,7 @@ namespace PETScWrappers * Index of the referenced element of * the vector. */ - const unsigned int index; + const size_type index; /** * Make the vector class a friend, so @@ -252,7 +265,7 @@ namespace PETScWrappers */ typedef PetscScalar value_type; typedef PetscReal real_type; - typedef std::size_t size_type; + typedef types::global_dof_index size_type; typedef internal::VectorReference reference; typedef const internal::VectorReference const_reference; @@ -349,7 +362,7 @@ namespace PETScWrappers * Return the global dimension of the * vector. */ - unsigned int size () const; + size_type size () const; /** * Return the local dimension of the @@ -364,7 +377,7 @@ namespace PETScWrappers * exactly are stored locally, * use local_range(). */ - unsigned int local_size () const; + size_type local_size () const; /** * Return a pair of indices @@ -382,7 +395,7 @@ namespace PETScWrappers * a pair (i,i+n), where * <tt>n=local_size()</tt>. */ - std::pair<unsigned int, unsigned int> + std::pair<size_type, size_type> local_range () const; /** @@ -390,7 +403,7 @@ namespace PETScWrappers * in the local range or not, * see also local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return an index set that describes which elements of this vector @@ -419,14 +432,14 @@ namespace PETScWrappers * both read and write. */ reference - operator () (const unsigned int index); + operator () (const size_type index); /** * Provide read-only access to an * element. */ PetscScalar - operator () (const unsigned int index) const; + operator () (const size_type index) const; /** * Provide access to a given @@ -435,7 +448,7 @@ namespace PETScWrappers * Exactly the same as operator(). */ reference - operator [] (const unsigned int index); + operator [] (const size_type index); /** * Provide read-only access to an @@ -445,7 +458,7 @@ namespace PETScWrappers * Exactly the same as operator(). */ PetscScalar - operator [] (const unsigned int index) const; + operator [] (const size_type index) const; /** * A collective set operation: instead @@ -457,7 +470,7 @@ namespace PETScWrappers * the corresponding values in the * second. */ - void set (const std::vector<unsigned int> &indices, + void set (const std::vector<size_type> &indices, const std::vector<PetscScalar> &values); /** @@ -466,7 +479,7 @@ namespace PETScWrappers * stored in @p values to the vector * components specified by @p indices. */ - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const std::vector<PetscScalar> &values); /** @@ -476,7 +489,7 @@ namespace PETScWrappers * takes a deal.II vector of * values. */ - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const ::dealii::Vector<PetscScalar> &values); /** @@ -488,8 +501,8 @@ namespace PETScWrappers * other two <tt>add()</tt> * functions above. */ - void add (const unsigned int n_elements, - const unsigned int *indices, + void add (const size_type n_elements, + const size_type *indices, const PetscScalar *values); /** @@ -505,8 +518,7 @@ namespace PETScWrappers real_type norm_sqr () const; /** - * Mean value of the elements of - * this vector. + * Return the mean value of the elements of this vector. */ PetscScalar mean_value () const; @@ -889,10 +901,10 @@ namespace PETScWrappers * @p add_values flag set to the * corresponding value. */ - void do_set_add_operation (const unsigned int n_elements, - const unsigned int *indices, + void do_set_add_operation (const size_type n_elements, + const size_type *indices, const PetscScalar *values, - const bool add_values); + const bool add_values); }; @@ -920,7 +932,7 @@ namespace PETScWrappers { inline VectorReference::VectorReference (const VectorBase &vector, - const unsigned int index) + const size_type index) : vector (vector), index (index) @@ -1132,15 +1144,15 @@ namespace PETScWrappers inline bool - VectorBase::in_local_range (const unsigned int index) const + VectorBase::in_local_range (const size_type index) const { PetscInt begin, end; const int ierr = VecGetOwnershipRange (static_cast<const Vec &>(vector), &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return ((index >= static_cast<unsigned int>(begin)) && - (index < static_cast<unsigned int>(end))); + return ((index >= static_cast<size_type>(begin)) && + (index < static_cast<size_type>(end))); } @@ -1151,7 +1163,7 @@ namespace PETScWrappers IndexSet is (size()); // PETSc only allows for contiguous local ranges, so this is simple - const std::pair<unsigned int, unsigned int> x = local_range(); + const std::pair<size_type, size_type> x = local_range(); is.add_range (x.first, x.second); return is; } @@ -1169,7 +1181,7 @@ namespace PETScWrappers inline internal::VectorReference - VectorBase::operator () (const unsigned int index) + VectorBase::operator () (const size_type index) { return internal::VectorReference (*this, index); } @@ -1178,7 +1190,7 @@ namespace PETScWrappers inline PetscScalar - VectorBase::operator () (const unsigned int index) const + VectorBase::operator () (const size_type index) const { return static_cast<PetscScalar>(internal::VectorReference (*this, index)); } @@ -1187,7 +1199,7 @@ namespace PETScWrappers inline internal::VectorReference - VectorBase::operator [] (const unsigned int index) + VectorBase::operator [] (const size_type index) { return operator()(index); } @@ -1196,7 +1208,7 @@ namespace PETScWrappers inline PetscScalar - VectorBase::operator [] (const unsigned int index) const + VectorBase::operator [] (const size_type index) const { return operator()(index); } 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 9d34b5958a..0667794d06 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 @@ -69,7 +74,6 @@ template <typename> class SolverCG; class PreconditionIdentity : public Subscriptor { public: - /** * This function is only * present to @@ -574,6 +578,10 @@ template <class MATRIX = SparseMatrix<double> > class PreconditionSSOR : public PreconditionRelaxation<MATRIX> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * A typedef to the base class. @@ -672,6 +680,11 @@ template <class MATRIX = SparseMatrix<double> > class PreconditionPSOR : public PreconditionRelaxation<MATRIX> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Initialize matrix and * relaxation parameter. The @@ -692,8 +705,8 @@ public: * reasons. It defaults to 1. */ void initialize (const MATRIX &A, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const typename PreconditionRelaxation<MATRIX>::AdditionalData & parameters = typename PreconditionRelaxation<MATRIX>::AdditionalData()); @@ -713,12 +726,12 @@ private: /** * Storage for the permutation vector. */ - const std::vector<unsigned int> *permutation; + const std::vector<size_type> *permutation; /** * Storage for the inverse * permutation vector. */ - const std::vector<unsigned int> *inverse_permutation; + const std::vector<size_type> *inverse_permutation; }; @@ -898,6 +911,11 @@ template <class MATRIX=SparseMatrix<double>, class VECTOR=Vector<double> > class PreconditionChebyshev : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Standardized data struct to pipe additional parameters to the * preconditioner. @@ -1294,16 +1312,16 @@ PreconditionSSOR<MATRIX>::initialize (const MATRIX &rA, // calculate the positions first after the diagonal. if (mat != 0) { - const unsigned int n = this->A->n(); + const size_type n = this->A->n(); pos_right_of_diagonal.resize(n, static_cast<std::size_t>(-1)); - for (unsigned int row=0; row<n; ++row) + for (size_type row=0; row<n; ++row) { // find the first element in this line which is on the right of the // diagonal. we need to precondition with the elements on the left // only. note: the first entry in each line denotes the diagonal // element, which we need not check. typename SparseMatrix<typename MATRIX::value_type>::const_iterator - it = mat->begin(row)+1; + it = mat->begin(row)+1; for ( ; it < mat->end(row); ++it) if (it->column() > row) break; @@ -1362,8 +1380,8 @@ template <class MATRIX> inline void PreconditionPSOR<MATRIX>::initialize ( const MATRIX &rA, - const std::vector<unsigned int> &p, - const std::vector<unsigned int> &ip, + const std::vector<size_type> &p, + const std::vector<size_type> &ip, const typename PreconditionRelaxation<MATRIX>::AdditionalData &parameters) { permutation = &p; @@ -1569,6 +1587,8 @@ namespace internal template <typename Number> struct VectorUpdatesRange : public parallel::ParallelForInteger { + typedef types::global_dof_index size_type; + VectorUpdatesRange (const size_t size, const Number *src, const Number *matrix_diagonal_inverse, @@ -1605,13 +1625,13 @@ namespace internal if (factor1 == Number()) { if (start_zero) - for (unsigned int i=begin; i<end; ++i) + for (size_type i=begin; i<end; ++i) { dst[i] = factor2 * src[i] * matrix_diagonal_inverse[i]; update1[i] = -dst[i]; } else - for (unsigned int i=begin; i<end; ++i) + for (size_type i=begin; i<end; ++i) { update1[i] = ((update2[i]-src[i]) * factor2*matrix_diagonal_inverse[i]); @@ -1619,7 +1639,7 @@ namespace internal } } else - for (unsigned int i=begin; i<end; ++i) + for (size_type i=begin; i<end; ++i) { const Number update2i = ((update2[i] - src[i]) * matrix_diagonal_inverse[i]); @@ -1756,7 +1776,7 @@ PreconditionChebyshev<MATRIX,VECTOR>::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<std::ostream *>(0); + static_cast<std::ostream *>(0); if (old_stream) deallog.detach(); @@ -1776,7 +1796,7 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix, cg_data.compute_eigenvalues = true; SolverCG<VECTOR> solver (control, memory, cg_data); internal::PreconditionChebyshev::DiagonalPreconditioner<VECTOR> - preconditioner(data.matrix_diagonal_inverse); + preconditioner(data.matrix_diagonal_inverse); try { solver.solve(matrix, *dummy, *rhs, preconditioner); @@ -1793,19 +1813,24 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix, // read the log stream: grab the first and last eigenvalue std::string cg_message = log_msg.str(); const std::size_t pos = cg_message.find("cg:: "); - Assert(pos < std::string::npos, ExcInternalError()); - cg_message.erase(0, pos+5); - std::istringstream os1(cg_message); - os1 >> min_eigenvalue; - for (unsigned int i=0; i<control.last_step()-1; ++i) - cg_message.erase(0, cg_message.find_first_of(" ")+1); - std::istringstream os2(cg_message); - os2 >> max_eigenvalue; + if (pos != std::string::npos) + { + cg_message.erase(0, pos+5); + std::string first = cg_message; + + first.erase(cg_message.find_first_of(" "), std::string::npos); + std::istringstream(first) >> min_eigenvalue; + + cg_message.erase(0, cg_message.find_last_of(" ")+1); + std::istringstream(cg_message) >> max_eigenvalue; + } + else + min_eigenvalue = max_eigenvalue = 1; // reset deal.II stream deallog.detach(); if (old_stream) - deallog.attach(*old_stream, false); + deallog.attach(*old_stream); // include a safety factor since the CG method will in general not be // converged @@ -1817,9 +1842,9 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix, min_eigenvalue = data.max_eigenvalue/data.smoothing_range; } - const double alpha = (data.smoothing_range > 0 ? + const double alpha = (data.smoothing_range > 1. ? max_eigenvalue / data.smoothing_range : - max_eigenvalue / min_eigenvalue); + std::min(0.9*max_eigenvalue, min_eigenvalue)); delta = (max_eigenvalue-alpha)*0.5; theta = (max_eigenvalue+alpha)*0.5; diff --git a/deal.II/include/deal.II/lac/precondition_block.h b/deal.II/include/deal.II/lac/precondition_block.h index d3d7feb3ed..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 @@ -95,6 +100,11 @@ private: typedef inverse_type value_type; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Parameters for block preconditioners. */ @@ -107,7 +117,7 @@ public: * is no reasonable default * parameter. */ - AdditionalData (const unsigned int block_size, + AdditionalData (const size_type block_size, const double relaxation = 1., const bool invert_diagonal = true, const bool same_diagonal = false); @@ -120,7 +130,7 @@ public: /** * Block size. */ - unsigned int block_size; + size_type block_size; /** * Invert diagonal during initialization. @@ -200,8 +210,8 @@ protected: * may be provided. */ void initialize (const MATRIX &A, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const AdditionalData parameters); /** @@ -250,8 +260,8 @@ protected: * order is only admissible for * block permutation. */ - void set_permutation(const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation); + void set_permutation(const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation); /** * Replacement of @@ -259,8 +269,8 @@ protected: * permuted preconditioning. */ void invert_permuted_diagblocks( - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation); + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation); public: /** * Deletes the inverse diagonal @@ -283,8 +293,8 @@ public: * if the inverse diagonal blocks * are stored. */ - value_type el(unsigned int i, - unsigned int j) const; + value_type el(size_type i, + size_type j) const; /** * Stores the inverse of the @@ -367,7 +377,7 @@ public: /** * Return the size of the blocks. */ - unsigned int block_size () const; + size_type block_size () const; /** * @deprecated Use size() @@ -414,7 +424,7 @@ protected: * diagonal block is assumed to * be of the same size. */ - unsigned int blocksize; + size_type blocksize; /** * Pointer to the matrix. Make @@ -438,12 +448,12 @@ protected: /** * The permutation vector */ - std::vector<unsigned int> permutation; + std::vector<size_type> permutation; /** * The inverse permutation vector */ - std::vector<unsigned int> inverse_permutation; + std::vector<size_type> inverse_permutation; /** * Flag for diagonal compression. @@ -474,6 +484,11 @@ private: typedef typename MATRIX::value_type number; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * STL conforming iterator. */ @@ -493,21 +508,21 @@ public: * pointer is sufficient. */ Accessor (const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix, - const unsigned int row); + const size_type row); /** * Row number of the element * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of this matrix entry. @@ -524,12 +539,12 @@ public: * Save block size here * for further reference. */ - unsigned int bs; + size_type bs; /** * Current block number. */ - unsigned int a_block; + size_type a_block; /** * Iterator inside block. @@ -553,7 +568,7 @@ public: * Constructor. */ const_iterator(const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix, - const unsigned int row); + const size_type row); /** * Prefix increment. @@ -698,12 +713,12 @@ public: * STL-like iterator with the * first entry of row @p r. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row @p r. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; private: @@ -767,6 +782,11 @@ class PreconditionBlockSOR : public virtual Subscriptor, protected PreconditionBlock<MATRIX, inverse_type> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor. */ @@ -955,6 +975,11 @@ class PreconditionBlockSSOR : public virtual Subscriptor, private PreconditionBlockSOR<MATRIX, inverse_type> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Define number type of matrix. */ @@ -1051,16 +1076,16 @@ PreconditionBlock<MATRIX, inverse_type>::n_blocks () const template<class MATRIX, typename inverse_type> inline inverse_type PreconditionBlock<MATRIX, inverse_type>::el ( - unsigned int i, - unsigned int j) const + size_type i, + size_type j) const { - const unsigned int bs = blocksize; + const size_type bs = blocksize; const unsigned int nb = i/bs; const FullMatrix<inverse_type> &B = this->inverse(nb); - const unsigned int ib = i % bs; - const unsigned int jb = j % bs; + const size_type ib = i % bs; + const size_type jb = j % bs; if (jb + nb*bs != j) { @@ -1076,7 +1101,7 @@ template<class MATRIX, typename inverse_type> inline PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor:: Accessor (const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix, - const unsigned int row) + const size_type row) : matrix(matrix), b_iterator(&matrix->inverse(0), 0, 0), @@ -1090,7 +1115,7 @@ Accessor (const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix, if (a_block == matrix->size()) return; - const unsigned int r = row % bs; + const size_type r = row % bs; b_iterator = matrix->inverse(a_block).begin(r); b_end = matrix->inverse(a_block).end(); @@ -1102,7 +1127,7 @@ Accessor (const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix, template<class MATRIX, typename inverse_type> inline -unsigned int +typename PreconditionBlockJacobi<MATRIX, inverse_type>::size_type PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor::row() const { Assert (a_block < matrix->size(), @@ -1114,7 +1139,7 @@ PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor::row() c template<class MATRIX, typename inverse_type> inline -unsigned int +typename PreconditionBlockJacobi<MATRIX, inverse_type>::size_type PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor::column() const { Assert (a_block < matrix->size(), @@ -1140,7 +1165,7 @@ template<class MATRIX, typename inverse_type> inline PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator:: const_iterator(const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix, - const unsigned int row) + const size_type row) : accessor(matrix, row) {} @@ -1248,7 +1273,7 @@ template<class MATRIX, typename inverse_type> inline typename PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator PreconditionBlockJacobi<MATRIX, inverse_type>::begin ( - const unsigned int r) const + const size_type r) const { Assert (r < this->A->m(), ExcIndexRange(r, 0, this->A->m())); return const_iterator(this, r); @@ -1260,7 +1285,7 @@ template<class MATRIX, typename inverse_type> inline typename PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator PreconditionBlockJacobi<MATRIX, inverse_type>::end ( - const unsigned int r) const + const size_type r) const { Assert (r < this->A->m(), ExcIndexRange(r, 0, this->A->m())); return const_iterator(this, r+1); 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 41fc24ad95..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 @@ -27,7 +32,7 @@ DEAL_II_NAMESPACE_OPEN template<class MATRIX, typename inverse_type> PreconditionBlock<MATRIX, inverse_type>::AdditionalData:: -AdditionalData (const unsigned int block_size, +AdditionalData (const size_type block_size, const double relaxation, const bool invert_diagonal, const bool same_diagonal) @@ -73,7 +78,7 @@ void PreconditionBlock<MATRIX,inverse_type>::initialize ( const MATRIX &M, const AdditionalData parameters) { - const unsigned int bsize = parameters.block_size; + const size_type bsize = parameters.block_size; clear(); Assert (M.m() == M.n(), ExcNotQuadratic()); @@ -99,8 +104,8 @@ void PreconditionBlock<MATRIX,inverse_type>::initialize ( template <class MATRIX, typename inverse_type> void PreconditionBlock<MATRIX,inverse_type>::initialize ( const MATRIX &M, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const AdditionalData parameters) { set_permutation(permutation, inverse_permutation); @@ -109,8 +114,8 @@ void PreconditionBlock<MATRIX,inverse_type>::initialize ( template <class MATRIX, typename inverse_type> void PreconditionBlock<MATRIX,inverse_type>::invert_permuted_diagblocks( - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation) + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation) { Assert (A!=0, ExcNotInitialized()); Assert (blocksize!=0, ExcNotInitialized()); @@ -126,7 +131,7 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_permuted_diagblocks( { deallog << "PreconditionBlock uses only one diagonal block" << std::endl; - for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell) + for (size_type row_cell=0; row_cell<blocksize; ++row_cell) { typename MATRIX::const_iterator entry = M.begin(row_cell); const typename MATRIX::const_iterator row_end = M.end(row_cell); @@ -169,12 +174,12 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_permuted_diagblocks( for (unsigned int cell=0; cell<this->size(); ++cell) { - const unsigned int cell_start = cell*blocksize; - for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell) + const size_type cell_start = cell*blocksize; + for (size_type row_cell=0; row_cell<blocksize; ++row_cell) { - const unsigned int urow = row_cell + cell_start; + const size_type urow = row_cell + cell_start; - const unsigned int row = permutation[urow]; + const size_type row = permutation[urow]; typename MATRIX::const_iterator entry = M.begin(row); const typename MATRIX::const_iterator row_end = M.end(row); @@ -185,7 +190,7 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_permuted_diagblocks( if (inverse_permutation[entry->column()]<cell_start) continue; - const unsigned int column_cell = inverse_permutation[entry->column()]-cell_start; + const size_type column_cell = inverse_permutation[entry->column()]-cell_start; if (column_cell >= blocksize) continue; M_cell(row_cell, column_cell) = entry->value(); @@ -250,7 +255,7 @@ void PreconditionBlock<MATRIX,inverse_type>::forward_step ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell; + size_type row, row_cell; number2 b_cell_row; // The diagonal block if the // inverses were not precomputed @@ -260,10 +265,10 @@ void PreconditionBlock<MATRIX,inverse_type>::forward_step ( for (unsigned int rawcell=0; rawcell < this->size(); ++rawcell) { const unsigned int cell = cell_permuted ? permutation[rawcell] : rawcell; - const unsigned int block_start = cell*this->blocksize; - const unsigned int permuted_block_start = permuted - ? permutation[block_start] - : block_start; + const size_type block_start = cell*this->blocksize; + const size_type permuted_block_start = permuted + ? permutation[block_start] + : block_start; // deallog << std::endl << cell << '-' << block_start // << '-' << permuted_block_start << (permuted ? 't' : 'f') << '\t'; @@ -279,17 +284,17 @@ void PreconditionBlock<MATRIX,inverse_type>::forward_step ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? inverse_permutation[column] + : column; b_cell_row -= entry->value() * prev(column); //TODO:[GK] Find out if this is really once column and once permuted if (!this->inverses_ready() && inverse_permuted_column >= block_start && inverse_permuted_column < block_start + this->blocksize) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; if (transpose_diagonal) M_cell(column_cell, row_cell) = entry->value(); else @@ -348,7 +353,7 @@ void PreconditionBlock<MATRIX,inverse_type>::backward_step ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell; + size_type row, row_cell; number2 b_cell_row; FullMatrix<number> M_cell(this->blocksize); @@ -356,11 +361,11 @@ void PreconditionBlock<MATRIX,inverse_type>::backward_step ( { --rawcell; const unsigned int cell = cell_permuted ? permutation[rawcell] : rawcell; - const unsigned int block_start = cell*this->blocksize; - const unsigned int block_end = block_start + this->blocksize; - const unsigned int permuted_block_start = permuted - ? permutation[block_start] - : block_start; + const size_type block_start = cell*this->blocksize; + const size_type block_end = block_start + this->blocksize; + const size_type permuted_block_start = permuted + ? permutation[block_start] + : block_start; for (row = permuted_block_start, row_cell = 0; row_cell<this->blocksize; ++row_cell, ++row) @@ -371,16 +376,16 @@ void PreconditionBlock<MATRIX,inverse_type>::backward_step ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? inverse_permutation[column] + : column; b_cell_row -= entry->value() * prev(column); if (!this->inverses_ready() && inverse_permuted_column < block_end && column >= block_start) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; // We need the // transpose of the // diagonal block, @@ -419,7 +424,8 @@ void PreconditionBlock<MATRIX,inverse_type>::backward_step ( template <class MATRIX, typename inverse_type> -unsigned int PreconditionBlock<MATRIX,inverse_type>::block_size() const +typename PreconditionBlock<MATRIX,inverse_type>::size_type +PreconditionBlock<MATRIX,inverse_type>::block_size() const { return blocksize; } @@ -439,7 +445,7 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_diagblocks() if (this->same_diagonal()) { deallog << "PreconditionBlock uses only one diagonal block" << std::endl; - for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell) + for (size_type row_cell=0; row_cell<blocksize; ++row_cell) { typename MATRIX::const_iterator entry = M.begin(row_cell); const typename MATRIX::const_iterator row_end = M.end(row_cell); @@ -474,10 +480,10 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_diagblocks() for (unsigned int cell=0; cell<this->size(); ++cell) { - const unsigned int cell_start = cell*blocksize; - for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell) + const size_type cell_start = cell*blocksize; + for (size_type row_cell=0; row_cell<blocksize; ++row_cell) { - const unsigned int row = row_cell + cell_start; + const size_type row = row_cell + cell_start; typename MATRIX::const_iterator entry = M.begin(row); const typename MATRIX::const_iterator row_end = M.end(row); @@ -486,7 +492,7 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_diagblocks() if (entry->column()<cell_start) continue; - const unsigned int column_cell = entry->column()-cell_start; + const size_type column_cell = entry->column()-cell_start; if (column_cell >= blocksize) continue; M_cell(row_cell, column_cell) = entry->value(); @@ -519,8 +525,8 @@ void PreconditionBlock<MATRIX,inverse_type>::invert_diagblocks() template <class MATRIX, typename inverse_type> void PreconditionBlock<MATRIX,inverse_type>::set_permutation ( - const std::vector<unsigned int> &p, - const std::vector<unsigned int> &i) + const std::vector<size_type> &p, + const std::vector<size_type> &i) { Assert (p.size() == i.size(), ExcDimensionMismatch(p.size(), i.size())); @@ -574,7 +580,7 @@ void PreconditionBlockJacobi<MATRIX,inverse_type> // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell, begin_diag_block=0; + size_type row, row_cell, begin_diag_block=0; if (!this->inverses_ready()) { @@ -586,7 +592,7 @@ void PreconditionBlockJacobi<MATRIX,inverse_type> ++row_cell, ++row) { b_cell(row_cell)=src(row); - for (unsigned int column_cell=0, column=cell*this->blocksize; + for (size_type column_cell=0, column=cell*this->blocksize; column_cell<this->blocksize; ++column_cell, ++column) M_cell(row_cell,column_cell)=M(row,column); } @@ -742,7 +748,7 @@ void PreconditionBlockSOR<MATRIX,inverse_type>::forward ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell, block_start=0; + size_type row, row_cell, block_start=0; number2 b_cell_row; // The diagonal block if the // inverses were not precomputed @@ -750,9 +756,9 @@ void PreconditionBlockSOR<MATRIX,inverse_type>::forward ( for (unsigned int cell=0; cell < this->size(); ++cell) { - const unsigned int permuted_block_start = permuted - ? this->permutation[block_start] - :block_start; + const size_type permuted_block_start = permuted + ? this->permutation[block_start] + :block_start; for (row = permuted_block_start, row_cell = 0; row_cell < this->blocksize; @@ -764,16 +770,16 @@ void PreconditionBlockSOR<MATRIX,inverse_type>::forward ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? this->inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? this->inverse_permutation[column] + : column; if (inverse_permuted_column < block_start) b_cell_row -= entry->value() * dst(column); else if (!this->inverses_ready() && column < block_start + this->blocksize) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; if (transpose_diagonal) M_cell(column_cell, row_cell) = entry->value(); else @@ -832,19 +838,19 @@ void PreconditionBlockSOR<MATRIX,inverse_type>::backward ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell; - unsigned int block_end=this->blocksize * this->size(); + size_type row, row_cell; + size_type block_end=this->blocksize * this->size(); number2 b_cell_row; FullMatrix<number> M_cell(this->blocksize); for (unsigned int cell=this->size(); cell!=0 ;) { --cell; - const unsigned int block_start = block_end - this->blocksize; + const size_type block_start = block_end - this->blocksize; // Collect upper triangle - const unsigned int permuted_block_start = (this->permutation.size() != 0) - ? this->permutation[block_start] - :block_start; + const size_type permuted_block_start = (this->permutation.size() != 0) + ? this->permutation[block_start] + : block_start; for (row = permuted_block_start, row_cell = 0; row_cell<this->blocksize; ++row_cell, ++row) @@ -855,15 +861,15 @@ void PreconditionBlockSOR<MATRIX,inverse_type>::backward ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? this->inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? 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) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; // We need the // transpose of the // diagonal block, @@ -993,14 +999,14 @@ void PreconditionBlockSSOR<MATRIX,inverse_type>::vmult (Vector<number2> &d // Multiply with diagonal blocks for (unsigned int cell=0; cell < this->size(); ++cell) { - unsigned int row = cell*this->blocksize; + size_type row = cell*this->blocksize; - for (unsigned int row_cell=0; row_cell<this->blocksize; ++row_cell) + for (size_type row_cell=0; row_cell<this->blocksize; ++row_cell) cell_src(row_cell)=help(row+row_cell); this->diagonal(cell).vmult(cell_dst, cell_src); - for (unsigned int row_cell=0; row_cell<this->blocksize; ++row_cell) + for (size_type row_cell=0; row_cell<this->blocksize; ++row_cell) help(row+row_cell) = scaling * cell_dst(row_cell); } @@ -1024,14 +1030,14 @@ void PreconditionBlockSSOR<MATRIX,inverse_type>::Tvmult (Vector<number2> & // Multiply with diagonal blocks for (unsigned int cell=0; cell < this->size(); ++cell) { - unsigned int row = cell*this->blocksize; + size_type row = cell*this->blocksize; - for (unsigned int row_cell=0; row_cell<this->blocksize; ++row_cell) + for (size_type row_cell=0; row_cell<this->blocksize; ++row_cell) cell_src(row_cell)=help(row+row_cell); this->diagonal(cell).Tvmult(cell_dst, cell_src); - for (unsigned int row_cell=0; row_cell<this->blocksize; ++row_cell) + for (size_type row_cell=0; row_cell<this->blocksize; ++row_cell) help(row+row_cell) = scaling * cell_dst(row_cell); } 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 be37ffdd52..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 @@ -51,6 +56,11 @@ template <typename number> class PreconditionBlockBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Choose a method for inverting * the blocks, and thus the data @@ -105,7 +115,7 @@ public: * then only one block will be * stored. */ - void reinit(unsigned int nblocks, unsigned int blocksize, bool compress, + void reinit(unsigned int nblocks, size_type blocksize, bool compress, Inversion method = gauss_jordan); /** @@ -164,69 +174,69 @@ public: * if the inverse diagonal blocks * are stored. */ - number el(unsigned int i, unsigned int j) const; + number el(size_type i, size_type j) const; /** * Multiply with the inverse * block at position <tt>i</tt>. */ template <typename number2> - void inverse_vmult(unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const; + void inverse_vmult(size_type i, Vector<number2> &dst, const Vector<number2> &src) const; /** * Multiply with the transposed inverse * block at position <tt>i</tt>. */ template <typename number2> - void inverse_Tvmult(unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const; + void inverse_Tvmult(size_type i, Vector<number2> &dst, const Vector<number2> &src) const; /** * Access to the inverse diagonal * blocks if Inversion is #gauss_jordan. */ - FullMatrix<number> &inverse (unsigned int i); + FullMatrix<number> &inverse (size_type i); /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - Householder<number> &inverse_householder (unsigned int i); + Householder<number> &inverse_householder (size_type i); /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - LAPACKFullMatrix<number> &inverse_svd (unsigned int i); + LAPACKFullMatrix<number> &inverse_svd (size_type i); /** * Access to the inverse diagonal * blocks. */ - const FullMatrix<number> &inverse (unsigned int i) const; + const FullMatrix<number> &inverse (size_type i) const; /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - const Householder<number> &inverse_householder (unsigned int i) const; + const Householder<number> &inverse_householder (size_type i) const; /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - const LAPACKFullMatrix<number> &inverse_svd (unsigned int i) const; + const LAPACKFullMatrix<number> &inverse_svd (size_type i) const; /** * Access to the diagonal * blocks. */ - FullMatrix<number> &diagonal (unsigned int i); + FullMatrix<number> &diagonal (size_type i); /** * Access to the diagonal * blocks. */ - const FullMatrix<number> &diagonal (unsigned int i) const; + const FullMatrix<number> &diagonal (size_type i) const; /** * Print some statistics about @@ -383,7 +393,7 @@ PreconditionBlockBase<number>::clear() template <typename number> inline void -PreconditionBlockBase<number>::reinit(unsigned int n, unsigned int b, bool compress, +PreconditionBlockBase<number>::reinit(unsigned int n, size_type b, bool compress, Inversion method) { inversion = method; @@ -472,9 +482,9 @@ template <typename number2> inline void PreconditionBlockBase<number>::inverse_vmult( - unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const + size_type i, Vector<number2> &dst, const Vector<number2> &src) const { - const unsigned int ii = same_diagonal() ? 0U : i; + const size_type ii = same_diagonal() ? 0U : i; switch (inversion) { @@ -501,9 +511,9 @@ template <typename number2> inline void PreconditionBlockBase<number>::inverse_Tvmult( - unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const + size_type i, Vector<number2> &dst, const Vector<number2> &src) const { - const unsigned int ii = same_diagonal() ? 0U : i; + const size_type ii = same_diagonal() ? 0U : i; switch (inversion) { @@ -528,7 +538,7 @@ PreconditionBlockBase<number>::inverse_Tvmult( template <typename number> inline const FullMatrix<number> & -PreconditionBlockBase<number>::inverse(unsigned int i) const +PreconditionBlockBase<number>::inverse(size_type i) const { if (same_diagonal()) return var_inverse_full[0]; @@ -541,7 +551,7 @@ PreconditionBlockBase<number>::inverse(unsigned int i) const template <typename number> inline const Householder<number> & -PreconditionBlockBase<number>::inverse_householder(unsigned int i) const +PreconditionBlockBase<number>::inverse_householder(size_type i) const { if (same_diagonal()) return var_inverse_householder[0]; @@ -554,7 +564,7 @@ PreconditionBlockBase<number>::inverse_householder(unsigned int i) const template <typename number> inline const LAPACKFullMatrix<number> & -PreconditionBlockBase<number>::inverse_svd(unsigned int i) const +PreconditionBlockBase<number>::inverse_svd(size_type i) const { if (same_diagonal()) return var_inverse_svd[0]; @@ -567,7 +577,7 @@ PreconditionBlockBase<number>::inverse_svd(unsigned int i) const template <typename number> inline const FullMatrix<number> & -PreconditionBlockBase<number>::diagonal(unsigned int i) const +PreconditionBlockBase<number>::diagonal(size_type i) const { Assert(store_diagonals(), ExcDiagonalsNotStored()); @@ -582,7 +592,7 @@ PreconditionBlockBase<number>::diagonal(unsigned int i) const template <typename number> inline FullMatrix<number> & -PreconditionBlockBase<number>::inverse(unsigned int i) +PreconditionBlockBase<number>::inverse(size_type i) { Assert(var_inverse_full.size() != 0, ExcInverseNotAvailable()); @@ -597,7 +607,7 @@ PreconditionBlockBase<number>::inverse(unsigned int i) template <typename number> inline Householder<number> & -PreconditionBlockBase<number>::inverse_householder(unsigned int i) +PreconditionBlockBase<number>::inverse_householder(size_type i) { Assert(var_inverse_householder.size() != 0, ExcInverseNotAvailable()); @@ -612,7 +622,7 @@ PreconditionBlockBase<number>::inverse_householder(unsigned int i) template <typename number> inline LAPACKFullMatrix<number> & -PreconditionBlockBase<number>::inverse_svd(unsigned int i) +PreconditionBlockBase<number>::inverse_svd(size_type i) { Assert(var_inverse_svd.size() != 0, ExcInverseNotAvailable()); @@ -627,7 +637,7 @@ PreconditionBlockBase<number>::inverse_svd(unsigned int i) template <typename number> inline FullMatrix<number> & -PreconditionBlockBase<number>::diagonal(unsigned int i) +PreconditionBlockBase<number>::diagonal(size_type i) { Assert(store_diagonals(), ExcDiagonalsNotStored()); @@ -683,10 +693,10 @@ PreconditionBlockBase<number>::log_statistics () const double sigmin = 1.e300, sigmax= -1.e300; double kappamin = 1.e300, kappamax= -1.e300; - for (unsigned int b=0; b<size(); ++b) + for (size_type b=0; b<size(); ++b) { const LAPACKFullMatrix<number> &matrix = inverse_svd(b); - unsigned int k=1; + size_type k=1; while (k <= matrix.n_cols() && matrix.singular_value(matrix.n_cols()-k) == 0) ++k; const double s0 = matrix.singular_value(0); @@ -724,9 +734,9 @@ std::size_t PreconditionBlockBase<number>::memory_consumption () const { std::size_t mem = sizeof(*this); - for (unsigned int i=0; i<var_inverse_full.size(); ++i) + for (size_type i=0; i<var_inverse_full.size(); ++i) mem += MemoryConsumption::memory_consumption(var_inverse_full[i]); - for (unsigned int i=0; i<var_diagonal.size(); ++i) + for (size_type i=0; i<var_diagonal.size(); ++i) mem += MemoryConsumption::memory_consumption(var_diagonal[i]); return mem; } 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 c4414385d8..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 @@ -63,6 +68,11 @@ private: typedef inverse_type value_type; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Parameters for block relaxation methods. */ @@ -176,8 +186,8 @@ public: * Read-only access to entries. This function is only possible if * the inverse diagonal blocks are stored. */ - value_type el(unsigned int i, - unsigned int j) const; + value_type el(size_type i, + size_type j) const; /** * Stores the inverse of the diagonal blocks in @p inverse. This 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 d326a6aac0..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 @@ -111,9 +116,9 @@ RelaxationBlock<MATRIX,inverse_type>::invert_diagblocks () } else { - for (unsigned int block=0; block<additional_data->block_list.n_rows(); ++block) + for (size_type block=0; block<additional_data->block_list.n_rows(); ++block) { - const unsigned int bs = additional_data->block_list.row_length(block); + const size_type bs = additional_data->block_list.row_length(block); M_cell.reinit(bs, bs); // Copy rows for this block @@ -121,15 +126,15 @@ RelaxationBlock<MATRIX,inverse_type>::invert_diagblocks () // diagonal block SparsityPattern::iterator row = additional_data->block_list.begin(block); - for (unsigned int row_cell=0; row_cell<bs; ++row_cell, ++row) + for (size_type row_cell=0; row_cell<bs; ++row_cell, ++row) { //TODO:[GK] Optimize here for (typename MATRIX::const_iterator entry = M.begin(row->column()); entry != M.end(row->column()); ++entry) { - const unsigned int column = entry->column(); - const unsigned int col_cell = additional_data->block_list.row_position(block, column); - if (col_cell != numbers::invalid_unsigned_int) + const size_type column = entry->column(); + const size_type col_cell = additional_data->block_list.row_position(block, column); + if (col_cell != numbers::invalid_size_type) M_cell(row_cell, col_cell) = entry->value(); } } @@ -183,7 +188,7 @@ RelaxationBlock<MATRIX,inverse_type>::do_step ( const bool permutation_empty = additional_data->order.size() == 0; const unsigned int n_permutations = (permutation_empty) ? 1U : additional_data->order.size(); - const unsigned int n_blocks = additional_data->block_list.n_rows(); + const size_type n_blocks = additional_data->block_list.n_rows(); if (!permutation_empty) for (unsigned int i=0; i<additional_data->order.size(); ++i) @@ -200,13 +205,13 @@ RelaxationBlock<MATRIX,inverse_type>::do_step ( ? (additional_data->order[n_permutations-1-perm][raw_block]) : (additional_data->order[perm][raw_block])); - const unsigned int bs = additional_data->block_list.row_length(block); + const size_type bs = additional_data->block_list.row_length(block); b_cell.reinit(bs); x_cell.reinit(bs); // Collect off-diagonal parts SparsityPattern::iterator row = additional_data->block_list.begin(block); - for (unsigned int row_cell=0; row_cell<bs; ++row_cell, ++row) + for (size_type row_cell=0; row_cell<bs; ++row_cell, ++row) { b_cell(row_cell) = src(row->column()); for (typename MATRIX::const_iterator entry = M.begin(row->column()); @@ -216,14 +221,14 @@ RelaxationBlock<MATRIX,inverse_type>::do_step ( // Apply inverse diagonal this->inverse_vmult(block, x_cell, b_cell); #ifdef DEBUG - for (unsigned int i=0;i<x_cell.size();++i) - { - Assert(numbers::is_finite(x_cell(i)), ExcNumberNotFinite()); - } + for (unsigned int i=0; i<x_cell.size(); ++i) + { + Assert(numbers::is_finite(x_cell(i)), ExcNumberNotFinite()); + } #endif // Store in result vector row=additional_data->block_list.begin(block); - for (unsigned int row_cell=0; row_cell<bs; ++row_cell, ++row) + for (size_type row_cell=0; row_cell<bs; ++row_cell, ++row) dst(row->column()) = prev(row->column()) + additional_data->relaxation * x_cell(row_cell); } } diff --git a/deal.II/include/deal.II/lac/schur_matrix.h b/deal.II/include/deal.II/lac/schur_matrix.h index 8f6d671f82..8de512c5bb 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 @@ -204,7 +209,7 @@ private: /** * Optional signature of the @p u-vector. */ - std::vector<unsigned int> signature; + std::vector<types::global_dof_index> signature; /** * Switch for debugging information. @@ -222,7 +227,7 @@ SchurMatrix<MA_inverse, MB, MDt, MC> const MDt &Dt, const MC &C, VectorMemory<BlockVector<double> > &mem, - const std::vector<unsigned int> &signature) + const std::vector<types::global_dof_index> &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 d363702a98..b5135d7403 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,6 +119,10 @@ 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 @@ -153,7 +161,7 @@ namespace SLEPcWrappers solve (const PETScWrappers::MatrixBase &A, std::vector<double> &eigenvalues, std::vector<OutputVector> &eigenvectors, - const unsigned int n_eigenpairs = 1); + const size_type n_eigenpairs = 1); /** * Same as above, but here a composite method for solving the @@ -166,7 +174,7 @@ namespace SLEPcWrappers const PETScWrappers::MatrixBase &B, std::vector<double> &eigenvalues, std::vector<OutputVector> &eigenvectors, - const unsigned int n_eigenpairs = 1); + const size_type n_eigenpairs = 1); /** * Same as above, but here a composite method for solving the @@ -228,7 +236,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); /** @@ -305,7 +313,7 @@ namespace SLEPcWrappers */ void get_eigenpair (const unsigned int index, - double &eigenvalues, + PetscScalar &eigenvalues, PETScWrappers::VectorBase &eigenvectors); /** @@ -717,8 +725,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: @@ -742,122 +750,122 @@ namespace SLEPcWrappers // todo: The logic of these functions can be simplified without breaking backward compatibility... template <typename OutputVector> - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - std::vector<double> &eigenvalues, - std::vector<OutputVector> &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<n_converged; ++index) - get_eigenpair (index, eigenvalues[index], eigenvectors[index]); - } - + void + SolverBase::solve (const PETScWrappers::MatrixBase &A, + std::vector<double> &eigenvalues, + std::vector<OutputVector> &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<n_converged; ++index) + get_eigenpair (index, eigenvalues[index], eigenvectors[index]); + } + template <typename OutputVector> - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - const PETScWrappers::MatrixBase &B, - std::vector<double> &eigenvalues, - std::vector<OutputVector> &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<n_converged; ++index) - get_eigenpair (index, eigenvalues[index], eigenvectors[index]); - } + void + SolverBase::solve (const PETScWrappers::MatrixBase &A, + const PETScWrappers::MatrixBase &B, + std::vector<double> &eigenvalues, + std::vector<OutputVector> &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<n_converged; ++index) + get_eigenpair (index, eigenvalues[index], eigenvectors[index]); + } template <typename OutputVector> - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - const PETScWrappers::MatrixBase &B, - std::vector<double> &real_eigenvalues, - std::vector<double> &imag_eigenvalues, - std::vector<OutputVector> &real_eigenvectors, - std::vector<OutputVector> &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; index<n_converged; ++index) - get_eigenpair (index, - real_eigenvalues[index], imag_eigenvalues[index], - real_eigenvectors[index], imag_eigenvectors[index]); - } + void + SolverBase::solve (const PETScWrappers::MatrixBase &A, + const PETScWrappers::MatrixBase &B, + std::vector<double> &real_eigenvalues, + std::vector<double> &imag_eigenvalues, + std::vector<OutputVector> &real_eigenvectors, + std::vector<OutputVector> &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<n_converged; ++index) + get_eigenpair (index, + real_eigenvalues[index], imag_eigenvalues[index], + real_eigenvectors[index], imag_eigenvectors[index]); + } } diff --git a/deal.II/include/deal.II/lac/slepc_spectral_transformation.h b/deal.II/include/deal.II/lac/slepc_spectral_transformation.h index c33a99bb9b..4598afbb84 100644 --- a/deal.II/include/deal.II/lac/slepc_spectral_transformation.h +++ b/deal.II/include/deal.II/lac/slepc_spectral_transformation.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// 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. +// +// --------------------------------------------------------------------- + #ifndef __deal2__slepc_spectral_transformation_h #define __deal2__slepc_spectral_transformation_h @@ -43,7 +47,7 @@ namespace SLEPcWrappers * <code>eigensolver</code>: * @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 2d82c64552..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 @@ -75,6 +80,11 @@ template <class VECTOR = Vector<double> > class SolverCG : public Solver<VECTOR> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Standardized data struct to pipe * additional data to the solver. @@ -422,7 +432,7 @@ SolverCG<VECTOR>::solve (const MATRIX &A, if (additional_data.compute_all_condition_numbers && (diagonal.size()>1)) { TridiagonalMatrix<double> T(diagonal.size(), true); - for (unsigned int i=0; i<diagonal.size(); ++i) + for (size_type i=0; i<diagonal.size(); ++i) { T(i,i) = diagonal[i]; if (i< diagonal.size()-1) @@ -444,7 +454,7 @@ SolverCG<VECTOR>::solve (const MATRIX &A, if (do_eigenvalues) { TridiagonalMatrix<double> T(diagonal.size(), true); - for (unsigned int i=0; i<diagonal.size(); ++i) + for (size_type i=0; i<diagonal.size(); ++i) { T(i,i) = diagonal[i]; if (i< diagonal.size()-1) @@ -458,7 +468,7 @@ SolverCG<VECTOR>::solve (const MATRIX &A, T.eigenvalue(T.n()-1)/T.eigenvalue(0) << std::endl; if (additional_data.compute_eigenvalues) { - for (unsigned int i=0; i<T.n(); ++i) + for (size_type i=0; i<T.n(); ++i) deallog << ' ' << T.eigenvalue(i); deallog << std::endl; } 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<VECTOR>::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 3f3d9cf42a..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 @@ -159,6 +163,11 @@ protected: SparseLUDecomposition (const SparsityPattern &sparsity) DEAL_II_DEPRECATED; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Destruction. Mark the * destructor pure to ensure that @@ -389,7 +398,7 @@ protected: * <tt>strengthen_diagonal</tt>'s * value. */ - virtual number get_strengthen_diagonal(const number rowsum, const unsigned int row) const; + virtual number get_strengthen_diagonal(const number rowsum, const size_type row) const; /** * State flag. If not in @@ -421,7 +430,7 @@ protected: * available after invocation of * decompose(). */ - std::vector<const unsigned int *> prebuilt_lower_bound; + std::vector<const size_type *> prebuilt_lower_bound; private: /** @@ -460,7 +469,7 @@ template <typename number> inline number SparseLUDecomposition<number>:: get_strengthen_diagonal(const number /*rowsum*/, - const unsigned int /*row*/) const + const size_type /*row*/) const { return strengthen_diagonal; } 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 3935ef107b..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 @@ -54,7 +60,7 @@ void SparseLUDecomposition<number>::clear() { decomposed = false; - std::vector<const unsigned int *> tmp; + std::vector<const size_type *> tmp; tmp.swap (prebuilt_lower_bound); SparseMatrix<number>::clear(); @@ -129,7 +135,7 @@ void SparseLUDecomposition<number>::initialize ( typename SparsityPattern::ExcDiagonalNotOptimized()); decomposed = false; { - std::vector<const unsigned int *> tmp; + std::vector<const size_type *> tmp; tmp.swap (prebuilt_lower_bound); } SparseMatrix<number>::reinit (*sparsity_pattern_to_use); @@ -160,7 +166,7 @@ void SparseLUDecomposition<number>::reinit (const SparsityPattern &sparsity) typename SparsityPattern::ExcDiagonalNotOptimized()); decomposed = false; { - std::vector<const unsigned int *> tmp; + std::vector<const size_type *> tmp; tmp.swap (prebuilt_lower_bound); } SparseMatrix<number>::reinit (sparsity); @@ -172,20 +178,20 @@ template<typename number> void SparseLUDecomposition<number>::prebuild_lower_bound() { - const unsigned int *const - column_numbers = this->get_sparsity_pattern().colnums; + const size_type *const + column_numbers = this->get_sparsity_pattern().colnums; const std::size_t *const - rowstart_indices = this->get_sparsity_pattern().rowstart; - const unsigned int N = this->m(); - - prebuilt_lower_bound.resize (N); - - for (unsigned int row=0; row<N; row++) - { - prebuilt_lower_bound[row] - = Utilities::lower_bound (&column_numbers[rowstart_indices[row]+1], - &column_numbers[rowstart_indices[row+1]], - row); + rowstart_indices = this->get_sparsity_pattern().rowstart; + const size_type N = this->m(); + + prebuilt_lower_bound.resize (N); + + for (size_type row=0; row<N; row++) + { + prebuilt_lower_bound[row] + = Utilities::lower_bound (&column_numbers[rowstart_indices[row]+1], + &column_numbers[rowstart_indices[row+1]], + row); } } @@ -214,11 +220,11 @@ SparseLUDecomposition<number>::copy_from (const SparseMatrix<somenumber> &matrix SparseMatrix<number>::operator= (number(0)); // both allow more and less entries in the new matrix - for (unsigned int row=0; row<this->m(); ++row) + for (size_type row=0; row<this->m(); ++row) { typename SparseMatrix<number>::iterator index = this->begin(row); typename SparseMatrix<somenumber>::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)) @@ -240,7 +246,7 @@ template <typename number> void SparseLUDecomposition<number>::strengthen_diagonal_impl () { - for (unsigned int row=0; row<this->m(); ++row) + for (size_type row=0; row<this->m(); ++row) { // get the global index of the first // non-diagonal element in this row diff --git a/deal.II/include/deal.II/lac/sparse_direct.h b/deal.II/include/deal.II/lac/sparse_direct.h index da58687d0b..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 @@ -30,8 +35,6 @@ DEAL_II_NAMESPACE_OPEN - - /** * This class provides an interface to the sparse direct solver * UMFPACK (see <a @@ -80,6 +83,11 @@ DEAL_II_NAMESPACE_OPEN class SparseDirectUMFPACK : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Dummy class needed for the usual initalization interface of * preconditioners. @@ -105,7 +113,7 @@ public: /** * @{ */ - + /** * This function does nothing. It is only here to provide a interface * consistent with other sparse direct solvers. @@ -150,10 +158,10 @@ public: /** * @{ */ - + /** * Preconditioner interface function. Usually, given the source vector, - * this method returns an approximated solution of <i>Ax = b</i>. As this + * this method returns an approximate solution of <i>Ax = b</i>. 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). @@ -162,33 +170,41 @@ public: * inverse of the matrix, $A^{-1}$. */ void vmult (Vector<double> &dst, - const Vector<double> &src) const; + const Vector<double> &src) const; /** * Same as before, but for block vectors. */ void vmult (BlockVector<double> &dst, - const BlockVector<double> &src) const; + const BlockVector<double> &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<double> &dst, - const Vector<double> &src) const; + const Vector<double> &src) const; + + /** + * Same as before, but for block vectors + */ + void Tvmult (BlockVector<double> &dst, + const BlockVector<double> &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<double> &dst, - const Vector<double> &src) const; + const Vector<double> &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<double> &dst, - const Vector<double> &src) const; - + const Vector<double> &src) const; + /** * @} */ @@ -213,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<double> &rhs_and_solution) const; + void solve (Vector<double> &rhs_and_solution, bool transpose = false) const; /** * Same as before, but for block vectors. */ - void solve (BlockVector<double> &rhs_and_solution) const; - + void solve (BlockVector<double> &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. @@ -229,19 +248,21 @@ public: */ template <class Matrix> void solve (const Matrix &matrix, - Vector<double> &rhs_and_solution); + Vector<double> &rhs_and_solution, + bool transpose = false); /** * Same as before, but for block vectors. */ template <class Matrix> void solve (const Matrix &matrix, - BlockVector<double> &rhs_and_solution); + BlockVector<double> &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 @@ -250,8 +271,8 @@ public: DeclException2 (ExcUMFPACKError, char *, int, << "UMFPACK routine " << arg1 << " returned error status " << arg2 - << ". See the file <contrib/umfpack/UMFPACK/Include/umfpack.h>" - << " for a description of error codes."); + << ". See the file <bundled/umfpack/UMFPACK/Include/umfpack.h>" + << " for a description of 'status codes'."); private: /** @@ -324,12 +345,12 @@ private: DMUMPS_STRUC_C id; #endif // DEAL_II_WITH_MUMPS - double *a; - double *rhs; - int *irn; - int *jcn; - unsigned int n; - unsigned int nz; + double *a; + double *rhs; + int *irn; + int *jcn; + types::global_dof_index n; + types::global_dof_index nz; /** * This function initializes a MUMPS instance and hands over the system's @@ -350,6 +371,10 @@ private: bool initialize_called; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * Constructor diff --git a/deal.II/include/deal.II/lac/sparse_ilu.h b/deal.II/include/deal.II/lac/sparse_ilu.h index ba745ccbbf..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 @@ -53,6 +59,11 @@ template <typename number> class SparseILU : public SparseLUDecomposition<number> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Does nothing. * 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 c695e9face..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 @@ -71,29 +77,29 @@ void SparseILU<number>::decompose (const SparseMatrix<somenumber> &matrix, // translating in essence the algorithm given at the end of section 10.3.2, // using the names of variables used there const SparsityPattern &sparsity = this->get_sparsity_pattern(); - const std::size_t *const ia = sparsity.rowstart; - const unsigned int *const ja = sparsity.colnums; + const std::size_t *const ia = sparsity.rowstart; + const size_type *const ja = sparsity.colnums; number *luval = this->SparseMatrix<number>::val; - const unsigned int N = this->m(); - unsigned int jrow = 0; + const size_type N = this->m(); + size_type jrow = 0; - std::vector<unsigned int> iw (N, numbers::invalid_unsigned_int); + std::vector<size_type> iw (N, numbers::invalid_size_type); - for (unsigned int k=0; k<N; ++k) + for (size_type k=0; k<N; ++k) { - const unsigned int j1 = ia[k], - j2 = ia[k+1]-1; + const size_type j1 = ia[k], + j2 = ia[k+1]-1; - for (unsigned int j=j1; j<=j2; ++j) + for (size_type j=j1; j<=j2; ++j) iw[ja[j]] = j; // the algorithm in the book works on the elements of row k left of the // diagonal. however, since we store the diagonal element at the first // position, start at the element after the diagonal and run as long as // we don't walk into the right half - unsigned int j = j1+1; + size_type j = j1+1; // pathological case: the current row of the matrix has only the // diagonal entry. then we have nothing to do. @@ -112,13 +118,13 @@ label_150: luval[j] = t1; // jj runs from just right of the diagonal to the end of the row - unsigned int jj = ia[jrow]+1; + size_type jj = ia[jrow]+1; while (ja[jj] < jrow) ++jj; for (; jj<ia[jrow+1]; ++jj) { - const unsigned int jw = iw[ja[jj]]; - if (jw != numbers::invalid_unsigned_int) + const size_type jw = iw[ja[jj]]; + if (jw != numbers::invalid_size_type) luval[jw] -= t1 * luval[jj]; } @@ -142,8 +148,8 @@ label_200: luval[ia[k]] = 1./luval[ia[k]]; - for (unsigned int j=j1; j<=j2; ++j) - iw[ja[j]] = numbers::invalid_unsigned_int; + for (size_type j=j1; j<=j2; ++j) + iw[ja[j]] = numbers::invalid_size_type; } } @@ -158,10 +164,10 @@ void SparseILU<number>::vmult (Vector<somenumber> &dst, Assert (dst.size() == src.size(), ExcDimensionMismatch(dst.size(), src.size())); Assert (dst.size() == this->m(), ExcDimensionMismatch(dst.size(), this->m())); - const unsigned int N=dst.size(); - const std::size_t *const rowstart_indices + const size_type N=dst.size(); + const std::size_t *const rowstart_indices = this->get_sparsity_pattern().rowstart; - const unsigned int *const column_numbers + const size_type *const column_numbers = this->get_sparsity_pattern().colnums; // solve LUx=b in two steps: @@ -177,19 +183,19 @@ void SparseILU<number>::vmult (Vector<somenumber> &dst, // perform it at the outset of the // loop dst = src; - for (unsigned int row=0; row<N; ++row) + for (size_type row=0; row<N; ++row) { // get start of this row. skip the // diagonal element - const unsigned int *const rowstart = &column_numbers[rowstart_indices[row]+1]; + const size_type *const rowstart = &column_numbers[rowstart_indices[row]+1]; // find the position where the part // right of the diagonal starts - const unsigned int *const first_after_diagonal = this->prebuilt_lower_bound[row]; + const size_type *const first_after_diagonal = this->prebuilt_lower_bound[row]; somenumber dst_row = dst(row); const number *luval = this->SparseMatrix<number>::val + (rowstart - column_numbers); - for (const unsigned int *col=rowstart; col!=first_after_diagonal; ++col, ++luval) + for (const size_type *col=rowstart; col!=first_after_diagonal; ++col, ++luval) dst_row -= *luval * dst(*col); dst(row) = dst_row; } @@ -205,15 +211,15 @@ void SparseILU<number>::vmult (Vector<somenumber> &dst, for (int row=N-1; row>=0; --row) { // get end of this row - const unsigned int *const rowend = &column_numbers[rowstart_indices[row+1]]; + const size_type *const rowend = &column_numbers[rowstart_indices[row+1]]; // find the position where the part // right of the diagonal starts - const unsigned int *const first_after_diagonal = this->prebuilt_lower_bound[row]; + const size_type *const first_after_diagonal = this->prebuilt_lower_bound[row]; somenumber dst_row = dst(row); const number *luval = this->SparseMatrix<number>::val + (first_after_diagonal - column_numbers); - for (const unsigned int *col=first_after_diagonal; col!=rowend; ++col, ++luval) + for (const size_type *col=first_after_diagonal; col!=rowend; ++col, ++luval) dst_row -= *luval * dst(*col); // scale by the diagonal element. @@ -232,10 +238,10 @@ void SparseILU<number>::Tvmult (Vector<somenumber> &dst, Assert (dst.size() == src.size(), ExcDimensionMismatch(dst.size(), src.size())); Assert (dst.size() == this->m(), ExcDimensionMismatch(dst.size(), this->m())); - const unsigned int N=dst.size(); - const std::size_t *const rowstart_indices + const size_type N=dst.size(); + const std::size_t *const rowstart_indices = this->get_sparsity_pattern().rowstart; - const unsigned int *const column_numbers + const size_type *const column_numbers = this->get_sparsity_pattern().colnums; // solve (LU)'x=b in two steps: @@ -249,7 +255,7 @@ void SparseILU<number>::Tvmult (Vector<somenumber> &dst, Vector<somenumber> tmp (N); dst = src; - for (unsigned int row=0; row<N; ++row) + for (size_type row=0; row<N; ++row) { dst(row) -= tmp (row); // scale by the diagonal element. @@ -258,15 +264,15 @@ void SparseILU<number>::Tvmult (Vector<somenumber> &dst, dst(row) *= this->diag_element(row); // get end of this row - const unsigned int *const rowend = &column_numbers[rowstart_indices[row+1]]; + const size_type *const rowend = &column_numbers[rowstart_indices[row+1]]; // find the position where the part // right of the diagonal starts - const unsigned int *const first_after_diagonal = this->prebuilt_lower_bound[row]; + const size_type *const first_after_diagonal = this->prebuilt_lower_bound[row]; const somenumber dst_row = dst (row); const number *luval = this->SparseMatrix<number>::val + (first_after_diagonal - column_numbers); - for (const unsigned int *col=first_after_diagonal; col!=rowend; ++col, ++luval) + for (const size_type *col=first_after_diagonal; col!=rowend; ++col, ++luval) tmp(*col) += *luval * dst_row; } @@ -285,15 +291,15 @@ void SparseILU<number>::Tvmult (Vector<somenumber> &dst, // get start of this row. skip the // diagonal element - const unsigned int *const rowstart = &column_numbers[rowstart_indices[row]+1]; + const size_type *const rowstart = &column_numbers[rowstart_indices[row]+1]; // find the position where the part // right of the diagonal starts - const unsigned int *const first_after_diagonal = this->prebuilt_lower_bound[row]; + const size_type *const first_after_diagonal = this->prebuilt_lower_bound[row]; const somenumber dst_row = dst (row); const number *luval = this->SparseMatrix<number>::val + (rowstart - column_numbers); - for (const unsigned int *col=rowstart; col!=first_after_diagonal; ++col, ++luval) + for (const size_type *col=rowstart; col!=first_after_diagonal; ++col, ++luval) tmp(*col) += *luval * dst_row; } } diff --git a/deal.II/include/deal.II/lac/sparse_matrix.h b/deal.II/include/deal.II/lac/sparse_matrix.h index 1eacd52948..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 @@ -19,6 +24,8 @@ #include <deal.II/lac/sparsity_pattern.h> #include <deal.II/lac/identity_matrix.h> #include <deal.II/lac/exceptions.h> +// Included for VectorOperation +#include <deal.II/lac/vector.h> DEAL_II_NAMESPACE_OPEN @@ -27,7 +34,6 @@ template <typename number> class FullMatrix; template <typename Matrix> class BlockMatrixBase; template <typename number> class SparseILU; - #ifdef DEAL_II_WITH_TRILINOS namespace TrilinosWrappers { @@ -46,6 +52,11 @@ namespace TrilinosWrappers */ namespace SparseMatrixIterators { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + // forward declaration template <typename number, bool Constness> class Iterator; @@ -105,9 +116,9 @@ namespace SparseMatrixIterators * @deprecated This constructor is deprecated. Use the other constructor * with a global index instead. */ - Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index) DEAL_II_DEPRECATED; + Accessor (MatrixType *matrix, + const size_type row, + const size_type index) DEAL_II_DEPRECATED; /** * Constructor. @@ -247,9 +258,9 @@ namespace SparseMatrixIterators /** * Constructor. */ - Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index); + Accessor (MatrixType *matrix, + const size_type row, + const size_type index); /** * Constructor. @@ -353,9 +364,9 @@ namespace SparseMatrixIterators * @deprecated This constructor is deprecated. Use the other constructor * with a global index instead. */ - Iterator (MatrixType *matrix, - const unsigned int row, - const unsigned int index) DEAL_II_DEPRECATED; + Iterator (MatrixType *matrix, + const size_type row, + const size_type index) DEAL_II_DEPRECATED; /** * Constructor. Create an iterator into the matrix @p matrix for the given @@ -431,7 +442,7 @@ namespace SparseMatrixIterators /** * Return an iterator that is @p n ahead of the current one. */ - Iterator operator + (const unsigned int n) const; + Iterator operator + (const size_type n) const; private: /** @@ -470,13 +481,19 @@ namespace SparseMatrixIterators * @<double@></tt>; others can be generated in application programs (see the * section on @ref Instantiations in the manual). * + * @ingroup Matrix1 * @author Essentially everyone who has ever worked on deal.II - * @date 1994-2010 + * @date 1994-2013 */ template <typename number> class SparseMatrix : public virtual Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Type of matrix entries. In analogy to the STL container classes. */ @@ -650,25 +667,25 @@ public: * Return the dimension of the image space. To remember: the matrix is of * dimension $m \times n$. */ - unsigned int m () const; + size_type m () const; /** * Return the dimension of the range space. To remember: the matrix is of * dimension $m \times n$. */ - unsigned int n () const; + size_type n () const; /** * Return the number of entries in a specific row. */ - unsigned int get_row_length (const unsigned int row) const; + size_type get_row_length (const size_type row) const; /** * Return the number of nonzero elements of this matrix. Actually, it * returns the number of entries in the sparsity pattern; if any of the * entries should happen to be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the number of actually nonzero elements of this matrix. It is @@ -679,7 +696,7 @@ public: * count all entries of the sparsity pattern but only the ones that are * nonzero (or whose absolute value is greater than threshold). */ - unsigned int n_actually_nonzero_elements (const double threshold = 0.) const; + size_type n_actually_nonzero_elements (const double threshold = 0.) const; /** * Return a (constant) reference to the underlying sparsity pattern of this @@ -697,6 +714,11 @@ public: */ std::size_t memory_consumption () const; + /** + * Dummy function for compatibility with distributed, parallel matrices. + */ + void compress (::dealii::VectorOperation::values); + //@} /** * @name Modifying entries @@ -707,8 +729,8 @@ public: * entry does not exist or if <tt>value</tt> is not a finite number. Still, * it is allowed to store zero values in non-existent fields. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const number value); /** @@ -727,7 +749,7 @@ public: * treated. */ template <typename number2> - void set (const std::vector<unsigned int> &indices, + void set (const std::vector<size_type> &indices, const FullMatrix<number2> &full_matrix, const bool elide_zero_values = false); @@ -737,10 +759,10 @@ public: * and columns, respectively. */ template <typename number2> - void set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number2> &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number2> &full_matrix, + const bool elide_zero_values = false); /** * Set several elements in the specified row of the matrix with column @@ -753,10 +775,10 @@ public: * treated. */ template <typename number2> - void set (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number2> &values, - const bool elide_zero_values = false); + void set (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number2> &values, + const bool elide_zero_values = false); /** * Set several elements to values given by <tt>values</tt> in a given row in @@ -768,19 +790,19 @@ public: * inserted/replaced. */ template <typename number2> - void set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values = false); + void set (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values = false); /** * Add <tt>value</tt> to the element (<i>i,j</i>). Throws an error if the * entry does not exist or if <tt>value</tt> is not a finite number. Still, * it is allowed to store zero values in non-existent fields. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const number value); /** @@ -798,9 +820,9 @@ public: * i.e., zero values won't be added into the matrix. */ template <typename number2> - void add (const std::vector<unsigned int> &indices, - const FullMatrix<number2> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &indices, + const FullMatrix<number2> &full_matrix, + const bool elide_zero_values = true); /** * Same function as before, but now including the possibility to use @@ -808,10 +830,10 @@ public: * and columns, respectively. */ template <typename number2> - void add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number2> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number2> &full_matrix, + const bool elide_zero_values = true); /** * Set several elements in the specified row of the matrix with column @@ -823,10 +845,10 @@ public: * i.e., zero values won't be added into the matrix. */ template <typename number2> - void add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number2> &values, - const bool elide_zero_values = true); + void add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number2> &values, + const bool elide_zero_values = true); /** * Add an array of values given by <tt>values</tt> in the given global @@ -838,12 +860,12 @@ public: * i.e., zero values won't be added into the matrix. */ template <typename number2> - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Multiply the entire matrix by a fixed factor. @@ -927,7 +949,7 @@ public: SparseMatrix<number> & copy_from (const TrilinosWrappers::SparseMatrix &matrix); #endif - + /** * Add <tt>matrix</tt> scaled by <tt>factor</tt> to this matrix, i.e. the * matrix <tt>factor*matrix</tt> is added to <tt>this</tt>. This function @@ -962,8 +984,8 @@ public: * classes instead, since they are tailored better to a sparse matrix * structure. */ - number operator () (const unsigned int i, - const unsigned int j) const; + number operator () (const size_type i, + const size_type j) const; /** * This function is mostly like operator()() in that it returns the value of @@ -977,8 +999,8 @@ public: * classes instead, since they are tailored better to a sparse matrix * structure. */ - number el (const unsigned int i, - const unsigned int j) const; + number el (const size_type i, + const size_type j) const; /** * Return the main diagonal element in the <i>i</i>th row. This function @@ -990,13 +1012,13 @@ public: * each row and access therefore does not involve searching for the right * column number. */ - number diag_element (const unsigned int i) const; + number diag_element (const size_type i) const; /** * Same as above, but return a writeable reference. You're sure you know * what you do? */ - number &diag_element (const unsigned int i); + number &diag_element (const size_type i); /** * Access to values in internal mode. Returns the value of the @@ -1006,8 +1028,8 @@ public: * * @deprecated Use iterator or const_iterator instead! */ - number raw_entry (const unsigned int row, - const unsigned int index) const DEAL_II_DEPRECATED; + number raw_entry (const size_type row, + const size_type index) const DEAL_II_DEPRECATED; /** * This is for hackers. Get access to the <i>i</i>th element of this @@ -1022,14 +1044,14 @@ public: * * @internal @deprecated Use iterator or const_iterator instead! */ - number global_entry (const unsigned int i) const DEAL_II_DEPRECATED; + number global_entry (const size_type i) const DEAL_II_DEPRECATED; /** * Same as above, but with write access. You certainly know what you do? * * @internal @deprecated Use iterator or const_iterator instead! */ - number &global_entry (const unsigned int i) DEAL_II_DEPRECATED; + number &global_entry (const size_type i) DEAL_II_DEPRECATED; //@} /** @@ -1313,8 +1335,8 @@ public: */ template <typename somenumber> void PSOR (Vector<somenumber> &v, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number om = 1.) const; /** @@ -1329,8 +1351,8 @@ public: */ template <typename somenumber> void TPSOR (Vector<somenumber> &v, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number om = 1.) const; /** @@ -1415,7 +1437,7 @@ public: * Note also the discussion in the general documentation of this class about * the order in which elements are accessed. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row <tt>r</tt>. It points to the first element past the @@ -1426,7 +1448,7 @@ public: * particular the case if it is the end iterator for the last row of a * matrix. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; /** * STL-like iterator with the first entry of row <tt>r</tt>. This is the @@ -1440,7 +1462,7 @@ public: * Note the discussion in the general documentation of this class about * the order in which elements are accessed. */ - iterator begin (const unsigned int r); + iterator begin (const size_type r); /** * Final iterator of row <tt>r</tt>. It points to the first element past the @@ -1451,7 +1473,7 @@ public: * particular the case if it is the end iterator for the last row of a * matrix. */ - iterator end (const unsigned int r); + iterator end (const size_type r); //@} /** * @name Input/Output @@ -1459,13 +1481,18 @@ public: //@{ /** - * Print the matrix to the given stream, using the format <tt>(row,column) - * value</tt>, 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 + * <tt>(row,column) value</tt>, i.e. one nonzero entry of the matrix + * per line. If <tt>across</tt> is true, print all entries on a + * single line, using the format row,column:value. + * + * If the argument <tt>diagonal_first</tt> 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 <class STREAM> - 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 @@ -1637,7 +1664,7 @@ private: template <typename number> inline -unsigned int SparseMatrix<number>::m () const +typename SparseMatrix<number>::size_type SparseMatrix<number>::m () const { Assert (cols != 0, ExcNotInitialized()); return cols->rows; @@ -1646,7 +1673,7 @@ unsigned int SparseMatrix<number>::m () const template <typename number> inline -unsigned int SparseMatrix<number>::n () const +typename SparseMatrix<number>::size_type SparseMatrix<number>::n () const { Assert (cols != 0, ExcNotInitialized()); return cols->cols; @@ -1657,13 +1684,13 @@ unsigned int SparseMatrix<number>::n () const template <typename number> inline void -SparseMatrix<number>::set (const unsigned int i, - const unsigned int j, +SparseMatrix<number>::set (const size_type i, + const size_type j, const number value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const unsigned int index = cols->operator()(i, j); + const size_type index = cols->operator()(i, j); // it is allowed to set elements of the matrix that are not part of the // sparsity pattern, if the value to which we set it is zero @@ -1684,15 +1711,15 @@ template <typename number> template <typename number2> inline void -SparseMatrix<number>::set (const std::vector<unsigned int> &indices, - const FullMatrix<number2> &values, - const bool elide_zero_values) +SparseMatrix<number>::set (const std::vector<size_type> &indices, + const FullMatrix<number2> &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) set (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -1703,17 +1730,17 @@ template <typename number> template <typename number2> inline void -SparseMatrix<number>::set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number2> &values, - const bool elide_zero_values) +SparseMatrix<number>::set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number2> &values, + const bool elide_zero_values) { Assert (row_indices.size() == values.m(), ExcDimensionMismatch(row_indices.size(), values.m())); Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -1724,10 +1751,10 @@ template <typename number> template <typename number2> inline void -SparseMatrix<number>::set (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number2> &values, - const bool elide_zero_values) +SparseMatrix<number>::set (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number2> &values, + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1741,16 +1768,16 @@ SparseMatrix<number>::set (const unsigned int row, template <typename number> inline void -SparseMatrix<number>::add (const unsigned int i, - const unsigned int j, - const number value) +SparseMatrix<number>::add (const size_type i, + const size_type j, + const number value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); if (value == 0) return; - const unsigned int index = cols->operator()(i, j); + const size_type index = cols->operator()(i, j); // it is allowed to add elements to the matrix that are not part of the // sparsity pattern, if the value to which we set it is zero @@ -1771,15 +1798,15 @@ template <typename number> template <typename number2> inline void -SparseMatrix<number>::add (const std::vector<unsigned int> &indices, - const FullMatrix<number2> &values, - const bool elide_zero_values) +SparseMatrix<number>::add (const std::vector<size_type> &indices, + const FullMatrix<number2> &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) add (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -1790,17 +1817,17 @@ template <typename number> template <typename number2> inline void -SparseMatrix<number>::add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number2> &values, - const bool elide_zero_values) +SparseMatrix<number>::add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number2> &values, + const bool elide_zero_values) { Assert (row_indices.size() == values.m(), ExcDimensionMismatch(row_indices.size(), values.m())); Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -1811,10 +1838,10 @@ template <typename number> template <typename number2> inline void -SparseMatrix<number>::add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number2> &values, - const bool elide_zero_values) +SparseMatrix<number>::add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number2> &values, + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1868,8 +1895,8 @@ SparseMatrix<number>::operator /= (const number factor) template <typename number> inline -number SparseMatrix<number>::operator () (const unsigned int i, - const unsigned int j) const +number SparseMatrix<number>::operator () (const size_type i, + const size_type j) const { Assert (cols != 0, ExcNotInitialized()); Assert (cols->operator()(i,j) != SparsityPattern::invalid_entry, @@ -1881,11 +1908,11 @@ number SparseMatrix<number>::operator () (const unsigned int i, template <typename number> inline -number SparseMatrix<number>::el (const unsigned int i, - const unsigned int j) const +number SparseMatrix<number>::el (const size_type i, + const size_type j) const { Assert (cols != 0, ExcNotInitialized()); - const unsigned int index = cols->operator()(i,j); + const size_type index = cols->operator()(i,j); if (index != SparsityPattern::invalid_entry) return val[index]; @@ -1897,7 +1924,7 @@ number SparseMatrix<number>::el (const unsigned int i, template <typename number> inline -number SparseMatrix<number>::diag_element (const unsigned int i) const +number SparseMatrix<number>::diag_element (const size_type i) const { Assert (cols != 0, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); @@ -1912,7 +1939,7 @@ number SparseMatrix<number>::diag_element (const unsigned int i) const template <typename number> inline -number &SparseMatrix<number>::diag_element (const unsigned int i) +number &SparseMatrix<number>::diag_element (const size_type i) { Assert (cols != 0, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); @@ -1928,8 +1955,8 @@ number &SparseMatrix<number>::diag_element (const unsigned int i) template <typename number> inline number -SparseMatrix<number>::raw_entry (const unsigned int row, - const unsigned int index) const +SparseMatrix<number>::raw_entry (const size_type row, + const size_type index) const { Assert(row<cols->rows, ExcIndexRange(row,0,cols->rows)); Assert(index<cols->row_length(row), @@ -1943,7 +1970,7 @@ SparseMatrix<number>::raw_entry (const unsigned int row, template <typename number> inline -number SparseMatrix<number>::global_entry (const unsigned int j) const +number SparseMatrix<number>::global_entry (const size_type j) const { Assert (cols != 0, ExcNotInitialized()); Assert (j < cols->n_nonzero_elements(), @@ -1956,7 +1983,7 @@ number SparseMatrix<number>::global_entry (const unsigned int j) const template <typename number> inline -number &SparseMatrix<number>::global_entry (const unsigned int j) +number &SparseMatrix<number>::global_entry (const size_type j) { Assert (cols != 0, ExcNotInitialized()); Assert (j < cols->n_nonzero_elements(), @@ -1973,13 +2000,13 @@ void SparseMatrix<number>::copy_from (const ForwardIterator begin, const ForwardIterator end) { - Assert (static_cast<unsigned int>(std::distance (begin, end)) == m(), + Assert (static_cast<size_type>(std::distance (begin, end)) == m(), ExcIteratorRange (std::distance (begin, end), m())); // for use in the inner loop, we define a typedef to the type of the inner // iterators typedef typename std::iterator_traits<ForwardIterator>::value_type::const_iterator inner_iterator; - unsigned int row=0; + size_type row=0; for (ForwardIterator i=begin; i!=end; ++i, ++row) { const inner_iterator end_of_row = i->end(); @@ -1998,9 +2025,9 @@ namespace SparseMatrixIterators template <typename number> inline Accessor<number,true>:: - Accessor (const MatrixType *matrix, - const unsigned int row, - const unsigned int index) + Accessor (const MatrixType *matrix, + const size_type row, + const size_type index) : SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern(), row, index), @@ -2148,9 +2175,9 @@ namespace SparseMatrixIterators template <typename number> inline Accessor<number,false>:: - Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index) + Accessor (MatrixType *matrix, + const size_type row, + const size_type index) : SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern(), row, index), @@ -2207,9 +2234,9 @@ namespace SparseMatrixIterators template <typename number, bool Constness> inline Iterator<number, Constness>:: - Iterator (MatrixType *matrix, - const unsigned int r, - const unsigned int i) + Iterator (MatrixType *matrix, + const size_type r, + const size_type i) : accessor(matrix, r, i) {} @@ -2347,10 +2374,10 @@ namespace SparseMatrixIterators inline Iterator<number,Constness> Iterator<number,Constness>:: - operator + (const unsigned int n) const + operator + (const size_type n) const { Iterator x = *this; - for (unsigned int i=0; i<n; ++i) + for (size_type i=0; i<n; ++i) ++x; return x; @@ -2399,7 +2426,7 @@ SparseMatrix<number>::end () template <typename number> inline typename SparseMatrix<number>::const_iterator -SparseMatrix<number>::begin (const unsigned int r) const +SparseMatrix<number>::begin (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); @@ -2411,7 +2438,7 @@ SparseMatrix<number>::begin (const unsigned int r) const template <typename number> inline typename SparseMatrix<number>::const_iterator -SparseMatrix<number>::end (const unsigned int r) const +SparseMatrix<number>::end (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); @@ -2423,7 +2450,7 @@ SparseMatrix<number>::end (const unsigned int r) const template <typename number> inline typename SparseMatrix<number>::iterator -SparseMatrix<number>::begin (const unsigned int r) +SparseMatrix<number>::begin (const size_type r) { Assert (r<m(), ExcIndexRange(r,0,m())); @@ -2435,7 +2462,7 @@ SparseMatrix<number>::begin (const unsigned int r) template <typename number> inline typename SparseMatrix<number>::iterator -SparseMatrix<number>::end (const unsigned int r) +SparseMatrix<number>::end (const size_type r) { Assert (r<m(), ExcIndexRange(r,0,m())); @@ -2447,22 +2474,50 @@ SparseMatrix<number>::end (const unsigned int r) template <typename number> template <class STREAM> inline -void SparseMatrix<number>::print (STREAM &out, bool across) const +void SparseMatrix<number>::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; i<cols->rows; ++i) { - for (unsigned int i=0; i<cols->rows; ++i) - for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j) - out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; - out << std::endl; + for (size_type j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j) + { + 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; + } } - else - for (unsigned int i=0; i<cols->rows; ++i) - for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j) - out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; + 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 ce97bbcaee..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 @@ -103,7 +108,7 @@ SparseMatrix<number>::SparseMatrix (const SparsityPattern &c, Assert (c.n_cols() == id.n(), ExcDimensionMismatch (c.n_cols(), id.n())); reinit (c); - for (unsigned int i=0; i<n(); ++i) + for (size_type i=0; i<n(); ++i) this->set(i,i,1.); } @@ -124,9 +129,11 @@ namespace internal { namespace SparseMatrix { + typedef types::global_dof_index size_type; + template<typename T> - void zero_subrange (const unsigned int begin, - const unsigned int end, + void zero_subrange (const size_type begin, + const size_type end, T *dst) { std::memset (dst+begin,0,(end-begin)*sizeof(T)); @@ -152,8 +159,8 @@ SparseMatrix<number>::operator = (const double d) // operator=. The grain size is chosen to reflect the number of rows in // minimum_parallel_grain_size, weighted by the number of nonzero entries // per row on average. - const unsigned int matrix_size = cols->n_nonzero_elements(); - const unsigned int grain_size = + const size_type matrix_size = cols->n_nonzero_elements(); + const size_type grain_size = internal::SparseMatrix::minimum_parallel_grain_size * (cols->n_nonzero_elements()+m()) / m(); if (matrix_size>grain_size) @@ -181,7 +188,7 @@ SparseMatrix<number>::operator= (const IdentityMatrix &id) ExcDimensionMismatch (cols->n_cols(), id.n())); *this = 0; - for (unsigned int i=0; i<n(); ++i) + for (size_type i=0; i<n(); ++i) this->set(i,i,1.); return *this; @@ -243,8 +250,8 @@ SparseMatrix<number>::empty () const template <typename number> -unsigned int -SparseMatrix<number>::get_row_length (const unsigned int row) const +typename SparseMatrix<number>::size_type +SparseMatrix<number>::get_row_length (const size_type row) const { Assert (cols != 0, ExcNotInitialized()); return cols->row_length(row); @@ -253,7 +260,7 @@ SparseMatrix<number>::get_row_length (const unsigned int row) const template <typename number> -unsigned int +typename SparseMatrix<number>::size_type SparseMatrix<number>::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -263,14 +270,14 @@ SparseMatrix<number>::n_nonzero_elements () const template <typename number> -unsigned int +typename SparseMatrix<number>::size_type SparseMatrix<number>::n_actually_nonzero_elements (const double threshold) const { Assert (cols != 0, ExcNotInitialized()); Assert (threshold >= 0, ExcMessage ("Negative threshold!")); - unsigned int nnz = 0; - const unsigned int nnz_alloc = n_nonzero_elements(); - for (unsigned int i=0; i<nnz_alloc; ++i) + size_type nnz = 0; + const size_type nnz_alloc = n_nonzero_elements(); + for (size_type i=0; i<nnz_alloc; ++i) if (std::fabs(val[i]) > threshold) ++nnz; return nnz; @@ -285,15 +292,15 @@ SparseMatrix<number>::symmetrize () Assert (cols != 0, ExcNotInitialized()); Assert (cols->rows == cols->cols, ExcNotQuadratic()); - const unsigned int n_rows = m(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = m(); + for (size_type row=0; row<n_rows; ++row) { // first skip diagonal entry number *val_ptr = &val[cols->rowstart[row]]; if (m() == n()) ++val_ptr; - const unsigned int *colnum_ptr = &cols->colnums[cols->rowstart[row]+1]; - const number *const val_end_of_row = &val[cols->rowstart[row+1]]; + const size_type *colnum_ptr = &cols->colnums[cols->rowstart[row]+1]; + const number *const val_end_of_row = &val[cols->rowstart[row+1]]; // treat lower left triangle while ((val_ptr != val_end_of_row) && (*colnum_ptr<row)) @@ -343,8 +350,8 @@ SparseMatrix<number>::copy_from (const FullMatrix<somenumber> &matrix) *this = 0; // then copy old matrix - for (unsigned int row=0; row<matrix.m(); ++row) - for (unsigned int col=0; col<matrix.n(); ++col) + for (size_type row=0; row<matrix.m(); ++row) + for (size_type col=0; col<matrix.n(); ++col) if (matrix(row,col) != 0) set (row, col, matrix(row,col)); } @@ -359,14 +366,14 @@ SparseMatrix<number>::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; std::vector < TrilinosScalar > value_cache; - std::vector<unsigned int> colnum_cache; + std::vector<size_type> colnum_cache; - for (unsigned int row = 0; row < matrix.m(); ++row) + for (size_type row = 0; row < matrix.m(); ++row) { value_cache.resize(matrix.n()); colnum_cache.resize(matrix.n()); @@ -375,10 +382,10 @@ SparseMatrix<number>::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<int*>(&(colnum_cache[0]))); + = matrix.trilinos_matrix().ExtractGlobalRowCopy + (row, matrix.row_length(row), ncols, + &(value_cache[0]), + reinterpret_cast<TrilinosWrappers::types::int_type *>(&(colnum_cache[0]))); Assert (ierr==0, ExcTrilinosError(ierr)); // resize arrays to the size actually used @@ -387,8 +394,8 @@ SparseMatrix<number>::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; @@ -412,7 +419,7 @@ SparseMatrix<number>::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++; } @@ -432,21 +439,21 @@ namespace internal template <typename number, typename InVector, typename OutVector> - void vmult_on_subrange (const unsigned int begin_row, - const unsigned int end_row, - const number *values, + void vmult_on_subrange (const size_type begin_row, + const size_type end_row, + const number *values, const std::size_t *rowstart, - const unsigned int *colnums, - const InVector &src, - OutVector &dst, - const bool add) + const size_type *colnums, + const InVector &src, + OutVector &dst, + const bool add) { - const number *val_ptr = &values[rowstart[begin_row]]; - const unsigned int *colnum_ptr = &colnums[rowstart[begin_row]]; + const number *val_ptr = &values[rowstart[begin_row]]; + const size_type *colnum_ptr = &colnums[rowstart[begin_row]]; typename OutVector::iterator dst_ptr = dst.begin() + begin_row; if (add == false) - for (unsigned int row=begin_row; row<end_row; ++row) + for (size_type row=begin_row; row<end_row; ++row) { typename OutVector::value_type s = 0.; const number *const val_end_of_row = &values[rowstart[row+1]]; @@ -455,7 +462,7 @@ namespace internal *dst_ptr++ = s; } else - for (unsigned int row=begin_row; row<end_row; ++row) + for (size_type row=begin_row; row<end_row; ++row) { typename OutVector::value_type s = *dst_ptr; const number *const val_end_of_row = &values[rowstart[row+1]]; @@ -471,12 +478,12 @@ namespace internal template <typename number> template <typename number2> void -SparseMatrix<number>::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values, - const bool col_indices_are_sorted) +SparseMatrix<number>::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values, + const bool col_indices_are_sorted) { Assert (cols != 0, ExcNotInitialized()); @@ -491,14 +498,14 @@ SparseMatrix<number>::add (const unsigned int row, // check whether the given indices are // really sorted #ifdef DEBUG - for (unsigned int i=1; i<n_cols; ++i) + for (size_type i=1; i<n_cols; ++i) Assert (col_indices[i] > col_indices[i-1], ExcMessage("List of indices is unsorted or contains duplicates.")); #endif - const unsigned int *this_cols = + const size_type *this_cols = &cols->colnums[cols->rowstart[row]]; - const unsigned int row_length_1 = cols->row_length(row)-1; + const size_type row_length_1 = cols->row_length(row)-1; number *val_ptr = &val[cols->rowstart[row]]; if (m() == n()) @@ -506,12 +513,12 @@ SparseMatrix<number>::add (const unsigned int row, // find diagonal and add it if found Assert (this_cols[0] == row, ExcInternalError()); - const unsigned int *diag_pos = + const size_type *diag_pos = Utilities::lower_bound (col_indices, col_indices+n_cols, row); - const unsigned int diag = diag_pos - col_indices; - unsigned int post_diag = diag; + const size_type diag = diag_pos - col_indices; + size_type post_diag = diag; if (diag != n_cols && *diag_pos == row) { val_ptr[0] += *(values+(diag_pos-col_indices)); @@ -519,8 +526,8 @@ SparseMatrix<number>::add (const unsigned int row, } // add indices before diagonal - unsigned int counter = 1; - for (unsigned int i=0; i<diag; ++i) + size_type counter = 1; + for (size_type i=0; i<diag; ++i) { while (this_cols[counter]<col_indices[i] && counter<row_length_1) ++counter; @@ -532,7 +539,7 @@ SparseMatrix<number>::add (const unsigned int row, } // add indices after diagonal - for (unsigned int i=post_diag; i<n_cols; ++i) + for (size_type i=post_diag; i<n_cols; ++i) { while (this_cols[counter]<col_indices[i] && counter<row_length_1) ++counter; @@ -548,8 +555,8 @@ SparseMatrix<number>::add (const unsigned int row, } else { - unsigned int counter = 0; - for (unsigned int i=0; i<n_cols; ++i) + size_type counter = 0; + for (size_type i=0; i<n_cols; ++i) { while (this_cols[counter]<col_indices[i] && counter<row_length_1) ++counter; @@ -568,11 +575,11 @@ SparseMatrix<number>::add (const unsigned int row, // unsorted case: first, search all the // indices to find out which values we // actually need to add. - const unsigned int *const my_cols = cols->colnums; - unsigned int index = cols->rowstart[row]; - const unsigned int next_row_index = cols->rowstart[row+1]; + const size_type *const my_cols = cols->colnums; + size_type index = cols->rowstart[row]; + const size_type next_row_index = cols->rowstart[row+1]; - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const number value = values[j]; Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -615,11 +622,11 @@ add_value: template <typename number> template <typename number2> void -SparseMatrix<number>::set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values) +SparseMatrix<number>::set (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values) { Assert (cols != 0, ExcNotInitialized()); Assert (row < m(), ExcInvalidIndex1(row)); @@ -627,13 +634,13 @@ SparseMatrix<number>::set (const unsigned int row, // First, search all the indices to find // out which values we actually need to // set. - const unsigned int *my_cols = cols->colnums; + const size_type *my_cols = cols->colnums; std::size_t index = cols->rowstart[row], next_index = index; const std::size_t next_row_index = cols->rowstart[row+1]; if (elide_zero_values == true) { - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const number value = values[j]; Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -669,7 +676,7 @@ set_value: else { // same code as above, but now check for zeros - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const number value = values[j]; Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -738,11 +745,11 @@ SparseMatrix<number>::Tvmult (OutVector &dst, dst = 0; - for (unsigned int i=0; i<m(); i++) + for (size_type i=0; i<m(); i++) { - for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1] ; j++) + for (size_type j=cols->rowstart[i]; j<cols->rowstart[i+1] ; j++) { - const unsigned int p = cols->colnums[j]; + const size_type p = cols->colnums[j]; dst(p) += val[j] * src(i); } } @@ -791,10 +798,10 @@ SparseMatrix<number>::Tvmult_add (OutVector &dst, Assert (!PointerComparison::equal(&src, &dst), ExcSourceEqualsDestination()); - for (unsigned int i=0; i<m(); i++) - for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1] ; j++) + for (size_type i=0; i<m(); i++) + for (size_type j=cols->rowstart[i]; j<cols->rowstart[i+1] ; j++) { - const unsigned int p = cols->colnums[j]; + const size_type p = cols->colnums[j]; dst(p) += val[j] * src(i); } } @@ -817,19 +824,19 @@ namespace internal */ template <typename number, typename InVector> - number matrix_norm_sqr_on_subrange (const unsigned int begin_row, - const unsigned int end_row, - const number *values, + number matrix_norm_sqr_on_subrange (const size_type begin_row, + const size_type end_row, + const number *values, const std::size_t *rowstart, - const unsigned int *colnums, - const InVector &v) + const size_type *colnums, + const InVector &v) { number norm_sqr=0.; - for (unsigned int i=begin_row; i<end_row; ++i) + for (size_type i=begin_row; i<end_row; ++i) { number s = 0; - for (unsigned int j=rowstart[i]; j<rowstart[i+1] ; j++) + for (size_type j=rowstart[i]; j<rowstart[i+1] ; j++) s += values[j] * v(colnums[j]); norm_sqr += v(i)*numbers::NumberTraits<number>::conjugate(s); } @@ -880,20 +887,20 @@ namespace internal */ template <typename number, typename InVector> - number matrix_scalar_product_on_subrange (const unsigned int begin_row, - const unsigned int end_row, - const number *values, + number matrix_scalar_product_on_subrange (const size_type begin_row, + const size_type end_row, + const number *values, const std::size_t *rowstart, - const unsigned int *colnums, - const InVector &u, - const InVector &v) + const size_type *colnums, + const InVector &u, + const InVector &v) { number norm_sqr=0.; - for (unsigned int i=begin_row; i<end_row; ++i) + for (size_type i=begin_row; i<end_row; ++i) { number s = 0; - for (unsigned int j=rowstart[i]; j<rowstart[i+1] ; j++) + for (size_type j=rowstart[i]; j<rowstart[i+1] ; j++) s += values[j] * v(colnums[j]); norm_sqr += u(i)*numbers::NumberTraits<number>::conjugate(s); } @@ -971,18 +978,18 @@ SparseMatrix<number>::mmult (SparseMatrix<numberC> &C, // CompressedSimpleSparsityPattern class. { CompressedSimpleSparsityPattern csp (m(), B.n()); - for (unsigned int i = 0; i < csp.n_rows(); ++i) + for (size_type i = 0; i < csp.n_rows(); ++i) { - const unsigned int *rows = &sp_A.colnums[sp_A.rowstart[i]]; - const unsigned int *const end_rows = + const size_type *rows = &sp_A.colnums[sp_A.rowstart[i]]; + const size_type *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; for (; rows != end_rows; ++rows) { - const unsigned int col = *rows; - unsigned int *new_cols = const_cast<unsigned int *> - (&sp_B.colnums[sp_B.rowstart[col]]); - unsigned int *end_new_cols = const_cast<unsigned int *> - (&sp_B.colnums[sp_B.rowstart[col+1]]); + const size_type col = *rows; + size_type *new_cols = const_cast<size_type *> + (&sp_B.colnums[sp_B.rowstart[col]]); + size_type *end_new_cols = const_cast<size_type *> + (&sp_B.colnums[sp_B.rowstart[col+1]]); // if B has a diagonal, need to add that manually. this way, // we maintain sortedness. @@ -1009,7 +1016,7 @@ SparseMatrix<number>::mmult (SparseMatrix<numberC> &C, // elements that are going to be written // into the new matrix. unsigned int max_n_cols_B = 0; - for (unsigned int i=0; i<B.m(); ++i) + for (size_type i=0; i<B.m(); ++i) max_n_cols_B = std::max (max_n_cols_B, sp_B.row_length(i)); std::vector<numberC> new_entries(max_n_cols_B); @@ -1017,15 +1024,15 @@ SparseMatrix<number>::mmult (SparseMatrix<numberC> &C, // nested loops. One over the rows of A, for each row we then loop over all // the columns, and then we need to multiply each element with all the // elements in that row in B. - for (unsigned int i=0; i<C.m(); ++i) + for (size_type i=0; i<C.m(); ++i) { - const unsigned int *rows = &sp_A.colnums[sp_A.rowstart[i]]; - const unsigned int *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; + const size_type *rows = &sp_A.colnums[sp_A.rowstart[i]]; + const size_type *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; for (; rows != end_rows; ++rows) { const double A_val = val[rows-&sp_A.colnums[sp_A.rowstart[0]]]; - const unsigned int col = *rows; - const unsigned int *new_cols = + const size_type col = *rows; + const size_type *new_cols = (&sp_B.colnums[sp_B.rowstart[col]]); // special treatment for diagonal @@ -1045,7 +1052,7 @@ SparseMatrix<number>::mmult (SparseMatrix<numberC> &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); @@ -1098,24 +1105,24 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC> &C, // CompressedSimpleSparsityPattern class. { CompressedSimpleSparsityPattern csp (n(), B.n()); - for (unsigned int i = 0; i < sp_A.n_rows(); ++i) + for (size_type i = 0; i < sp_A.n_rows(); ++i) { - const unsigned int *rows = + const size_type *rows = &sp_A.colnums[sp_A.rowstart[i]]; - const unsigned int *const end_rows = + const size_type *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; // cast away constness to conform with csp.add_entries interface - unsigned int *new_cols = const_cast<unsigned int *> - (&sp_B.colnums[sp_B.rowstart[i]]); - unsigned int *end_new_cols = const_cast<unsigned int *> - (&sp_B.colnums[sp_B.rowstart[i+1]]); + size_type *new_cols = const_cast<size_type *> + (&sp_B.colnums[sp_B.rowstart[i]]); + size_type *end_new_cols = const_cast<size_type *> + (&sp_B.colnums[sp_B.rowstart[i+1]]); if (sp_B.n_rows() == sp_B.n_cols()) ++new_cols; for (; rows != end_rows; ++rows) { - const unsigned int row = *rows; + const size_type row = *rows; // if B has a diagonal, need to add that manually. this way, // we maintain sortedness. @@ -1139,7 +1146,7 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC> &C, // elements that are going to be written // into the new matrix. unsigned int max_n_cols_B = 0; - for (unsigned int i=0; i<B.m(); ++i) + for (size_type i=0; i<B.m(); ++i) max_n_cols_B = std::max (max_n_cols_B, sp_B.row_length(i)); std::vector<numberC> new_entries(max_n_cols_B); @@ -1147,11 +1154,11 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC> &C, // nested loops. One over the rows of A, for each row we then loop over all // the columns, and then we need to multiply each element with all the // elements in that row in B. - for (unsigned int i=0; i<m(); ++i) + for (size_type i=0; i<m(); ++i) { - const unsigned int *rows = &sp_A.colnums[sp_A.rowstart[i]]; - const unsigned int *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; - const unsigned int *new_cols = &sp_B.colnums[sp_B.rowstart[i]]; + const size_type *rows = &sp_A.colnums[sp_A.rowstart[i]]; + const size_type *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; + const size_type *new_cols = &sp_B.colnums[sp_B.rowstart[i]]; if (sp_B.n_rows() == sp_B.n_cols()) ++new_cols; @@ -1159,7 +1166,7 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC> &C, for (; rows != end_rows; ++rows) { - const unsigned int row = *rows; + const size_type row = *rows; const double A_val = val[rows-&sp_A.colnums[sp_A.rowstart[0]]]; // special treatment for diagonal @@ -1175,7 +1182,7 @@ SparseMatrix<number>::Tmmult (SparseMatrix<numberC> &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); @@ -1193,9 +1200,9 @@ SparseMatrix<number>::l1_norm () const Assert (val != 0, ExcNotInitialized()); Vector<real_type> column_sums(n()); - const unsigned int n_rows = m(); - for (unsigned int row=0; row<n_rows; ++row) - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1] ; ++j) + const size_type n_rows = m(); + for (size_type row=0; row<n_rows; ++row) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1] ; ++j) column_sums(cols->colnums[j]) += numbers::NumberTraits<number>::abs(val[j]); return column_sums.linfty_norm(); @@ -1213,8 +1220,8 @@ SparseMatrix<number>::linfty_norm () const const number *val_ptr = &val[cols->rowstart[0]]; real_type max=0; - const unsigned int n_rows = m(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = m(); + for (size_type row=0; row<n_rows; ++row) { real_type sum = 0; const number *const val_end_of_row = &val[cols->rowstart[row+1]]; @@ -1236,7 +1243,7 @@ SparseMatrix<number>::frobenius_norm () const // sparsity pattern, without taking any // reference to rows or columns real_type norm_sqr = 0; - const unsigned int n_rows = m(); + const size_type n_rows = m(); for (const number *ptr = &val[0]; ptr != &val[cols->rowstart[n_rows]]; ++ptr) norm_sqr += numbers::NumberTraits<number>::abs_square(*ptr); @@ -1264,21 +1271,21 @@ namespace internal template <typename number, typename InVector, typename OutVector> - number residual_sqr_on_subrange (const unsigned int begin_row, - const unsigned int end_row, - const number *values, + number residual_sqr_on_subrange (const size_type begin_row, + const size_type end_row, + const number *values, const std::size_t *rowstart, - const unsigned int *colnums, - const InVector &u, - const InVector &b, - OutVector &dst) + const size_type *colnums, + const InVector &u, + const InVector &b, + OutVector &dst) { number norm_sqr=0.; - for (unsigned int i=begin_row; i<end_row; ++i) + for (size_type i=begin_row; i<end_row; ++i) { number s = b(i); - for (unsigned int j=rowstart[i]; j<rowstart[i+1] ; j++) + for (size_type j=rowstart[i]; j<rowstart[i+1] ; j++) s -= values[j] * u(colnums[j]); dst(i) = s; norm_sqr += s*numbers::NumberTraits<number>::conjugate(s); @@ -1332,9 +1339,9 @@ SparseMatrix<number>::precondition_Jacobi (Vector<somenumber> &dst, AssertDimension (dst.size(), n()); AssertDimension (src.size(), n()); - const unsigned int n = src.size(); - somenumber *dst_ptr = dst.begin(); - const somenumber *src_ptr = src.begin(); + const size_type n = src.size(); + somenumber *dst_ptr = dst.begin(); + const somenumber *src_ptr = src.begin(); const std::size_t *rowstart_ptr = &cols->rowstart[0]; // optimize the following loop for @@ -1349,10 +1356,10 @@ SparseMatrix<number>::precondition_Jacobi (Vector<somenumber> &dst, // rowstart[i]. and we do have a // square matrix by above assertion if (om != 1.) - for (unsigned int i=0; i<n; ++i, ++dst_ptr, ++src_ptr, ++rowstart_ptr) - *dst_ptr = om * *src_ptr / val[*rowstart_ptr]; + for (size_type i=0; i<n; ++i, ++dst_ptr, ++src_ptr, ++rowstart_ptr) + *dst_ptr = om **src_ptr / val[*rowstart_ptr]; else - for (unsigned int i=0; i<n; ++i, ++dst_ptr, ++src_ptr, ++rowstart_ptr) + for (size_type i=0; i<n; ++i, ++dst_ptr, ++src_ptr, ++rowstart_ptr) *dst_ptr = *src_ptr / val[*rowstart_ptr]; } @@ -1376,9 +1383,9 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, AssertDimension (dst.size(), n()); AssertDimension (src.size(), n()); - const unsigned int n = src.size(); - const std::size_t *rowstart_ptr = &cols->rowstart[0]; - somenumber *dst_ptr = &dst(0); + const size_type n = src.size(); + const std::size_t *rowstart_ptr = &cols->rowstart[0]; + somenumber *dst_ptr = &dst(0); // case when we have stored the position // just right of the diagonal (then we @@ -1389,7 +1396,7 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, ExcDimensionMismatch (pos_right_of_diagonal.size(), dst.size())); // forward sweep - for (unsigned int row=0; row<n; ++row, ++dst_ptr, ++rowstart_ptr) + for (size_type row=0; row<n; ++row, ++dst_ptr, ++rowstart_ptr) { *dst_ptr = src(row); const std::size_t first_right_of_diagonal_index = @@ -1397,7 +1404,7 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, Assert (first_right_of_diagonal_index <= *(rowstart_ptr+1), ExcInternalError()); number s = 0; - for (unsigned int j=(*rowstart_ptr)+1; j<first_right_of_diagonal_index; ++j) + for (size_type j=(*rowstart_ptr)+1; j<first_right_of_diagonal_index; ++j) s += val[j] * dst(cols->colnums[j]); // divide by diagonal element @@ -1416,11 +1423,11 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, dst_ptr = &dst(n-1); for (int row=n-1; row>=0; --row, --rowstart_ptr, --dst_ptr) { - const unsigned int end_row = *(rowstart_ptr+1); - const unsigned int first_right_of_diagonal_index + const size_type end_row = *(rowstart_ptr+1); + const size_type first_right_of_diagonal_index = pos_right_of_diagonal[row]; number s = 0; - for (unsigned int j=first_right_of_diagonal_index; j<end_row; ++j) + for (size_type j=first_right_of_diagonal_index; j<end_row; ++j) s += val[j] * dst(cols->colnums[j]); *dst_ptr -= s * om; @@ -1434,7 +1441,7 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, // of the first element right of the // diagonal manually for each sweep. // forward sweep - for (unsigned int row=0; row<n; ++row, ++dst_ptr, ++rowstart_ptr) + for (size_type row=0; row<n; ++row, ++dst_ptr, ++rowstart_ptr) { *dst_ptr = src(row); // find the first element in this line @@ -1444,7 +1451,7 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, // note: the first entry in each // line denotes the diagonal element, // which we need not check. - const unsigned int first_right_of_diagonal_index + const size_type first_right_of_diagonal_index = (Utilities::lower_bound (&cols->colnums[*rowstart_ptr+1], &cols->colnums[*(rowstart_ptr+1)], row) @@ -1452,7 +1459,7 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, &cols->colnums[0]); number s = 0; - for (unsigned int j=(*rowstart_ptr)+1; j<first_right_of_diagonal_index; ++j) + for (size_type j=(*rowstart_ptr)+1; j<first_right_of_diagonal_index; ++j) s += val[j] * dst(cols->colnums[j]); // divide by diagonal element @@ -1463,7 +1470,7 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, rowstart_ptr = &cols->rowstart[0]; dst_ptr = &dst(0); - for (unsigned int row=0; row<n; ++row, ++rowstart_ptr, ++dst_ptr) + for (size_type row=0; row<n; ++row, ++rowstart_ptr, ++dst_ptr) *dst_ptr *= (2.-om)*val[*rowstart_ptr]; // backward sweep @@ -1471,14 +1478,14 @@ SparseMatrix<number>::precondition_SSOR (Vector<somenumber> &dst, dst_ptr = &dst(n-1); for (int row=n-1; row>=0; --row, --rowstart_ptr, --dst_ptr) { - const unsigned int end_row = *(rowstart_ptr+1); - const unsigned int first_right_of_diagonal_index + const size_type end_row = *(rowstart_ptr+1); + const size_type first_right_of_diagonal_index = (Utilities::lower_bound (&cols->colnums[*rowstart_ptr+1], &cols->colnums[end_row], - static_cast<unsigned int>(row)) - + static_cast<size_type>(row)) - &cols->colnums[0]); number s = 0; - for (unsigned int j=first_right_of_diagonal_index; j<end_row; ++j) + for (size_type j=first_right_of_diagonal_index; j<end_row; ++j) s += val[j] * dst(cols->colnums[j]); *dst_ptr -= s * om; Assert(val[*rowstart_ptr]!= 0., ExcDivideByZero()); @@ -1528,12 +1535,12 @@ SparseMatrix<number>::SOR (Vector<somenumber> &dst, AssertDimension (m(), n()); AssertDimension (dst.size(), n()); - for (unsigned int row=0; row<m(); ++row) + for (size_type row=0; row<m(); ++row) { somenumber s = dst(row); - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) { - const unsigned int col = cols->colnums[j]; + const size_type col = cols->colnums[j]; if (col < row) s -= val[j] * dst(col); } @@ -1555,11 +1562,11 @@ SparseMatrix<number>::TSOR (Vector<somenumber> &dst, AssertDimension (m(), n()); AssertDimension (dst.size(), n()); - unsigned int row=m()-1; + size_type row=m()-1; while (true) { somenumber s = dst(row); - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) if (cols->colnums[j] > row) s -= val[j] * dst(cols->colnums[j]); @@ -1578,8 +1585,8 @@ template <typename number> template <typename somenumber> void SparseMatrix<number>::PSOR (Vector<somenumber> &dst, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number om) const { Assert (cols != 0, ExcNotInitialized()); @@ -1592,14 +1599,14 @@ SparseMatrix<number>::PSOR (Vector<somenumber> &dst, Assert (m() == inverse_permutation.size(), ExcDimensionMismatch(m(), inverse_permutation.size())); - for (unsigned int urow=0; urow<m(); ++urow) + for (size_type urow=0; urow<m(); ++urow) { - const unsigned int row = permutation[urow]; + const size_type row = permutation[urow]; somenumber s = dst(row); - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) { - const unsigned int col = cols->colnums[j]; + const size_type col = cols->colnums[j]; if (inverse_permutation[col] < urow) { s -= val[j] * dst(col); @@ -1616,8 +1623,8 @@ template <typename number> template <typename somenumber> void SparseMatrix<number>::TPSOR (Vector<somenumber> &dst, - const std::vector<unsigned int> &permutation, - const std::vector<unsigned int> &inverse_permutation, + const std::vector<size_type> &permutation, + const std::vector<size_type> &inverse_permutation, const number om) const { Assert (cols != 0, ExcNotInitialized()); @@ -1630,14 +1637,14 @@ SparseMatrix<number>::TPSOR (Vector<somenumber> &dst, Assert (m() == inverse_permutation.size(), ExcDimensionMismatch(m(), inverse_permutation.size())); - for (unsigned int urow=m(); urow != 0;) + for (size_type urow=m(); urow != 0;) { --urow; - const unsigned int row = permutation[urow]; + const size_type row = permutation[urow]; somenumber s = dst(row); - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) { - const unsigned int col = cols->colnums[j]; + const size_type col = cols->colnums[j]; if (inverse_permutation[col] > urow) s -= val[j] * dst(col); } @@ -1693,10 +1700,10 @@ SparseMatrix<number>::SOR_step (Vector<somenumber> &v, Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert (m() == b.size(), ExcDimensionMismatch(m(),b.size())); - for (unsigned int row=0; row<m(); ++row) + for (size_type row=0; row<m(); ++row) { somenumber s = b(row); - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) { s -= val[j] * v(cols->colnums[j]); } @@ -1723,7 +1730,7 @@ SparseMatrix<number>::TSOR_step (Vector<somenumber> &v, for (int row=m()-1; row>=0; --row) { somenumber s = b(row); - for (unsigned int j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) + for (size_type j=cols->rowstart[row]; j<cols->rowstart[row+1]; ++j) { s -= val[j] * v(cols->colnums[j]); } @@ -1761,16 +1768,16 @@ SparseMatrix<number>::SSOR (Vector<somenumber> &dst, AssertDimension (m(), n()); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); - const unsigned int n = dst.size(); - unsigned int j; + const size_type n = dst.size(); + size_type j; somenumber s; - for (unsigned int i=0; i<n; i++) + for (size_type i=0; i<n; i++) { s = 0.; for (j=cols->rowstart[i]; j<cols->rowstart[i+1] ; j++) { - const unsigned int p = cols->colnums[j]; + const size_type p = cols->colnums[j]; if (p != SparsityPattern::invalid_entry) { if (i>j) s += val[j] * dst(p); @@ -1786,10 +1793,10 @@ SparseMatrix<number>::SSOR (Vector<somenumber> &dst, s = 0.; for (j=cols->rowstart[i]; j<cols->rowstart[i+1] ; j++) { - const unsigned int p = cols->colnums[j]; + const size_type p = cols->colnums[j]; if (p != SparsityPattern::invalid_entry) { - if (static_cast<unsigned int>(i)<j) s += val[j] * dst(p); + if (static_cast<size_type>(i)<j) s += val[j] * dst(p); } } Assert(val[cols->rowstart[i]]!= 0., ExcDivideByZero()); @@ -1838,9 +1845,9 @@ void SparseMatrix<number>::print_formatted (std::ostream &out, width = precision+2; } - for (unsigned int i=0; i<m(); ++i) + for (size_type i=0; i<m(); ++i) { - for (unsigned int j=0; j<n(); ++j) + for (size_type j=0; j<n(); ++j) if ((*cols)(i,j) != SparsityPattern::invalid_entry) out << std::setw(width) << val[cols->operator()(i,j)] * denominator << ' '; @@ -1864,9 +1871,9 @@ void SparseMatrix<number>::print_pattern (std::ostream &out, Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - for (unsigned int i=0; i<m(); ++i) + for (size_type i=0; i<m(); ++i) { - for (unsigned int j=0; j<n(); ++j) + for (size_type j=0; j<n(); ++j) if ((*cols)(i,j) == SparsityPattern::invalid_entry) out << '.'; else if (std::fabs(val[cols->operator()(i,j)]) > threshold) @@ -1931,6 +1938,11 @@ SparseMatrix<number>::block_read (std::istream &in) } +template <typename number> +void +SparseMatrix<number>::compress (::dealii::VectorOperation::values) +{} + template <typename number> std::size_t diff --git a/deal.II/include/deal.II/lac/sparse_matrix_ez.h b/deal.II/include/deal.II/lac/sparse_matrix_ez.h index a7fa2e7f46..f4d45cad38 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix_ez.h +++ b/deal.II/include/deal.II/lac/sparse_matrix_ez.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 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__sparse_matrix_ez_h #define __deal2__sparse_matrix_ez_h @@ -97,6 +102,11 @@ template <typename number> class SparseMatrixEZ : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * The class for storing the * column number of an entry @@ -115,13 +125,13 @@ public: * Constructor. Fills column * and value. */ - Entry (const unsigned int column, + Entry (const size_type column, const number &value); /** * The column number. */ - unsigned int column; + size_type column; /** * The value there. @@ -131,7 +141,7 @@ public: /** * Non-existent column number. */ - static const unsigned int invalid = numbers::invalid_unsigned_int; + static const size_type invalid = numbers::invalid_size_type; }; /** @@ -145,13 +155,13 @@ public: /** * Constructor. */ - RowInfo (unsigned int start = Entry::invalid); + RowInfo (size_type start = Entry::invalid); /** * Index of first entry of * the row in the data field. */ - unsigned int start; + size_type start; /** * Number of entries in this * row. @@ -191,7 +201,7 @@ public: * pointer is sufficient. */ Accessor (const SparseMatrixEZ<number> *matrix, - const unsigned int row, + const size_type row, const unsigned short index); /** @@ -199,7 +209,7 @@ public: * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Index in row of the element @@ -213,7 +223,7 @@ public: * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of this matrix entry. @@ -229,7 +239,7 @@ public: /** * Current row number. */ - unsigned int a_row; + size_type a_row; /** * Current index in row. @@ -248,7 +258,7 @@ public: * Constructor. */ const_iterator(const SparseMatrixEZ<number> *matrix, - const unsigned int row, + const size_type row, const unsigned short index); /** @@ -364,9 +374,9 @@ public: * efficient assembling of the * matrix. */ - explicit SparseMatrixEZ (const unsigned int n_rows, - const unsigned int n_columns, - const unsigned int default_row_length = 0, + explicit SparseMatrixEZ (const size_type n_rows, + const size_type n_columns, + const size_type default_row_length = 0, const unsigned int default_increment = 1); /** @@ -415,11 +425,11 @@ public: * efficient assembling of the * matrix. */ - void reinit (const unsigned int n_rows, - const unsigned int n_columns, - unsigned int default_row_length = 0, + void reinit (const size_type n_rows, + const size_type n_columns, + size_type default_row_length = 0, unsigned int default_increment = 1, - unsigned int reserve = 0); + size_type reserve = 0); /** * Release all memory and return @@ -447,7 +457,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int m () const; + size_type m () const; /** * Return the dimension of the @@ -455,19 +465,19 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int n () const; + size_type n () const; /** * Return the number of entries * in a specific row. */ - unsigned int get_row_length (const unsigned int row) const; + size_type get_row_length (const size_type row) const; /** * Return the number of nonzero * elements of this matrix. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Determine an estimate for the @@ -501,10 +511,10 @@ public: * the number of entries in each * line is printed as well. */ - void compute_statistics (unsigned int &used, - unsigned int &allocated, - unsigned int &reserved, - std::vector<unsigned int> &used_by_line, + void compute_statistics (size_type &used, + size_type &allocated, + size_type &reserved, + std::vector<size_type> &used_by_line, const bool compute_by_line) const; //@} /** @@ -520,7 +530,7 @@ public: * finite number an exception * is thrown. */ - void set (const unsigned int i, const unsigned int j, + void set (const size_type i, const size_type j, const number value); /** @@ -532,8 +542,8 @@ public: * finite number an exception * is thrown. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const number value); /** @@ -564,9 +574,9 @@ public: * into the matrix. */ template <typename number2> - void add (const std::vector<unsigned int> &indices, - const FullMatrix<number2> &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector<size_type> &indices, + const FullMatrix<number2> &full_matrix, + const bool elide_zero_values = true); /** * Same function as before, but now @@ -576,8 +586,8 @@ public: * on rows and columns, respectively. */ template <typename number2> - void add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, + void add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<number2> &full_matrix, const bool elide_zero_values = true); @@ -599,10 +609,10 @@ public: * into the matrix. */ template <typename number2> - void add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number2> &values, - const bool elide_zero_values = true); + void add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number2> &values, + const bool elide_zero_values = true); /** * Add an array of values given by @@ -622,12 +632,12 @@ public: * into the matrix. */ template <typename number2> - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Copy the given matrix to this @@ -696,16 +706,16 @@ public: * matrix), use the @p el * function. */ - number operator () (const unsigned int i, - const unsigned int j) const; + number operator () (const size_type i, + const size_type j) const; /** * Return the value of the entry * (i,j). Returns zero for all * non-existing entries. */ - number el (const unsigned int i, - const unsigned int j) const; + number el (const size_type i, + const size_type j) const; //@} /** * @name Multiplications @@ -853,14 +863,14 @@ public: * is <tt>end(r)</tt>, which does NOT * point into row @p r.. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row * @p r. The result may be * different from <tt>end()</tt>! */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; //@} /** * @name Input/Output @@ -978,8 +988,8 @@ private: * zero-pointer if the entry does * not exist. */ - const Entry *locate (const unsigned int row, - const unsigned int col) const; + const Entry *locate (const size_type row, + const size_type col) const; /** * Find an entry and return a @@ -987,14 +997,14 @@ private: * zero-pointer if the entry does * not exist. */ - Entry *locate (const unsigned int row, - const unsigned int col); + Entry *locate (const size_type row, + const size_type col); /** * Find an entry or generate it. */ - Entry *allocate (const unsigned int row, - const unsigned int col); + Entry *allocate (const size_type row, + const size_type col); /** * Version of @p vmult which only @@ -1008,8 +1018,8 @@ private: template <typename somenumber> void threaded_vmult (Vector<somenumber> &dst, const Vector<somenumber> &src, - const unsigned int begin_row, - const unsigned int end_row) const; + const size_type begin_row, + const size_type end_row) const; /** * Version of @@ -1024,8 +1034,8 @@ private: */ template <typename somenumber> void threaded_matrix_norm_square (const Vector<somenumber> &v, - const unsigned int begin_row, - const unsigned int end_row, + const size_type begin_row, + const size_type end_row, somenumber *partial_sum) const; /** @@ -1042,8 +1052,8 @@ private: template <typename somenumber> void threaded_matrix_scalar_product (const Vector<somenumber> &u, const Vector<somenumber> &v, - const unsigned int begin_row, - const unsigned int end_row, + const size_type begin_row, + const size_type end_row, somenumber *partial_sum) const; /** @@ -1051,7 +1061,7 @@ private: * used to check vector * dimensions only. */ - unsigned int n_columns; + size_type n_columns; /** * Info structure for each row. @@ -1084,7 +1094,7 @@ private: template <typename number> inline -SparseMatrixEZ<number>::Entry::Entry(unsigned int column, +SparseMatrixEZ<number>::Entry::Entry(size_type column, const number &value) : column(column), @@ -1104,7 +1114,7 @@ SparseMatrixEZ<number>::Entry::Entry() template <typename number> inline -SparseMatrixEZ<number>::RowInfo::RowInfo(unsigned int start) +SparseMatrixEZ<number>::RowInfo::RowInfo(size_type start) : start(start), length(0), @@ -1117,7 +1127,7 @@ template <typename number> inline SparseMatrixEZ<number>::const_iterator::Accessor:: Accessor (const SparseMatrixEZ<number> *matrix, - const unsigned int r, + const size_type r, const unsigned short i) : matrix(matrix), @@ -1128,7 +1138,7 @@ Accessor (const SparseMatrixEZ<number> *matrix, template <typename number> inline -unsigned int +typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::const_iterator::Accessor::row() const { return a_row; @@ -1137,7 +1147,7 @@ SparseMatrixEZ<number>::const_iterator::Accessor::row() const template <typename number> inline -unsigned int +typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::const_iterator::Accessor::column() const { return matrix->data[matrix->row_info[a_row].start+a_index].column; @@ -1167,7 +1177,7 @@ template <typename number> inline SparseMatrixEZ<number>::const_iterator:: const_iterator(const SparseMatrixEZ<number> *matrix, - const unsigned int r, + const size_type r, const unsigned short i) : accessor(matrix, r, i) @@ -1280,7 +1290,7 @@ operator < (const const_iterator &other) const //--------------------------------------------------------------------------- template <typename number> inline -unsigned int SparseMatrixEZ<number>::m () const +typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::m () const { return row_info.size(); } @@ -1288,7 +1298,7 @@ unsigned int SparseMatrixEZ<number>::m () const template <typename number> inline -unsigned int SparseMatrixEZ<number>::n () const +typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::n () const { return n_columns; } @@ -1297,15 +1307,15 @@ unsigned int SparseMatrixEZ<number>::n () const template <typename number> inline typename SparseMatrixEZ<number>::Entry * -SparseMatrixEZ<number>::locate (const unsigned int row, - const unsigned int col) +SparseMatrixEZ<number>::locate (const size_type row, + const size_type col) { Assert (row<m(), ExcIndexRange(row,0,m())); Assert (col<n(), ExcIndexRange(col,0,n())); const RowInfo &r = row_info[row]; - const unsigned int end = r.start + r.length; - for (unsigned int i=r.start; i<end; ++i) + const size_type end = r.start + r.length; + for (size_type i=r.start; i<end; ++i) { Entry *const entry = &data[i]; if (entry->column == col) @@ -1321,8 +1331,8 @@ SparseMatrixEZ<number>::locate (const unsigned int row, template <typename number> inline const typename SparseMatrixEZ<number>::Entry * -SparseMatrixEZ<number>::locate (const unsigned int row, - const unsigned int col) const +SparseMatrixEZ<number>::locate (const size_type row, + const size_type col) const { SparseMatrixEZ<number> *t = const_cast<SparseMatrixEZ<number>*> (this); return t->locate(row,col); @@ -1332,16 +1342,16 @@ SparseMatrixEZ<number>::locate (const unsigned int row, template <typename number> inline typename SparseMatrixEZ<number>::Entry * -SparseMatrixEZ<number>::allocate (const unsigned int row, - const unsigned int col) +SparseMatrixEZ<number>::allocate (const size_type row, + const size_type col) { Assert (row<m(), ExcIndexRange(row,0,m())); Assert (col<n(), ExcIndexRange(col,0,n())); RowInfo &r = row_info[row]; - const unsigned int end = r.start + r.length; + const size_type end = r.start + r.length; - unsigned int i = r.start; + size_type i = r.start; // If diagonal exists and this // column is higher, start only // after diagonal. @@ -1373,7 +1383,7 @@ SparseMatrixEZ<number>::allocate (const unsigned int row, data.insert(data.begin()+end, increment, Entry()); // Update starts of // following rows - for (unsigned int rn=row+1; rn<row_info.size(); ++rn) + for (size_type rn=row+1; rn<row_info.size(); ++rn) row_info[rn].start += increment; } } @@ -1409,7 +1419,7 @@ SparseMatrixEZ<number>::allocate (const unsigned int row, // Move all entries in this // row up by one - for (unsigned int j = i+1; j < end; ++j) + for (size_type j = i+1; j < end; ++j) { // There should be no invalid // entry below end @@ -1429,8 +1439,8 @@ SparseMatrixEZ<number>::allocate (const unsigned int row, template <typename number> inline -void SparseMatrixEZ<number>::set (const unsigned int i, - const unsigned int j, +void SparseMatrixEZ<number>::set (const size_type i, + const size_type j, const number value) { @@ -1456,8 +1466,8 @@ void SparseMatrixEZ<number>::set (const unsigned int i, template <typename number> inline -void SparseMatrixEZ<number>::add (const unsigned int i, - const unsigned int j, +void SparseMatrixEZ<number>::add (const size_type i, + const size_type j, const number value) { @@ -1477,13 +1487,13 @@ void SparseMatrixEZ<number>::add (const unsigned int i, template <typename number> template <typename number2> -void SparseMatrixEZ<number>::add (const std::vector<unsigned int> &indices, - const FullMatrix<number2> &full_matrix, - const bool elide_zero_values) +void SparseMatrixEZ<number>::add (const std::vector<size_type> &indices, + const FullMatrix<number2> &full_matrix, + const bool elide_zero_values) { //TODO: This function can surely be made more efficient - for (unsigned int i=0; i<indices.size(); ++i) - for (unsigned int j=0; j<indices.size(); ++j) + for (size_type i=0; i<indices.size(); ++i) + for (size_type j=0; j<indices.size(); ++j) if ((full_matrix(i,j) != 0) || (elide_zero_values == false)) add (indices[i], indices[j], full_matrix(i,j)); } @@ -1492,14 +1502,14 @@ void SparseMatrixEZ<number>::add (const std::vector<unsigned int> &indices, template <typename number> template <typename number2> -void SparseMatrixEZ<number>::add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, - const FullMatrix<number2> &full_matrix, - const bool elide_zero_values) +void SparseMatrixEZ<number>::add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, + const FullMatrix<number2> &full_matrix, + const bool elide_zero_values) { //TODO: This function can surely be made more efficient - for (unsigned int i=0; i<row_indices.size(); ++i) - for (unsigned int j=0; j<col_indices.size(); ++j) + for (size_type i=0; i<row_indices.size(); ++i) + for (size_type j=0; j<col_indices.size(); ++j) if ((full_matrix(i,j) != 0) || (elide_zero_values == false)) add (row_indices[i], col_indices[j], full_matrix(i,j)); } @@ -1509,13 +1519,13 @@ void SparseMatrixEZ<number>::add (const std::vector<unsigned int> &row_indices, template <typename number> template <typename number2> -void SparseMatrixEZ<number>::add (const unsigned int row, - const std::vector<unsigned int> &col_indices, - const std::vector<number2> &values, - const bool elide_zero_values) +void SparseMatrixEZ<number>::add (const size_type row, + const std::vector<size_type> &col_indices, + const std::vector<number2> &values, + const bool elide_zero_values) { //TODO: This function can surely be made more efficient - for (unsigned int j=0; j<col_indices.size(); ++j) + for (size_type j=0; j<col_indices.size(); ++j) if ((values[j] != 0) || (elide_zero_values == false)) add (row, col_indices[j], values[j]); } @@ -1524,15 +1534,15 @@ void SparseMatrixEZ<number>::add (const unsigned int row, template <typename number> template <typename number2> -void SparseMatrixEZ<number>::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values, - const bool /*col_indices_are_sorted*/) +void SparseMatrixEZ<number>::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values, + const bool /*col_indices_are_sorted*/) { //TODO: This function can surely be made more efficient - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) if ((values[j] != 0) || (elide_zero_values == false)) add (row, col_indices[j], values[j]); } @@ -1542,8 +1552,8 @@ void SparseMatrixEZ<number>::add (const unsigned int row, template <typename number> inline -number SparseMatrixEZ<number>::el (const unsigned int i, - const unsigned int j) const +number SparseMatrixEZ<number>::el (const size_type i, + const size_type j) const { const Entry *entry = locate(i,j); if (entry) @@ -1555,8 +1565,8 @@ number SparseMatrixEZ<number>::el (const unsigned int i, template <typename number> inline -number SparseMatrixEZ<number>::operator() (const unsigned int i, - const unsigned int j) const +number SparseMatrixEZ<number>::operator() (const size_type i, + const size_type j) const { const Entry *entry = locate(i,j); if (entry) @@ -1586,7 +1596,7 @@ SparseMatrixEZ<number>::end () const template <typename number> inline typename SparseMatrixEZ<number>::const_iterator -SparseMatrixEZ<number>::begin (const unsigned int r) const +SparseMatrixEZ<number>::begin (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); const_iterator result (this, r, 0); @@ -1596,7 +1606,7 @@ SparseMatrixEZ<number>::begin (const unsigned int r) const template <typename number> inline typename SparseMatrixEZ<number>::const_iterator -SparseMatrixEZ<number>::end (const unsigned int r) const +SparseMatrixEZ<number>::end (const size_type r) const { Assert (r<m(), ExcIndexRange(r,0,m())); const_iterator result(this, r+1, 0); @@ -1614,11 +1624,11 @@ SparseMatrixEZ<number>::copy_from (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { 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()); } @@ -1642,11 +1652,11 @@ SparseMatrixEZ<number>::add (const number factor, // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // add them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { 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()); } @@ -1682,13 +1692,13 @@ SparseMatrixEZ<number>::conjugate_add (const MATRIXA &A, if (transpose) while (b1 != b_final) { - const unsigned int i = b1->column(); - const unsigned int k = b1->row(); + const size_type i = b1->column(); + const size_type k = b1->row(); typename MATRIXB::const_iterator b2 = B.begin(); while (b2 != b_final) { - const unsigned int j = b2->column(); - const unsigned int l = b2->row(); + const size_type j = b2->column(); + const size_type l = b2->row(); const typename MATRIXA::value_type a = A.el(k,l); @@ -1704,11 +1714,11 @@ SparseMatrixEZ<number>::conjugate_add (const MATRIXA &A, // maximal row for a column in // advance. - std::vector<unsigned int> minrow(B.n(), B.m()); - std::vector<unsigned int> maxrow(B.n(), 0); + std::vector<size_type> minrow(B.n(), B.m()); + std::vector<size_type> maxrow(B.n(), 0); while (b1 != b_final) { - const unsigned int r = b1->row(); + const size_type r = b1->row(); if (r < minrow[b1->column()]) minrow[b1->column()] = r; if (r > maxrow[b1->column()]) @@ -1745,7 +1755,7 @@ SparseMatrixEZ<number>::conjugate_add (const MATRIXA &A, // the work if (b1->column() == ai->row() && (b1v != 0.)) { - const unsigned int i = b1->row(); + const size_type i = b1->row(); typename MATRIXB::const_iterator b2 = B.begin(minrow[ai->column()]); @@ -1753,7 +1763,7 @@ SparseMatrixEZ<number>::conjugate_add (const MATRIXA &A, { if (b2->column() == ai->column()) { - const unsigned int j = b2->row(); + const size_type j = b2->row(); add (i, j, a * b1v * b2->value()); } ++b2; @@ -1773,10 +1783,10 @@ inline void SparseMatrixEZ<number>::print_statistics(STREAM &out, bool full) { - unsigned int used; - unsigned int allocated; - unsigned int reserved; - std::vector<unsigned int> used_by_line; + size_type used; + size_type allocated; + size_type reserved; + std::vector<size_type> used_by_line; compute_statistics (used, allocated, reserved, used_by_line, full); @@ -1786,7 +1796,7 @@ SparseMatrixEZ<number>::print_statistics(STREAM &out, bool full) if (full) { - for (unsigned int i=0; i< used_by_line.size(); ++i) + for (size_type i=0; i< used_by_line.size(); ++i) if (used_by_line[i] != 0) out << "SparseMatrixEZ:entries\t" << i << "\trows\t" << used_by_line[i] 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 1c4ee5b8f6..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 @@ -44,9 +49,9 @@ SparseMatrixEZ<number>::SparseMatrixEZ(const SparseMatrixEZ<number> &m) template <typename number> -SparseMatrixEZ<number>::SparseMatrixEZ(const unsigned int n_rows, - const unsigned int n_cols, - const unsigned int default_row_length, +SparseMatrixEZ<number>::SparseMatrixEZ(const size_type n_rows, + const size_type n_cols, + const size_type default_row_length, const unsigned int default_increment) { reinit(n_rows, n_cols, default_row_length, default_increment); @@ -88,11 +93,11 @@ SparseMatrixEZ<number>::operator = (const double d) template <typename number> void -SparseMatrixEZ<number>::reinit(const unsigned int n_rows, - const unsigned int n_cols, - unsigned int default_row_length, - unsigned int default_increment, - unsigned int reserve) +SparseMatrixEZ<number>::reinit(const size_type n_rows, + const size_type n_cols, + size_type default_row_length, + unsigned int default_increment, + size_type reserve) { clear(); @@ -104,7 +109,7 @@ SparseMatrixEZ<number>::reinit(const unsigned int n_rows, data.reserve(reserve); data.resize(default_row_length * n_rows); - for (unsigned int i=0; i<n_rows; ++i) + for (size_type i=0; i<n_rows; ++i) row_info[i].start = i * default_row_length; } @@ -136,8 +141,8 @@ SparseMatrixEZ<number>::vmult (Vector<somenumber> &dst, Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); - const unsigned int end_row = row_info.size(); - for (unsigned int row = 0; row < end_row; ++row) + const size_type end_row = row_info.size(); + for (size_type row = 0; row < end_row; ++row) { const RowInfo &ri = row_info[row]; typename std::vector<Entry>::const_iterator @@ -193,8 +198,8 @@ SparseMatrixEZ<number>::vmult_add (Vector<somenumber> &dst, Assert(m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); Assert(n() == src.size(), ExcDimensionMismatch(n(),src.size())); - const unsigned int end_row = row_info.size(); - for (unsigned int row = 0; row < end_row; ++row) + const size_type end_row = row_info.size(); + for (size_type row = 0; row < end_row; ++row) { const RowInfo &ri = row_info[row]; typename std::vector<Entry>::const_iterator @@ -219,8 +224,8 @@ SparseMatrixEZ<number>::Tvmult_add (Vector<somenumber> &dst, Assert(n() == dst.size(), ExcDimensionMismatch(n(),dst.size())); Assert(m() == src.size(), ExcDimensionMismatch(m(),src.size())); - const unsigned int end_row = row_info.size(); - for (unsigned int row = 0; row < end_row; ++row) + const size_type end_row = row_info.size(); + for (size_type row = 0; row < end_row; ++row) { const RowInfo &ri = row_info[row]; typename std::vector<Entry>::const_iterator @@ -254,7 +259,7 @@ SparseMatrixEZ<number>::precondition_Jacobi (Vector<somenumber> &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; } } @@ -280,8 +285,8 @@ SparseMatrixEZ<number>::precondition_SOR (Vector<somenumber> &dst, { Assert (ri->diagonal != RowInfo::invalid_diagonal, ExcNoDiagonal()); number s = *src_ptr; - const unsigned int end_row = ri->start + ri->diagonal; - for (unsigned int i=ri->start; i<end_row; ++i) + const size_type end_row = ri->start + ri->diagonal; + for (size_type i=ri->start; i<end_row; ++i) s -= data[i].value * dst(data[i].column); *dst_ptr = om * s / data[ri->start + ri->diagonal].value; @@ -312,8 +317,8 @@ SparseMatrixEZ<number>::precondition_TSOR (Vector<somenumber> &dst, { Assert (ri->diagonal != RowInfo::invalid_diagonal, ExcNoDiagonal()); number s = *src_ptr; - const unsigned int end_row = ri->start + ri->length; - for (unsigned int i=ri->start+ri->diagonal+1; i<end_row; ++i) + const size_type end_row = ri->start + ri->length; + for (size_type i=ri->start+ri->diagonal+1; i<end_row; ++i) s -= data[i].value * dst(data[i].column); *dst_ptr = om * s / data[ri->start + ri->diagonal].value; @@ -344,8 +349,8 @@ SparseMatrixEZ<number>::precondition_SSOR (Vector<somenumber> &dst, { Assert (ri->diagonal != RowInfo::invalid_diagonal, ExcNoDiagonal()); number s = 0; - const unsigned int end_row = ri->start + ri->diagonal; - for (unsigned int i=ri->start; i<end_row; ++i) + const size_type end_row = ri->start + ri->diagonal; + for (size_type i=ri->start; i<end_row; ++i) s += data[i].value * dst(data[i].column); *dst_ptr = *src_ptr - s * om; @@ -363,9 +368,9 @@ SparseMatrixEZ<number>::precondition_SSOR (Vector<somenumber> &dst, dst_ptr = dst.begin()+dst.size()-1; for (rri = row_info.rbegin(); rri != rend; --dst_ptr, ++rri) { - const unsigned int end_row = rri->start + rri->length; + const size_type end_row = rri->start + rri->length; number s = 0; - for (unsigned int i=rri->start+rri->diagonal+1; i<end_row; ++i) + for (size_type i=rri->start+rri->diagonal+1; i<end_row; ++i) s += data[i].value * dst(data[i].column); *dst_ptr -= s * om; @@ -381,15 +386,15 @@ SparseMatrixEZ<number>::memory_consumption() const { return sizeof (*this) - + sizeof(unsigned int) * row_info.capacity() + + sizeof(size_type) * row_info.capacity() + sizeof(typename SparseMatrixEZ<number>::Entry) * data.capacity(); } template <typename number> -unsigned int -SparseMatrixEZ<number>::get_row_length (const unsigned int row) const +typename SparseMatrixEZ<number>::size_type +SparseMatrixEZ<number>::get_row_length (const size_type row) const { return row_info[row].length; } @@ -397,14 +402,14 @@ SparseMatrixEZ<number>::get_row_length (const unsigned int row) const template <typename number> -unsigned int +typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::n_nonzero_elements() const { typename std::vector<RowInfo>::const_iterator row = row_info.begin(); const typename std::vector<RowInfo>::const_iterator endrow = row_info.end(); // Add up entries actually used - unsigned int used = 0; + size_type used = 0; for (; row != endrow ; ++ row) used += row->length; return used; @@ -415,10 +420,10 @@ SparseMatrixEZ<number>::n_nonzero_elements() const template <typename number> void SparseMatrixEZ<number>::compute_statistics( - unsigned int &used, - unsigned int &allocated, - unsigned int &reserved, - std::vector<unsigned int> &used_by_line, + size_type &used, + size_type &allocated, + size_type &reserved, + std::vector<size_type> &used_by_line, const bool full) const { typename std::vector<RowInfo>::const_iterator row = row_info.begin(); @@ -426,7 +431,7 @@ SparseMatrixEZ<number>::compute_statistics( // Add up entries actually used used = 0; - unsigned int max_length = 0; + size_type max_length = 0; for (; row != endrow ; ++ row) { used += row->length; @@ -503,9 +508,9 @@ SparseMatrixEZ<number>::print_formatted ( std::ostream &out, } // TODO: Skip nonexisting entries - for (unsigned int i=0; i<m(); ++i) + for (size_type i=0; i<m(); ++i) { - for (unsigned int j=0; j<n(); ++j) + for (size_type j=0; j<n(); ++j) { const Entry *entry = locate(i,j); if (entry) diff --git a/deal.II/include/deal.II/lac/sparse_mic.h b/deal.II/include/deal.II/lac/sparse_mic.h index fca18fafd6..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 @@ -41,6 +47,11 @@ template <typename number> class SparseMIC : public SparseLUDecomposition<number> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Does nothing, so * you have to call @p decompose @@ -197,7 +208,7 @@ private: * Compute the row-th "inner * sum". */ - number get_rowsum (const unsigned int row) const; + number get_rowsum (const size_type row) const; }; /*@}*/ 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 69034c07ba..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 @@ -131,10 +137,10 @@ void SparseMIC<number>::decompose (const SparseMatrix<somenumber> &matrix, inner_sums.resize (this->m()); // precalc sum(j=k+1, N, a[k][j])) - for (unsigned int row=0; row<this->m(); row++) + for (size_type row=0; row<this->m(); row++) inner_sums[row] = get_rowsum(row); - for (unsigned int row=0; row<this->m(); row++) + for (size_type row=0; row<this->m(); row++) { const number temp = this->begin(row)->value(); number temp1 = 0; @@ -158,7 +164,7 @@ void SparseMIC<number>::decompose (const SparseMatrix<somenumber> &matrix, template <typename number> inline number -SparseMIC<number>::get_rowsum (const unsigned int row) const +SparseMIC<number>::get_rowsum (const size_type row) const { Assert(this->m()==this->n(), ExcNotQuadratic()); @@ -184,13 +190,13 @@ SparseMIC<number>::vmult (Vector<somenumber> &dst, Assert (dst.size() == src.size(), ExcDimensionMismatch(dst.size(), src.size())); Assert (dst.size() == this->m(), ExcDimensionMismatch(dst.size(), this->m())); - const unsigned int N=dst.size(); + const size_type N=dst.size(); // We assume the underlying matrix A is: A = X - L - U, where -L and -U are // strictly lower- and upper- diagonal parts of the system. // // Solve (X-L)X{-1}(X-U) x = b in 3 steps: dst = src; - for (unsigned int row=0; row<N; ++row) + for (size_type row=0; row<N; ++row) { // Now: (X-L)u = b @@ -206,7 +212,7 @@ SparseMIC<number>::vmult (Vector<somenumber> &dst, } // Now: v = Xu - for (unsigned int row=0; row<N; row++) + for (size_type row=0; row<N; row++) dst(row) *= diag[row]; // x = (X-U)v @@ -217,7 +223,7 @@ SparseMIC<number>::vmult (Vector<somenumber> &dst, p = this->begin(row)+1; p != this->end(row); ++p) - if (p->column() > static_cast<unsigned int>(row)) + if (p->column() > static_cast<size_type>(row)) dst(row) -= p->value() * dst(p->column()); dst(row) *= inv_diag[row]; diff --git a/deal.II/include/deal.II/lac/sparse_vanka.h b/deal.II/include/deal.II/lac/sparse_vanka.h index 0989a77bc7..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 @@ -129,6 +134,11 @@ template<typename number> class SparseVanka { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Gets the matrix * for preconditioning and a bit @@ -309,8 +319,8 @@ private: * mode, several copies of this * function are spawned. */ - void compute_inverses (const unsigned int begin, - const unsigned int end); + void compute_inverses (const size_type begin, + const size_type end); /** * Compute the inverse of the @@ -326,8 +336,8 @@ private: * the case where this function * re-creates it each time. */ - void compute_inverse (const unsigned int row, - std::vector<unsigned int> &local_indices); + void compute_inverse (const size_type row, + std::vector<size_type> &local_indices); /** * Make the derived class a @@ -510,6 +520,11 @@ template<typename number> class SparseBlockVanka : public SparseVanka<number> { public: + /** + * Declate type for container size. + */ + typedef types::global_dof_index size_type; + /** * Enumeration of the different * methods by which the DoFs are 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 6ae96146b4..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 @@ -65,12 +70,12 @@ SparseVanka<number>::compute_inverses () #ifndef DEAL_II_WITH_THREADS compute_inverses (0, matrix->m()); #else - const unsigned int n_inverses = std::count (selected.begin(), - selected.end(), - true); + const size_type n_inverses = std::count (selected.begin(), + selected.end(), + true); - const unsigned int n_inverses_per_thread = std::max(n_inverses / n_threads, - 1U); + const size_type n_inverses_per_thread = std::max(n_inverses / n_threads, + static_cast<size_type> (1U)); // set up start and end index // for each of the @@ -88,13 +93,13 @@ SparseVanka<number>::compute_inverses () // consecutive, with other // consecutive regions where we // do not have to do something - std::vector<std::pair<unsigned int, unsigned int> > blocking (n_threads); + std::vector<std::pair<size_type, unsigned int> > blocking (n_threads); unsigned int c = 0; unsigned int thread = 0; blocking[0].first = 0; - for (unsigned int i=0; (i<matrix->m()) && (thread+1<n_threads); ++i) + for (size_type i=0; (i<matrix->m()) && (thread+1<n_threads); ++i) { if (selected[i] == true) ++c; @@ -109,8 +114,8 @@ SparseVanka<number>::compute_inverses () }; blocking[n_threads-1].second = matrix->m(); - typedef void (SparseVanka<number>::*FunPtr)(const unsigned int, - const unsigned int); + typedef void (SparseVanka<number>::*FunPtr)(const size_type, + const size_type); const FunPtr fun_ptr = &SparseVanka<number>::compute_inverses; // Now spawn the threads @@ -126,17 +131,17 @@ SparseVanka<number>::compute_inverses () template <typename number> void -SparseVanka<number>::compute_inverses (const unsigned int begin, - const unsigned int end) +SparseVanka<number>::compute_inverses (const size_type begin, + const size_type end) { // set-up the vector that will be used // by the functions which we call // below. - std::vector<unsigned int> local_indices; + std::vector<size_type> local_indices; // traverse all rows of the matrix // which are selected - for (unsigned int row=begin; row<end; ++row) + for (size_type row=begin; row<end; ++row) if (selected[row] == true) compute_inverse (row, local_indices); } @@ -145,8 +150,8 @@ SparseVanka<number>::compute_inverses (const unsigned int begin, template <typename number> void -SparseVanka<number>::compute_inverse (const unsigned int row, - std::vector<unsigned int> &local_indices) +SparseVanka<number>::compute_inverse (const size_type row, + std::vector<size_type> &local_indices) { // first define an alias to the sparsity // pattern of the matrix, since this @@ -154,14 +159,14 @@ SparseVanka<number>::compute_inverse (const unsigned int row, const SparsityPattern &structure = matrix->get_sparsity_pattern(); - const unsigned int row_length = structure.row_length(row); + const size_type row_length = structure.row_length(row); inverses[row] = new FullMatrix<float> (row_length, row_length); // collect the dofs that couple // with @p row local_indices.resize (row_length); - for (unsigned int i=0; i<row_length; ++i) + for (size_type i=0; i<row_length; ++i) local_indices[i] = structure.column_number(row, i); // Build local matrix @@ -226,16 +231,16 @@ SparseVanka<number>::apply_preconditioner (Vector<number2> &dst, Vector<float> b (structure.max_entries_per_row()); Vector<float> x (structure.max_entries_per_row()); - std::map<unsigned int, unsigned int> local_index; + std::map<size_type, size_type> local_index; // traverse all rows of the matrix // which are selected - const unsigned int n = matrix->m(); - for (unsigned int row=0; row<n; ++row) + const size_type n = matrix->m(); + for (size_type row=0; row<n; ++row) if ((selected[row] == true) && ((range_is_restricted == false) || ((*dof_mask)[row] == true))) { - const unsigned int row_length = structure.row_length(row); + const size_type row_length = structure.row_length(row); // if we don't store the // inverse matrices, then alias @@ -264,21 +269,21 @@ SparseVanka<number>::apply_preconditioner (Vector<number2> &dst, // all degrees of freedom that // couple with @p row. local_index.clear (); - for (unsigned int i=0; i<row_length; ++i) - local_index.insert(std::pair<unsigned int, unsigned int> + for (size_type i=0; i<row_length; ++i) + local_index.insert(std::pair<size_type, size_type> (structure.column_number(row, i), i)); // Build local matrix and rhs - for (std::map<unsigned int, unsigned int>::const_iterator is=local_index.begin(); + for (std::map<size_type, size_type>::const_iterator is=local_index.begin(); is!=local_index.end(); ++is) { // irow loops over all DoFs that // couple with the present DoF - const unsigned int irow = is->first; + const size_type irow = is->first; // index of DoF irow in the matrix // row corresponding to DoF @p row. // runs between 0 and row_length - const unsigned int i = is->second; + const size_type i = is->second; // copy rhs b(i) = src(irow); @@ -288,14 +293,14 @@ SparseVanka<number>::apply_preconditioner (Vector<number2> &dst, // number of DoFs coupling to // irow (including irow itself) for (typename SparseMatrix<number>::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, // which itself couples with // @p row) also couples with // @p row. - const std::map<unsigned int, unsigned int>::const_iterator js + const std::map<size_type, size_type>::const_iterator js = local_index.find(p->column()); // if not, then still use // this dof to modify the rhs @@ -324,11 +329,11 @@ SparseVanka<number>::apply_preconditioner (Vector<number2> &dst, inverses[row]->vmult(x,b); // Distribute new values - for (std::map<unsigned int, unsigned int>::const_iterator is=local_index.begin(); + for (std::map<size_type, size_type>::const_iterator is=local_index.begin(); is!=local_index.end(); ++is) { - const unsigned int irow = is->first; - const unsigned int i = is->second; + const size_type irow = is->first; + const size_type i = is->second; if (!range_is_restricted || ((*dof_mask)[irow] == true)) @@ -353,7 +358,7 @@ SparseVanka<number>::memory_consumption () const { std::size_t mem = (sizeof(*this) + MemoryConsumption::memory_consumption (selected)); - for (unsigned int i=0; i<inverses.size(); ++i) + for (size_type i=0; i<inverses.size(); ++i) mem += MemoryConsumption::memory_consumption (*inverses[i]); return mem; @@ -387,14 +392,15 @@ SparseBlockVanka<number>::compute_dof_masks (const SparseMatrix<number> &M, { Assert (n_blocks > 0, ExcInternalError()); - const unsigned int n_inverses = std::count (selected.begin(), - selected.end(), - true); + const size_type n_inverses = std::count (selected.begin(), + selected.end(), + true); - const unsigned int n_inverses_per_block = std::max(n_inverses / n_blocks, 1U); + const size_type n_inverses_per_block = std::max(n_inverses / n_blocks, + static_cast<size_type> (1U)); // precompute the splitting points - std::vector<std::pair<unsigned int, unsigned int> > intervals (n_blocks); + std::vector<std::pair<size_type, size_type> > intervals (n_blocks); // set up start and end index for // each of the blocks. note that @@ -416,7 +422,7 @@ SparseBlockVanka<number>::compute_dof_masks (const SparseMatrix<number> &M, unsigned int block = 0; intervals[0].first = 0; - for (unsigned int i=0; (i<M.m()) && (block+1<n_blocks); ++i) + for (size_type i=0; (i<M.m()) && (block+1<n_blocks); ++i) { if (selected[i] == true) ++c; @@ -464,16 +470,16 @@ SparseBlockVanka<number>::compute_dof_masks (const SparseMatrix<number> &M, // Lagrange dofs of each // block access the different // dofs - Table<2,unsigned int> access_count (n_blocks, M.m()); + Table<2,size_type> access_count (n_blocks, M.m()); // set-up the map that will // be used to store the // indices each Lagrange dof // accesses - std::map<unsigned int, unsigned int> local_index; + std::map<size_type, size_type> local_index; const SparsityPattern &structure = M.get_sparsity_pattern(); - for (unsigned int row=0; row<M.m(); ++row) + for (size_type row=0; row<M.m(); ++row) if (selected[row] == true) { // first find out to @@ -490,8 +496,8 @@ SparseBlockVanka<number>::compute_dof_masks (const SparseMatrix<number> &M, // dofs number the // present index wants // to write - const unsigned int row_length = structure.row_length(row); - for (unsigned int i=0; i<row_length; ++i) + const size_type row_length = structure.row_length(row); + for (size_type i=0; i<row_length; ++i) ++access_count[block_number][structure.column_number(row, i)]; }; @@ -507,7 +513,7 @@ SparseBlockVanka<number>::compute_dof_masks (const SparseMatrix<number> &M, // the of course we leave it // to the block we put it // into in the first place - for (unsigned int row=0; row<M.m(); ++row) + for (size_type row=0; row<M.m(); ++row) if (selected[row] == true) { unsigned int block_number = 0; @@ -521,7 +527,7 @@ SparseBlockVanka<number>::compute_dof_masks (const SparseMatrix<number> &M, // find out which block // accesses this dof // the most often - unsigned int max_accesses = 0; + size_type max_accesses = 0; unsigned int max_access_block = 0; for (unsigned int block=0; block<n_blocks; ++block) if (access_count[block][row] > max_accesses) @@ -597,7 +603,7 @@ std::size_t SparseBlockVanka<number>::memory_consumption () const { std::size_t mem = SparseVanka<number>::memory_consumption(); - for (unsigned int i=0; i<dof_masks.size(); ++i) + for (size_type i=0; i<dof_masks.size(); ++i) mem += MemoryConsumption::memory_consumption (dof_masks[i]); return mem; } diff --git a/deal.II/include/deal.II/lac/sparsity_pattern.h b/deal.II/include/deal.II/lac/sparsity_pattern.h index 212038578d..b327e5b9ab 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 @@ -51,13 +56,18 @@ namespace internals { namespace SparsityPatternTools { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Helper function to get the column index from a dereferenced iterator in * the copy_from() function, if the inner iterator type points to plain * unsigned integers. */ - unsigned int - get_column_index_from_iterator (const unsigned int i); + size_type + get_column_index_from_iterator (const size_type i); /** * Helper function to get the column index from a dereferenced iterator in @@ -65,8 +75,8 @@ namespace internals * unsigned integers and some other value. */ template <typename value> - unsigned int - get_column_index_from_iterator (const std::pair<unsigned int, value> &i); + size_type + get_column_index_from_iterator (const std::pair<size_type, value> &i); /** * Likewise, but sometimes needed for certain types of containers that @@ -74,8 +84,8 @@ namespace internals * <tt>std::map</tt>). */ template <typename value> - unsigned int - get_column_index_from_iterator (const std::pair<const unsigned int, value> &i); + size_type + get_column_index_from_iterator (const std::pair<const size_type, value> &i); } } @@ -89,6 +99,11 @@ namespace SparsityPatternIterators // forward declaration class Iterator; + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Accessor class for iterators into sparsity patterns. This class is * also the base class for both const and non-const accessor classes @@ -112,8 +127,8 @@ namespace SparsityPatternIterators * with a global index instead. */ Accessor (const SparsityPattern *matrix, - const unsigned int row, - const unsigned int index) DEAL_II_DEPRECATED; + const size_type row, + const size_type index) DEAL_II_DEPRECATED; /** * Constructor. @@ -130,19 +145,19 @@ namespace SparsityPatternIterators * Row number of the element represented by this object. This function can * only be called for entries for which is_valid_entry() is true. */ - unsigned int row () const; + size_type row () const; /** * Index within the current row of the element represented by this object. This function * can only be called for entries for which is_valid_entry() is true. */ - unsigned int index () const; + size_type index () const; /** * Column number of the element represented by this object. This function * can only be called for entries for which is_valid_entry() is true. */ - unsigned int column () const; + size_type column () const; /** * Return whether the sparsity pattern entry pointed to by this iterator @@ -237,8 +252,8 @@ namespace SparsityPatternIterators * with a global index instead. */ Iterator (const SparsityPattern *sp, - const unsigned int row, - const unsigned int index) DEAL_II_DEPRECATED; + const size_type row, + const size_type index) DEAL_II_DEPRECATED; /** * Constructor. Create an iterator into the sparsity pattern @p sp for the @@ -334,6 +349,11 @@ namespace SparsityPatternIterators class SparsityPattern : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Typedef an iterator class that allows to walk over all nonzero elements * of a sparsity pattern. @@ -349,7 +369,7 @@ public: * @deprecated This typedef is deprecated. Use proper iterators instead. */ typedef - const unsigned int *row_iterator; + const size_type *row_iterator; /** * Typedef an iterator class that allows to walk over all nonzero elements @@ -377,7 +397,7 @@ public: * perform some optimizations, but the actual value of the variable may * change over time. */ - static const unsigned int invalid_entry = numbers::invalid_unsigned_int; + static const size_type invalid_entry = numbers::invalid_size_type; /** * @name Construction and setup @@ -419,8 +439,8 @@ public: * @deprecated Use the constructor without the last argument since * it is ignored. */ - SparsityPattern (const unsigned int m, - const unsigned int n, + SparsityPattern (const size_type m, + const size_type n, const unsigned int max_per_row, const bool optimize_diagonal) DEAL_II_DEPRECATED; @@ -431,8 +451,8 @@ public: * @arg n number of columns * @arg max_per_row maximum number of nonzero entries per row */ - SparsityPattern (const unsigned int m, - const unsigned int n, + SparsityPattern (const size_type m, + const size_type n, const unsigned int max_per_row); /** @@ -447,8 +467,8 @@ public: * @deprecated Use the constructor without the last argument since * it is ignored. */ - SparsityPattern (const unsigned int m, - const unsigned int n, + SparsityPattern (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths, const bool optimize_diagonal) DEAL_II_DEPRECATED; @@ -460,8 +480,8 @@ public: * @arg row_lengths possible number of nonzero entries for each row. This * vector must have one entry for each row. */ - SparsityPattern (const unsigned int m, - const unsigned int n, + SparsityPattern (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths); /** @@ -472,7 +492,7 @@ public: * elements. To avoid this, use the constructor taking row and column * numbers separately. */ - SparsityPattern (const unsigned int n, + SparsityPattern (const size_type n, const unsigned int max_per_row); /** @@ -486,7 +506,7 @@ public: * @deprecated Use the constructor without the last argument since * it is ignored. */ - SparsityPattern (const unsigned int m, + SparsityPattern (const size_type m, const std::vector<unsigned int> &row_lengths, const bool optimize_diagonal) DEAL_II_DEPRECATED; @@ -497,7 +517,7 @@ public: * @arg row_lengths possible number of nonzero entries for each row. This * vector must have one entry for each row. */ - SparsityPattern (const unsigned int m, + SparsityPattern (const size_type m, const std::vector<unsigned int> &row_lengths); /** @@ -523,8 +543,8 @@ public: * compressed after this function finishes. */ SparsityPattern (const SparsityPattern &original, - const unsigned int max_per_row, - const unsigned int extra_off_diagonals); + const unsigned int max_per_row, + const size_type extra_off_diagonals); /** * Destructor. @@ -549,8 +569,8 @@ public: * @deprecated The last argument of this function is ignored. Use the * version of this function without the last argument. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const unsigned int max_per_row, const bool optimize_diagonal) DEAL_II_DEPRECATED; @@ -562,8 +582,8 @@ public: * This function simply maps its operations to the other <tt>reinit</tt> * function. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const unsigned int max_per_row); /** @@ -583,8 +603,8 @@ public: * @deprecated The last argument of this function is ignored. Use the * version of this function without the last argument. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths, const bool optimize_diagonal) DEAL_II_DEPRECATED; @@ -602,8 +622,8 @@ public: * is true, diagonal elements are stored first in each row to allow * optimized access in relaxation methods of SparseMatrix. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths); /** @@ -612,16 +632,16 @@ public: * @deprecated The last argument of this function is ignored. Use the * version of this function without the last argument. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const VectorSlice<const std::vector<unsigned int> > &row_lengths, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** * Same as above, but with a VectorSlice argument instead. */ - void reinit (const unsigned int m, - const unsigned int n, + void reinit (const size_type m, + const size_type n, const VectorSlice<const std::vector<unsigned int> > &row_lengths); /** @@ -718,8 +738,8 @@ public: * version of this function without the last argument. */ template <typename ForwardIterator> - void copy_from (const unsigned int n_rows, - const unsigned int n_cols, + void copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, const bool optimize_diagonal) DEAL_II_DEPRECATED; @@ -801,8 +821,8 @@ public: * iterators that point to such pairs. */ template <typename ForwardIterator> - void copy_from (const unsigned int n_rows, - const unsigned int n_cols, + void copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end); @@ -867,8 +887,8 @@ public: * * If the entry already exists, nothing bad happens. */ - void add (const unsigned int i, - const unsigned int j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the specified matrix row. This function @@ -877,10 +897,10 @@ public: * If some of the entries already exist, nothing bad happens. */ template <typename ForwardIterator> - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted = false); // @} /** @@ -914,7 +934,7 @@ public: * Note also the discussion in the general documentation of this class about * the order in which elements are accessed. */ - iterator begin (const unsigned int r) const; + iterator begin (const size_type r) const; /** * Final iterator of row <tt>r</tt>. It points to the first element past the @@ -924,7 +944,7 @@ public: * particular the case if it is the end iterator for the last row of a * matrix. */ - iterator end (const unsigned int r) const; + iterator end (const size_type r) const; /** * STL-like iterator with the first entry of row <tt>r</tt>. @@ -937,7 +957,7 @@ public: * @deprecated Use the iterators provided by the begin() and end() * functions instead. */ - row_iterator row_begin (const unsigned int r) const DEAL_II_DEPRECATED; + row_iterator row_begin (const size_type r) const DEAL_II_DEPRECATED; /** * Final iterator of row <tt>r</tt>. It points to the first element past the @@ -950,7 +970,7 @@ public: * @deprecated Use the iterators provided by the begin() and end() * functions instead. */ - row_iterator row_end (const unsigned int r) const DEAL_II_DEPRECATED; + row_iterator row_end (const size_type r) const DEAL_II_DEPRECATED; // @} /** @@ -973,7 +993,7 @@ public: * equals the number given to the constructor, while after compression, it * equals the maximum number of entries actually allocated by the user. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Compute the bandwidth of the matrix represented by this structure. The @@ -981,7 +1001,7 @@ public: * represents a nonzero entry of the matrix. Consequently, the maximum * bandwidth a $n\times m$ matrix can have is $\max\{n-1,m-1\}$. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements of this matrix. Actually, it @@ -991,7 +1011,7 @@ public: * This function may only be called if the matrix struct is compressed. It * does not make too much sense otherwise anyway. */ - std::size_t n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether the structure is compressed or not. @@ -1002,18 +1022,18 @@ public: * Return number of rows of this matrix, which equals the dimension of the * image space. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return number of columns of this matrix, which equals the dimension of * the range space. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const unsigned int row) const; + unsigned int row_length (const size_type row) const; /** * Determine whether the matrix uses the special convention for quadratic @@ -1071,8 +1091,8 @@ public: * single row. In such cases, it is more efficient to use iterators over * the elements of the sparsity pattern or of the sparse matrix. */ - unsigned int operator() (const unsigned int i, - const unsigned int j) const; + size_type operator() (const size_type i, + const size_type j) const; /** * This is the inverse operation to operator()(): given a global index, find @@ -1085,14 +1105,14 @@ public: * If <tt>N</tt> is the number of rows of this matrix, then the complexity * of this function is <i>log(N)</i>. */ - std::pair<unsigned int, unsigned int> - matrix_position (const unsigned int global_index) const; + std::pair<size_type, size_type> + matrix_position (const size_type global_index) const; /** * Check if a value at a certain position may be non-zero. */ - bool exists (const unsigned int i, - const unsigned int j) const; + bool exists (const size_type i, + const size_type j) const; /** * The index of a global matrix entry in its row. @@ -1101,8 +1121,8 @@ public: * with respect to the total field, but only with respect to the row * <tt>j</tt>. */ - unsigned int row_position(const unsigned int i, - const unsigned int j) const; + size_type row_position(const size_type i, + const size_type j) const; /** * Access to column number field. Return the column number of the @@ -1115,8 +1135,8 @@ public: * i.e. <tt>column_number(row,i)</tt> <tt><</tt> * <tt>column_number(row,i+1)</tt>. */ - unsigned int column_number (const unsigned int row, - const unsigned int index) const; + size_type column_number (const size_type row, + const unsigned int index) const; // @} @@ -1268,7 +1288,7 @@ public: * yourself, you should also rename this function to avoid programs relying * on outdated information! */ - const unsigned int *get_column_numbers () const DEAL_II_DEPRECATED; + const size_type *get_column_numbers () const DEAL_II_DEPRECATED; BOOST_SERIALIZATION_SPLIT_MEMBER() /** @addtogroup Exceptions @@ -1326,24 +1346,24 @@ private: * be larger than #rows and in this case #rowstart has more elements than * are used. */ - unsigned int max_dim; + size_type max_dim; /** * Number of rows that this sparsity structure shall represent. */ - unsigned int rows; + size_type rows; /** * Number of columns that this sparsity structure shall represent. */ - unsigned int cols; + size_type cols; /** * Size of the actually allocated array #colnums. Here, the same applies as * for the #rowstart array, i.e. it may be larger than the actually used * part of the array. */ - std::size_t max_vec_len; + size_type max_vec_len; /** * Maximum number of elements per row. This is set to the value given to the @@ -1375,7 +1395,7 @@ private: * <i>r</i> are stored within the index range * #rowstart[<i>r</i>]...#rowstart[<i>r+1</i>]. Therefore to find out * whether a given element (<i>r,c</i>) exists, we have to check whether the - * column number <i>c</i> exists in the abovementioned range within this + * column number <i>c</i> exists in the above-mentioned range within this * array. If it exists, say at position <i>p</i> within this array, the * value of the respective element in the sparse matrix will also be at * position <i>p</i> of the values array of that class. @@ -1391,7 +1411,7 @@ private: * sorted, such that finding whether an element exists and determining its * position can be done by a binary search. */ - unsigned int *colnums; + size_type *colnums; /** * Store whether the compress() function was called for this object. @@ -1434,8 +1454,8 @@ namespace SparsityPatternIterators inline Accessor:: Accessor (const SparsityPattern *sparsity_pattern, - const unsigned int r, - const unsigned int i) + const size_type r, + const size_type i) : sparsity_pattern(sparsity_pattern), index_within_sparsity(sparsity_pattern->rowstart[r]+i) @@ -1473,12 +1493,12 @@ namespace SparsityPatternIterators inline - unsigned int + 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); @@ -1487,7 +1507,7 @@ namespace SparsityPatternIterators inline - unsigned int + size_type Accessor::column() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); @@ -1497,7 +1517,7 @@ namespace SparsityPatternIterators inline - unsigned int + size_type Accessor::index() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); @@ -1542,8 +1562,8 @@ namespace SparsityPatternIterators inline Iterator::Iterator (const SparsityPattern *sparsity_pattern, - const unsigned int r, - const unsigned int i) + const size_type r, + const size_type i) : accessor(sparsity_pattern, sparsity_pattern->rowstart[r]+i) {} @@ -1654,9 +1674,9 @@ SparsityPattern::end () const inline SparsityPattern::iterator -SparsityPattern::begin (const unsigned int r) const +SparsityPattern::begin (const size_type r) const { - Assert (r<n_rows(), ExcIndexRange(r,0,n_rows())); + Assert (r<n_rows(), ExcIndexRangeType<size_type>(r,0,n_rows())); return iterator(this, rowstart[r]); } @@ -1665,9 +1685,9 @@ SparsityPattern::begin (const unsigned int r) const inline SparsityPattern::iterator -SparsityPattern::end (const unsigned int r) const +SparsityPattern::end (const size_type r) const { - Assert (r<n_rows(), ExcIndexRange(r,0,n_rows())); + Assert (r<n_rows(), ExcIndexRangeType<size_type>(r,0,n_rows())); return iterator(this, rowstart[r+1]); } @@ -1676,9 +1696,9 @@ SparsityPattern::end (const unsigned int r) const inline SparsityPattern::row_iterator -SparsityPattern::row_begin (const unsigned int r) const +SparsityPattern::row_begin (const size_type r) const { - Assert (r<n_rows(), ExcIndexRange(r,0,n_rows())); + Assert (r<n_rows(), ExcIndexRangeType<size_type>(r,0,n_rows())); return &colnums[rowstart[r]]; } @@ -1686,16 +1706,16 @@ SparsityPattern::row_begin (const unsigned int r) const inline SparsityPattern::row_iterator -SparsityPattern::row_end (const unsigned int r) const +SparsityPattern::row_end (const size_type r) const { - Assert (r<n_rows(), ExcIndexRange(r,0,n_rows())); + Assert (r<n_rows(), ExcIndexRangeType<size_type>(r,0,n_rows())); return &colnums[rowstart[r+1]]; } inline -unsigned int +SparsityPattern::size_type SparsityPattern::n_rows () const { return rows; @@ -1703,7 +1723,7 @@ SparsityPattern::n_rows () const inline -unsigned int +SparsityPattern::size_type SparsityPattern::n_cols () const { return cols; @@ -1743,7 +1763,7 @@ SparsityPattern::get_rowstart_indices () const inline -const unsigned int * +const SparsityPattern::size_type * SparsityPattern::get_column_numbers () const { return colnums; @@ -1753,20 +1773,20 @@ SparsityPattern::get_column_numbers () const inline unsigned int -SparsityPattern::row_length (const unsigned int row) const +SparsityPattern::row_length (const size_type row) const { - Assert(row<rows, ExcIndexRange(row,0,rows)); + Assert(row<rows, ExcIndexRangeType<size_type>(row,0,rows)); return rowstart[row+1]-rowstart[row]; } inline -unsigned int -SparsityPattern::column_number (const unsigned int row, +SparsityPattern::size_type +SparsityPattern::column_number (const size_type row, const unsigned int index) const { - Assert(row<rows, ExcIndexRange(row,0,rows)); + Assert(row<rows, ExcIndexRangeType<size_type>(row,0,rows)); Assert(index<row_length(row), ExcIndexRange(index,0,row_length(row))); return colnums[rowstart[row]+index]; @@ -1774,7 +1794,7 @@ SparsityPattern::column_number (const unsigned int row, inline -std::size_t +SparsityPattern::size_type SparsityPattern::n_nonzero_elements () const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); @@ -1811,7 +1831,7 @@ SparsityPattern::load (Archive &ar, const unsigned int) ar &max_dim &rows &cols &max_vec_len &max_row_length &compressed &store_diagonal_first_in_row; rowstart = new std::size_t [max_dim + 1]; - colnums = new unsigned int [max_vec_len]; + colnums = new size_type [max_vec_len]; ar &boost::serialization::make_array(rowstart, max_dim + 1); ar &boost::serialization::make_array(colnums, max_vec_len); @@ -1833,11 +1853,11 @@ SparsityPattern::operator == (const SparsityPattern &sp2) const store_diagonal_first_in_row != sp2.store_diagonal_first_in_row) return false; - for (unsigned int i = 0; i < rows+1; ++i) + for (size_type i = 0; i < rows+1; ++i) if (rowstart[i] != sp2.rowstart[i]) return false; - for (unsigned int i = 0; i < rowstart[rows]; ++i) + for (size_type i = 0; i < rowstart[rows]; ++i) if (colnums[i] != sp2.colnums[i]) return false; @@ -1850,9 +1870,14 @@ namespace internal { namespace SparsityPatternTools { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + inline - unsigned int - get_column_index_from_iterator (const unsigned int i) + size_type + get_column_index_from_iterator (const size_type i) { return i; } @@ -1861,8 +1886,8 @@ namespace internal template <typename value> inline - unsigned int - get_column_index_from_iterator (const std::pair<unsigned int, value> &i) + size_type + get_column_index_from_iterator (const std::pair<size_type, value> &i) { return i.first; } @@ -1871,8 +1896,8 @@ namespace internal template <typename value> inline - unsigned int - get_column_index_from_iterator (const std::pair<const unsigned int, value> &i) + size_type + get_column_index_from_iterator (const std::pair<const size_type, value> &i) { return i.first; } @@ -1883,8 +1908,8 @@ namespace internal template <typename ForwardIterator> void -SparsityPattern::copy_from (const unsigned int n_rows, - const unsigned int n_cols, +SparsityPattern::copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, const bool) @@ -1896,12 +1921,12 @@ SparsityPattern::copy_from (const unsigned int n_rows, template <typename ForwardIterator> void -SparsityPattern::copy_from (const unsigned int n_rows, - const unsigned int n_cols, +SparsityPattern::copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end) { - Assert (static_cast<unsigned int>(std::distance (begin, end)) == n_rows, + Assert (static_cast<size_type>(std::distance (begin, end)) == n_rows, ExcIteratorRange (std::distance (begin, end), n_rows)); // first determine row lengths for each row. if the matrix is quadratic, @@ -1922,15 +1947,15 @@ SparsityPattern::copy_from (const unsigned int n_rows, // // for use in the inner loop, we define a typedef to the type of the inner // iterators - unsigned int row = 0; + size_type row = 0; typedef typename std::iterator_traits<ForwardIterator>::value_type::const_iterator inner_iterator; for (ForwardIterator i=begin; i!=end; ++i, ++row) { - unsigned int *cols = &colnums[rowstart[row]] + (is_square ? 1 : 0); + size_type *cols = &colnums[rowstart[row]] + (is_square ? 1 : 0); const inner_iterator end_of_row = i->end(); for (inner_iterator j=i->begin(); j!=end_of_row; ++j) { - const unsigned int col + const size_type col = internal::SparsityPatternTools::get_column_index_from_iterator(*j); Assert (col < n_cols, ExcIndexRange(col,0,n_cols)); diff --git a/deal.II/include/deal.II/lac/sparsity_tools.h b/deal.II/include/deal.II/lac/sparsity_tools.h index 38567d3702..46b7d07308 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 @@ -41,6 +46,11 @@ class SparsityPattern; */ namespace SparsityTools { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Use the METIS partitioner to generate * a partitioning of the degrees of @@ -191,8 +201,8 @@ namespace SparsityTools */ void reorder_Cuthill_McKee (const SparsityPattern &sparsity, - std::vector<unsigned int> &new_indices, - const std::vector<unsigned int> &starting_indices = std::vector<unsigned int>()); + std::vector<size_type> &new_indices, + const std::vector<size_type> &starting_indices = std::vector<size_type>()); #ifdef DEAL_II_WITH_MPI @@ -237,7 +247,7 @@ namespace SparsityTools */ template <class CSP_t> void distribute_sparsity_pattern(CSP_t &csp, - const std::vector<unsigned int> &rows_per_cpu, + const std::vector<size_type> &rows_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 163b2cfa34..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 @@ -45,6 +50,11 @@ template<typename number> class TridiagonalMatrix { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * @name Constructors and initalization. */ @@ -53,7 +63,7 @@ public: * empty matrix of dimension * <tt>n</tt>. */ - TridiagonalMatrix(unsigned int n = 0, + TridiagonalMatrix(size_type n = 0, bool symmetric = false); /** @@ -62,7 +72,7 @@ public: * to zero. The symmetry * properties may be set as well. */ - void reinit(unsigned int n, + void reinit(size_type n, bool symmetric = false); @@ -75,14 +85,14 @@ public: * To remember: this matrix is an * <i>m x m</i>-matrix. */ - unsigned int m () const; + size_type m () const; /** * Number of columns of this matrix. * To remember: this matrix is an * <i>n x n</i>-matrix. */ - unsigned int n () const; + size_type n () const; /** * Return whether the matrix @@ -107,7 +117,7 @@ public: * the case where <i>|i-j| <= * 1</i>. */ - number operator()(unsigned int i, unsigned int j) const; + number operator()(size_type i, size_type j) const; /** * Read-write access to a @@ -124,7 +134,7 @@ public: * for matrix assembling in order * not to obtain doubled entries. */ - number &operator()(unsigned int i, unsigned int j); + number &operator()(size_type i, size_type j); //@} ///@name Multiplications with vectors @@ -294,7 +304,7 @@ public: * compute_eigenvalues(), you can * access each eigenvalue here. */ - number eigenvalue(const unsigned int i) const; + number eigenvalue(const size_type i) const; //@} ///@name Miscellanea //@{ @@ -375,7 +385,7 @@ private: #ifndef DOXYGEN template<typename number> -unsigned int +types::global_dof_index TridiagonalMatrix<number>::m() const { return diagonal.size(); @@ -384,7 +394,7 @@ TridiagonalMatrix<number>::m() const template<typename number> -unsigned int +types::global_dof_index TridiagonalMatrix<number>::n() const { return diagonal.size(); @@ -394,7 +404,7 @@ TridiagonalMatrix<number>::n() const template<typename number> inline number -TridiagonalMatrix<number>::operator()(unsigned int i, unsigned int j) const +TridiagonalMatrix<number>::operator()(size_type i, size_type j) const { Assert(i<n(), ExcIndexRange(i,0,n())); Assert(j<n(), ExcIndexRange(j,0,n())); @@ -422,7 +432,7 @@ TridiagonalMatrix<number>::operator()(unsigned int i, unsigned int j) const template<typename number> inline number & -TridiagonalMatrix<number>::operator()(unsigned int i, unsigned int j) +TridiagonalMatrix<number>::operator()(size_type i, size_type j) { Assert(i<n(), ExcIndexRange(i,0,n())); Assert(j<n(), ExcIndexRange(j,0,n())); @@ -455,7 +465,7 @@ TridiagonalMatrix<number>::print ( const unsigned int width, const unsigned int) const { - for (unsigned int i=0; i<n(); ++i) + for (size_type i=0; i<n(); ++i) { if (i>0) s << std::setw(width) << (*this)(i,i-1); 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 1550c8a246..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 @@ -176,8 +181,8 @@ namespace TrilinosWrappers * user call whatever function * she desires. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + void reinit (const size_type n_block_rows, + const size_type n_block_columns); /** * Resize the matrix, by using an @@ -290,7 +295,7 @@ namespace TrilinosWrappers * elements of this * matrix. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Matrix-vector multiplication: let $dst = M*src$ with $M$ being this @@ -547,8 +552,8 @@ namespace TrilinosWrappers { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) this->block(r,c) = d; return *this; @@ -561,8 +566,8 @@ namespace TrilinosWrappers BlockSparseMatrix::is_compressed () const { bool compressed = true; - for (unsigned int row=0; row<n_block_rows(); ++row) - for (unsigned int col=0; col<n_block_cols(); ++col) + for (size_type row=0; row<n_block_rows(); ++row) + for (size_type col=0; col<n_block_cols(); ++col) if (block(row, col).is_compressed() == false) { compressed = false; 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 378a4a0d71..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 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 @@ -146,7 +151,7 @@ namespace TrilinosWrappers * fill appropriate data using a * reinit of the blocks. */ - explicit BlockVector (const unsigned int num_blocks); + explicit BlockVector (const size_type num_blocks); /** * Constructor. Set the number of @@ -156,7 +161,7 @@ namespace TrilinosWrappers * * References BlockVector.reinit(). */ - explicit BlockVector (const std::vector<unsigned int> &N); + explicit BlockVector (const std::vector<size_type> &N); /** * Constructor. Set the number of @@ -177,9 +182,9 @@ namespace TrilinosWrappers * different blocks. */ template <typename InputIterator> - BlockVector (const std::vector<unsigned int> &n, - const InputIterator first, - const InputIterator end); + BlockVector (const std::vector<size_type> &n, + const InputIterator first, + const InputIterator end); /** * Destructor. Clears memory @@ -308,14 +313,12 @@ namespace TrilinosWrappers * If <tt>fast==false</tt>, the vector * is filled with zeros. */ - void reinit (const std::vector<unsigned int> &N, - const bool fast=false); + void reinit (const std::vector<size_type> &N, + const bool fast=false); /** - * Reinit the function - * according to a distributed - * block vector. The elements - * will be copied in this + * Reinitialize the vector in the same way as the given to a + * distributed block vector. The elements will be copied in this * process. */ void reinit (const MPI::BlockVector &V); @@ -360,7 +363,7 @@ namespace TrilinosWrappers * calls <tt>collect_sizes</tt> * afterwards. */ - void reinit (const unsigned int num_blocks); + void reinit (const size_type num_blocks); /** * Swap the contents of this @@ -454,7 +457,7 @@ namespace TrilinosWrappers inline - BlockVector::BlockVector (const std::vector<unsigned int> &N) + BlockVector::BlockVector (const std::vector<size_type> &N) { reinit (N); } @@ -462,21 +465,21 @@ namespace TrilinosWrappers template <typename InputIterator> - BlockVector::BlockVector (const std::vector<unsigned int> &n, - const InputIterator first, - const InputIterator end) + BlockVector::BlockVector (const std::vector<size_type> &n, + const InputIterator first, + const InputIterator end) { // first set sizes of blocks, but // don't initialize them as we will // copy elements soon reinit (n, true); InputIterator start = first; - for (unsigned int b=0; b<n.size(); ++b) + for (size_type b=0; b<n.size(); ++b) { InputIterator end = start; - std::advance (end, static_cast<signed int>(n[b])); + std::advance (end, static_cast<size_type>(n[b])); - for (unsigned int i=0; i<n[b]; ++i, ++start) + for (size_type i=0; i<n[b]; ++i, ++start) this->block(b)(i) = *start; } Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize()); @@ -485,7 +488,7 @@ namespace TrilinosWrappers inline - BlockVector::BlockVector (const unsigned int num_blocks) + BlockVector::BlockVector (const size_type num_blocks) { reinit (num_blocks); } @@ -514,7 +517,7 @@ namespace TrilinosWrappers this->components.resize (v.n_blocks()); this->block_indices = v.block_indices; - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.components[i]; } @@ -550,13 +553,13 @@ namespace TrilinosWrappers { if (n_blocks() != v.n_blocks()) { - std::vector<unsigned int> block_sizes (v.n_blocks(), 0); + std::vector<size_type> block_sizes (v.n_blocks(), 0); block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); } - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.block(i); collect_sizes(); 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 937640f672..f35166b1c3 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,7 @@ namespace TrilinosWrappers * processes. */ explicit BlockVector (const std::vector<IndexSet> &parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Copy-Constructor. Set all the @@ -140,7 +145,7 @@ namespace TrilinosWrappers * fill appropriate data using a * reinit of the blocks. */ - explicit BlockVector (const unsigned int num_blocks); + explicit BlockVector (const size_type num_blocks); /** * Destructor. Clears memory @@ -225,6 +230,14 @@ namespace TrilinosWrappers void reinit (const std::vector<IndexSet> &parallel_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<IndexSet> &partitioning, + const std::vector<IndexSet> &ghost_values, + const MPI_Comm &communicator = MPI_COMM_WORLD); + /** * Change the dimension to that @@ -266,7 +279,7 @@ namespace TrilinosWrappers * calls <tt>collect_sizes</tt> * afterwards. */ - void reinit (const unsigned int num_blocks); + void reinit (const size_type num_blocks); /** * This reinit function is meant to @@ -420,7 +433,7 @@ namespace TrilinosWrappers inline - BlockVector::BlockVector (const unsigned int num_blocks) + BlockVector::BlockVector (const size_type num_blocks) { reinit (num_blocks); } @@ -435,7 +448,7 @@ namespace TrilinosWrappers this->components.resize (v.n_blocks()); this->block_indices = v.block_indices; - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.components[i]; } @@ -482,13 +495,13 @@ namespace TrilinosWrappers { if (n_blocks() != v.n_blocks()) { - std::vector<unsigned int> block_sizes (v.n_blocks(), 0); + std::vector<size_type> block_sizes (v.n_blocks(), 0); block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); } - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.block(i); collect_sizes(); diff --git a/deal.II/include/deal.II/lac/trilinos_precondition.h b/deal.II/include/deal.II/lac/trilinos_precondition.h index 173648e827..34a6017f4f 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 @@ -72,6 +77,10 @@ namespace TrilinosWrappers class PreconditionBase : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef dealii::types::global_dof_index size_type; /** * Standardized data struct to @@ -1487,7 +1496,7 @@ namespace TrilinosWrappers * Prints an estimate of the memory * consumption of this class. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; private: /** @@ -1565,9 +1574,9 @@ namespace TrilinosWrappers void PreconditionBase::vmult (dealii::Vector<double> &dst, const dealii::Vector<double> &src) const { - AssertDimension (static_cast<int>(dst.size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(dst.size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast<int>(src.size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(src.size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); @@ -1583,9 +1592,9 @@ namespace TrilinosWrappers void PreconditionBase::Tvmult (dealii::Vector<double> &dst, const dealii::Vector<double> &src) const { - AssertDimension (static_cast<int>(dst.size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(dst.size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast<int>(src.size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(src.size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); @@ -1605,9 +1614,9 @@ namespace TrilinosWrappers PreconditionBase::vmult (parallel::distributed::Vector<double> &dst, const parallel::distributed::Vector<double> &src) const { - AssertDimension (static_cast<int>(dst.local_size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(dst.local_size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast<int>(src.local_size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(src.local_size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); @@ -1623,9 +1632,9 @@ namespace TrilinosWrappers PreconditionBase::Tvmult (parallel::distributed::Vector<double> &dst, const parallel::distributed::Vector<double> &src) const { - AssertDimension (static_cast<int>(dst.local_size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(dst.local_size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast<int>(src.local_size()), + AssertDimension (static_cast<TrilinosWrappers::types::int_type>(src.local_size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); 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 + * <tt>Ax=b</tt> where <tt>A</tt> + * 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 * <tt>Ax=b</tt>. Depending on the @@ -179,6 +204,32 @@ namespace TrilinosWrappers const dealii::Vector<double> &b, const PreconditionBase &preconditioner); + /** + * Solve the linear system + * <tt>Ax=b</tt> where <tt>A</tt> + * 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<double> &x, + const dealii::Vector<double> &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 abcab431af..8349654f99 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 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 @@ -72,7 +77,7 @@ namespace TrilinosWrappers * Exception */ DeclException3 (ExcAccessToNonlocalRow, - int, int, int, + std::size_t, std::size_t, std::size_t, << "You tried to access row " << arg1 << " of a distributed sparsity pattern, " << " but only rows " << arg2 << " through " << arg3 @@ -97,30 +102,35 @@ namespace TrilinosWrappers class AccessorBase { public: + /** + * Declare the type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * Constructor. */ AccessorBase (SparseMatrix *matrix, - const unsigned int row, - const unsigned int index); + const size_type row, + const size_type index); /** * Row number of the element * represented by this object. */ - unsigned int row() const; + size_type row() const; /** * Index in row of the element * represented by this object. */ - unsigned int index() const; + size_type index() const; /** * Column number of the element * represented by this object. */ - unsigned int column() const; + size_type column() const; protected: /** @@ -138,12 +148,12 @@ namespace TrilinosWrappers /** * Current row number. */ - unsigned int a_row; + size_type a_row; /** * Current index in row. */ - unsigned int a_index; + size_type a_index; /** * Discard the old row caches @@ -180,7 +190,7 @@ namespace TrilinosWrappers * than one accessor can access * this data if necessary. */ - std_cxx1x::shared_ptr<std::vector<unsigned int> > colnum_cache; + std_cxx1x::shared_ptr<std::vector<size_type> > colnum_cache; /** * Cache for the values @@ -234,8 +244,8 @@ namespace TrilinosWrappers * pointer is sufficient. */ Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index); + const size_type row, + const size_type index); /** * Copy constructor to get from a @@ -335,8 +345,8 @@ namespace TrilinosWrappers * pointer is sufficient. */ Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index); + const size_type row, + const size_type index); /** * Value of this matrix entry. @@ -374,6 +384,11 @@ namespace TrilinosWrappers class Iterator { public: + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * Typedef for the matrix type * (including constness) we are to @@ -388,8 +403,8 @@ namespace TrilinosWrappers * the index within it. */ Iterator (MatrixType *matrix, - const unsigned int row, - const unsigned int index); + const size_type row, + const size_type index); /** * Copy constructor with @@ -449,7 +464,7 @@ namespace TrilinosWrappers * Exception */ DeclException2 (ExcInvalidIndexWithinRow, - int, int, + size_type, size_type, << "Attempt to access element " << arg2 << " of row " << arg1 << " which doesn't have that many elements."); @@ -500,6 +515,11 @@ namespace TrilinosWrappers class SparseMatrix : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * A structure that describes * some of the traits of this @@ -560,8 +580,8 @@ namespace TrilinosWrappers * row is specified as the maximum * number of entries argument. */ - SparseMatrix (const unsigned int m, - const unsigned int n, + SparseMatrix (const size_type m, + const size_type n, const unsigned int n_max_entries_per_row); /** @@ -574,8 +594,8 @@ namespace TrilinosWrappers * specifies the number of entries in * each row. */ - SparseMatrix (const unsigned int m, - const unsigned int n, + SparseMatrix (const size_type m, + const size_type n, const std::vector<unsigned int> &n_entries_per_row); /** @@ -729,8 +749,8 @@ namespace TrilinosWrappers * memory prior to use (in the * compress() step). */ - SparseMatrix (const Epetra_Map &parallel_partitioning, - const unsigned int n_max_entries_per_row = 0); + SparseMatrix (const Epetra_Map &parallel_partitioning, + const size_type n_max_entries_per_row = 0); /** * Same as before, but now set a @@ -777,9 +797,9 @@ namespace TrilinosWrappers * number of columns entries per row * that will be allocated. */ - SparseMatrix (const Epetra_Map &row_parallel_partitioning, - const Epetra_Map &col_parallel_partitioning, - const unsigned int n_max_entries_per_row = 0); + SparseMatrix (const Epetra_Map &row_parallel_partitioning, + const Epetra_Map &col_parallel_partitioning, + const size_type n_max_entries_per_row = 0); /** * This constructor is similar to the @@ -975,9 +995,9 @@ namespace TrilinosWrappers * memory prior to use (in the * compress() step). */ - SparseMatrix (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD, - const unsigned int n_max_entries_per_row = 0); + SparseMatrix (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD, + const unsigned int n_max_entries_per_row = 0); /** * Same as before, but now set the @@ -1024,10 +1044,10 @@ namespace TrilinosWrappers * structure is reorganized in the * compress() call. */ - SparseMatrix (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD, - const unsigned int n_max_entries_per_row = 0); + SparseMatrix (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD, + const size_type n_max_entries_per_row = 0); /** * This constructor is similar to the @@ -1211,13 +1231,13 @@ namespace TrilinosWrappers * Return the number of rows in * this matrix. */ - unsigned int m () const; + size_type m () const; /** * Return the number of columns * in this matrix. */ - unsigned int n () const; + size_type n () const; /** * Return the local dimension @@ -1251,7 +1271,7 @@ namespace TrilinosWrappers * where * <tt>n=local_size()</tt>. */ - std::pair<unsigned int, unsigned int> + std::pair<size_type, size_type> local_range () const; /** @@ -1259,19 +1279,19 @@ namespace TrilinosWrappers * in the local range or not, * see also local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return the number of nonzero * elements of this matrix. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Number of entries in a * specific row. */ - unsigned int row_length (const unsigned int row) const; + unsigned int row_length (const size_type row) const; /** * Returns the state of the matrix, @@ -1292,7 +1312,7 @@ namespace TrilinosWrappers * returned in case this is called in * an MPI-based program. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; //@} /** @@ -1407,8 +1427,8 @@ namespace TrilinosWrappers * the matrix with a sparsity pattern * first. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const TrilinosScalar value); /** @@ -1447,7 +1467,7 @@ namespace TrilinosWrappers * <tt>false</tt>, i.e., even zero * values are inserted/replaced. */ - void set (const std::vector<unsigned int> &indices, + void set (const std::vector<size_type> &indices, const FullMatrix<TrilinosScalar> &full_matrix, const bool elide_zero_values = false); @@ -1458,8 +1478,8 @@ namespace TrilinosWrappers * different local-to-global indexing * on rows and columns, respectively. */ - void set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, + void set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<TrilinosScalar> &full_matrix, const bool elide_zero_values = false); @@ -1490,8 +1510,8 @@ namespace TrilinosWrappers * <tt>false</tt>, i.e., even zero * values are inserted/replaced. */ - void set (const unsigned int row, - const std::vector<unsigned int> &col_indices, + void set (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<TrilinosScalar> &values, const bool elide_zero_values = false); @@ -1522,9 +1542,9 @@ namespace TrilinosWrappers * <tt>false</tt>, i.e., even zero * values are inserted/replaced. */ - void set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void set (const size_type row, + const size_type n_cols, + const size_type *col_indices, const TrilinosScalar *values, const bool elide_zero_values = false); @@ -1543,8 +1563,8 @@ namespace TrilinosWrappers * <tt>value</tt> is not a finite * number an exception is thrown. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const TrilinosScalar value); /** @@ -1583,7 +1603,7 @@ namespace TrilinosWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const FullMatrix<TrilinosScalar> &full_matrix, const bool elide_zero_values = true); @@ -1594,8 +1614,8 @@ namespace TrilinosWrappers * different local-to-global indexing * on rows and columns, respectively. */ - void add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, + void add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<TrilinosScalar> &full_matrix, const bool elide_zero_values = true); @@ -1625,8 +1645,8 @@ namespace TrilinosWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const unsigned int row, - const std::vector<unsigned int> &col_indices, + void add (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<TrilinosScalar> &values, const bool elide_zero_values = true); @@ -1655,9 +1675,9 @@ namespace TrilinosWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const TrilinosScalar *values, const bool elide_zero_values = true, const bool col_indices_are_sorted = false); @@ -1734,7 +1754,7 @@ namespace TrilinosWrappers * default is to set it to * zero. */ - void clear_row (const unsigned int row, + void clear_row (const size_type row, const TrilinosScalar new_diag_value = 0); /** @@ -1753,8 +1773,8 @@ namespace TrilinosWrappers * diagonal entries, you have * to set them by hand. */ - void clear_rows (const std::vector<unsigned int> &rows, - const TrilinosScalar new_diag_value = 0); + void clear_rows (const std::vector<size_type> &rows, + const TrilinosScalar new_diag_value = 0); /** * Make an in-place transpose @@ -1787,8 +1807,8 @@ namespace TrilinosWrappers * is not saved on the calling * process. */ - TrilinosScalar operator () (const unsigned int i, - const unsigned int j) const; + TrilinosScalar operator () (const size_type i, + const size_type j) const; /** * Return the value of the @@ -1827,8 +1847,8 @@ namespace TrilinosWrappers * processor, and possibly so * with a nonzero value. */ - TrilinosScalar el (const unsigned int i, - const unsigned int j) const; + TrilinosScalar el (const size_type i, + const size_type j) const; /** * Return the main diagonal @@ -1841,7 +1861,7 @@ namespace TrilinosWrappers * See also the comment in * trilinos_sparse_matrix.cc. */ - TrilinosScalar diag_element (const unsigned int i) const; + TrilinosScalar diag_element (const size_type i) const; //@} /** @@ -2283,7 +2303,7 @@ namespace TrilinosWrappers * that the iterator may not be * dereferencable in that case. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row @@ -2300,7 +2320,7 @@ namespace TrilinosWrappers * the end iterator for the * last row of a matrix. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; /** * STL-like iterator with the @@ -2326,7 +2346,7 @@ namespace TrilinosWrappers * that the iterator may not be * dereferencable in that case. */ - iterator begin (const unsigned int r); + iterator begin (const size_type r); /** * Final iterator of row @@ -2343,7 +2363,7 @@ namespace TrilinosWrappers * the end iterator for the * last row of a matrix. */ - iterator end (const unsigned int r); + iterator end (const size_type r); //@} /** @@ -2394,7 +2414,7 @@ namespace TrilinosWrappers * Exception */ DeclException2 (ExcInvalidIndex, - int, int, + size_type, size_type, << "The entry with index <" << arg1 << ',' << arg2 << "> does not exist."); @@ -2412,7 +2432,7 @@ namespace TrilinosWrappers * Exception */ DeclException4 (ExcAccessToNonLocalElement, - int, int, int, int, + size_type, size_type, size_type, size_type, << "You tried to access element (" << arg1 << "/" << arg2 << ")" << " of a distributed matrix, but only rows " @@ -2423,7 +2443,7 @@ namespace TrilinosWrappers * Exception */ DeclException2 (ExcAccessToNonPresentElement, - int, int, + size_type, size_type, << "You tried to access element (" << arg1 << "/" << arg2 << ")" << " of a sparse matrix, but it appears to not" @@ -2540,7 +2560,7 @@ namespace TrilinosWrappers namespace SparseMatrixIterators { inline - AccessorBase::AccessorBase(SparseMatrix *matrix, unsigned int row, unsigned int index) + AccessorBase::AccessorBase(SparseMatrix *matrix, size_type row, size_type index) : matrix(matrix), a_row(row), @@ -2551,7 +2571,7 @@ namespace TrilinosWrappers inline - unsigned int + AccessorBase::size_type AccessorBase::row() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -2560,7 +2580,7 @@ namespace TrilinosWrappers inline - unsigned int + AccessorBase::size_type AccessorBase::column() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -2569,7 +2589,7 @@ namespace TrilinosWrappers inline - unsigned int + AccessorBase::size_type AccessorBase::index() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -2579,8 +2599,8 @@ namespace TrilinosWrappers inline Accessor<true>::Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index) + const size_type row, + const size_type index) : AccessorBase(const_cast<SparseMatrix *>(matrix), row, index) {} @@ -2674,8 +2694,8 @@ namespace TrilinosWrappers inline Accessor<false>::Accessor (MatrixType *matrix, - const unsigned int row, - const unsigned int index) + const size_type row, + const size_type index) : AccessorBase(matrix, row, index) {} @@ -2694,8 +2714,8 @@ namespace TrilinosWrappers template <bool Constness> inline Iterator<Constness>::Iterator(MatrixType *matrix, - const unsigned int row, - const unsigned int index) + const size_type row, + const size_type index) : accessor(matrix, row, index) {} @@ -2835,7 +2855,7 @@ namespace TrilinosWrappers inline SparseMatrix::const_iterator - SparseMatrix::begin(const unsigned int r) const + SparseMatrix::begin(const size_type r) const { Assert (r < m(), ExcIndexRange(r, 0, m())); if (row_length(r) > 0) @@ -2848,14 +2868,14 @@ namespace TrilinosWrappers inline SparseMatrix::const_iterator - SparseMatrix::end(const unsigned int r) const + SparseMatrix::end(const size_type r) const { Assert (r < m(), ExcIndexRange(r, 0, m())); // place the iterator on the first entry // past this line, or at the end of the // matrix - for (unsigned int i=r+1; i<m(); ++i) + for (size_type i=r+1; i<m(); ++i) if (row_length(i) > 0) return const_iterator(this, i, 0); @@ -2886,7 +2906,7 @@ namespace TrilinosWrappers inline SparseMatrix::iterator - SparseMatrix::begin(const unsigned int r) + SparseMatrix::begin(const size_type r) { Assert (r < m(), ExcIndexRange(r, 0, m())); if (row_length(r) > 0) @@ -2899,14 +2919,14 @@ namespace TrilinosWrappers inline SparseMatrix::iterator - SparseMatrix::end(const unsigned int r) + SparseMatrix::end(const size_type r) { Assert (r < m(), ExcIndexRange(r, 0, m())); // place the iterator on the first entry // past this line, or at the end of the // matrix - for (unsigned int i=r+1; i<m(); ++i) + for (size_type i=r+1; i<m(); ++i) if (row_length(i) > 0) return iterator(this, i, 0); @@ -2919,14 +2939,19 @@ namespace TrilinosWrappers inline bool - SparseMatrix::in_local_range (const unsigned int index) const + SparseMatrix::in_local_range (const size_type index) const { - int begin, end; + TrilinosWrappers::types::int_type begin, end; +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + begin = matrix->RowMap().MinMyGID(); + end = matrix->RowMap().MaxMyGID()+1; +#else begin = matrix->RowMap().MinMyGID(); end = matrix->RowMap().MaxMyGID()+1; +#endif - return ((index >= static_cast<unsigned int>(begin)) && - (index < static_cast<unsigned int>(end))); + return ((index >= static_cast<size_type>(begin)) && + (index < static_cast<size_type>(end))); } @@ -2947,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)); @@ -3013,8 +3038,8 @@ namespace TrilinosWrappers // compile time. inline void - SparseMatrix::set (const unsigned int i, - const unsigned int j, + SparseMatrix::set (const size_type i, + const size_type j, const TrilinosScalar value) { @@ -3027,7 +3052,7 @@ namespace TrilinosWrappers inline void - SparseMatrix::set (const std::vector<unsigned int> &indices, + SparseMatrix::set (const std::vector<size_type> &indices, const FullMatrix<TrilinosScalar> &values, const bool elide_zero_values) { @@ -3035,7 +3060,7 @@ namespace TrilinosWrappers ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) set (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -3044,8 +3069,8 @@ namespace TrilinosWrappers inline void - SparseMatrix::set (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, + SparseMatrix::set (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<TrilinosScalar> &values, const bool elide_zero_values) { @@ -3054,7 +3079,7 @@ namespace TrilinosWrappers Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -3063,8 +3088,8 @@ namespace TrilinosWrappers inline void - SparseMatrix::set (const unsigned int row, - const std::vector<unsigned int> &col_indices, + SparseMatrix::set (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<TrilinosScalar> &values, const bool elide_zero_values) { @@ -3079,9 +3104,9 @@ namespace TrilinosWrappers inline void - SparseMatrix::set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + SparseMatrix::set (const size_type row, + const size_type n_cols, + const size_type *col_indices, const TrilinosScalar *values, const bool elide_zero_values) { @@ -3096,14 +3121,14 @@ namespace TrilinosWrappers last_action = Insert; - int *col_index_ptr; + TrilinosWrappers::types::int_type *col_index_ptr; TrilinosScalar *col_value_ptr; - int n_columns; + TrilinosWrappers::types::int_type n_columns; TrilinosScalar short_val_array[100]; - int short_index_array[100]; + TrilinosWrappers::types::int_type short_index_array[100]; std::vector<TrilinosScalar> long_val_array; - std::vector<int> long_index_array; + std::vector<TrilinosWrappers::types::int_type> long_index_array; // If we don't elide zeros, the pointers are already available... need to @@ -3111,8 +3136,8 @@ namespace TrilinosWrappers // we will not modify const data) if (elide_zero_values == false) { - col_index_ptr = (int *)col_indices; - col_value_ptr = const_cast<TrilinosScalar*>(values); + col_index_ptr = (TrilinosWrappers::types::int_type *)col_indices; + col_value_ptr = const_cast<TrilinosScalar *>(values); n_columns = n_cols; } else @@ -3133,7 +3158,7 @@ namespace TrilinosWrappers } n_columns = 0; - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const double value = values[j]; Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -3145,7 +3170,7 @@ namespace TrilinosWrappers } } - Assert(n_columns <= (int)n_cols, ExcInternalError()); + Assert(n_columns <= (TrilinosWrappers::types::int_type)n_cols, ExcInternalError()); } @@ -3157,13 +3182,14 @@ namespace TrilinosWrappers // one is when the pattern is already fixed. In the former case, we add // the possibility to insert new values, and in the second we just replace // data. - if (row_partitioner().MyGID(static_cast<int>(row)) == true) + if (row_partitioner().MyGID(static_cast<TrilinosWrappers::types::int_type>(row)) == true) { if (matrix->Filled() == false) { - ierr = matrix->Epetra_CrsMatrix::InsertGlobalValues(row, n_columns, - col_value_ptr, - col_index_ptr); + ierr = matrix->Epetra_CrsMatrix::InsertGlobalValues( + static_cast<TrilinosWrappers::types::int_type>(row), + static_cast<int>(n_columns),const_cast<double *>(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 @@ -3188,7 +3214,8 @@ namespace TrilinosWrappers if (matrix->Filled() == false) { - ierr = matrix->InsertGlobalValues (1, (int *)&row, + ierr = matrix->InsertGlobalValues (1, + (TrilinosWrappers::types::int_type *)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); @@ -3196,7 +3223,8 @@ namespace TrilinosWrappers ierr = 0; } else - ierr = matrix->ReplaceGlobalValues (1, (int *)&row, + ierr = matrix->ReplaceGlobalValues (1, + (TrilinosWrappers::types::int_type *)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); @@ -3210,8 +3238,8 @@ namespace TrilinosWrappers inline void - SparseMatrix::add (const unsigned int i, - const unsigned int j, + SparseMatrix::add (const size_type i, + const size_type j, const TrilinosScalar value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -3247,7 +3275,7 @@ namespace TrilinosWrappers inline void - SparseMatrix::add (const std::vector<unsigned int> &indices, + SparseMatrix::add (const std::vector<size_type> &indices, const FullMatrix<TrilinosScalar> &values, const bool elide_zero_values) { @@ -3255,7 +3283,7 @@ namespace TrilinosWrappers ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i<indices.size(); ++i) + for (size_type i=0; i<indices.size(); ++i) add (indices[i], indices.size(), &indices[0], &values(i,0), elide_zero_values); } @@ -3264,8 +3292,8 @@ namespace TrilinosWrappers inline void - SparseMatrix::add (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices, + SparseMatrix::add (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices, const FullMatrix<TrilinosScalar> &values, const bool elide_zero_values) { @@ -3274,7 +3302,7 @@ namespace TrilinosWrappers Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i<row_indices.size(); ++i) + for (size_type i=0; i<row_indices.size(); ++i) add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0), elide_zero_values); } @@ -3283,8 +3311,8 @@ namespace TrilinosWrappers inline void - SparseMatrix::add (const unsigned int row, - const std::vector<unsigned int> &col_indices, + SparseMatrix::add (const size_type row, + const std::vector<size_type> &col_indices, const std::vector<TrilinosScalar> &values, const bool elide_zero_values) { @@ -3299,9 +3327,9 @@ namespace TrilinosWrappers inline void - SparseMatrix::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + SparseMatrix::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const TrilinosScalar *values, const bool elide_zero_values, const bool /*col_indices_are_sorted*/) @@ -3319,25 +3347,25 @@ namespace TrilinosWrappers last_action = Add; - int *col_index_ptr; + TrilinosWrappers::types::int_type *col_index_ptr; TrilinosScalar *col_value_ptr; - int n_columns; + TrilinosWrappers::types::int_type n_columns; double short_val_array[100]; - int short_index_array[100]; + TrilinosWrappers::types::int_type short_index_array[100]; std::vector<TrilinosScalar> long_val_array; - std::vector<int> long_index_array; + std::vector<TrilinosWrappers::types::int_type> long_index_array; // If we don't elide zeros, the pointers are already available... need to // cast to non-const pointers as that is the format taken by Trilinos (but // we will not modify const data) if (elide_zero_values == false) { - col_index_ptr = (int *)col_indices; - col_value_ptr = const_cast<TrilinosScalar*>(values); + col_index_ptr = (TrilinosWrappers::types::int_type *)col_indices; + col_value_ptr = const_cast<TrilinosScalar *>(values); n_columns = n_cols; #ifdef DEBUG - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) Assert (numbers::is_finite(values[j]), ExcNumberNotFinite()); #endif } @@ -3359,7 +3387,7 @@ namespace TrilinosWrappers } n_columns = 0; - for (unsigned int j=0; j<n_cols; ++j) + for (size_type j=0; j<n_cols; ++j) { const double value = values[j]; @@ -3372,14 +3400,14 @@ namespace TrilinosWrappers } } - Assert(n_columns <= (int)n_cols, ExcInternalError()); + Assert(n_columns <= (TrilinosWrappers::types::int_type)n_cols, ExcInternalError()); } // If the calling matrix owns the row to which we want to add values, we // can directly call the Epetra_CrsMatrix input function, which is much // faster than the Epetra_FECrsMatrix function. - if (row_partitioner().MyGID(static_cast<int>(row)) == true) + if (row_partitioner().MyGID(static_cast<TrilinosWrappers::types::int_type>(row)) == true) { ierr = matrix->Epetra_CrsMatrix::SumIntoGlobalValues(row, n_columns, col_value_ptr, @@ -3395,7 +3423,8 @@ namespace TrilinosWrappers // a time). compressed = false; - ierr = matrix->SumIntoGlobalValues (1, (int *)&row, n_columns, + ierr = matrix->SumIntoGlobalValues (1, + (TrilinosWrappers::types::int_type *)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); @@ -3409,15 +3438,15 @@ namespace TrilinosWrappers std::cout << "Got error " << ierr << " in row " << row << " of proc " << row_partitioner().Comm().MyPID() << " when trying to add the columns:" << std::endl; - for (int i=0; i<n_columns; ++i) + for (TrilinosWrappers::types::int_type i=0; i<n_columns; ++i) std::cout << col_index_ptr[i] << " "; std::cout << std::endl << std::endl; std::cout << "Matrix row has the following indices:" << std::endl; int n_indices, *indices; - trilinos_sparsity_pattern().ExtractMyRowView(row_partitioner().LID(static_cast<int>(row)), + trilinos_sparsity_pattern().ExtractMyRowView(row_partitioner().LID(static_cast<TrilinosWrappers::types::int_type>(row)), n_indices, indices); - for (int i=0; i<n_indices; ++i) + for (TrilinosWrappers::types::int_type i=0; i<n_indices; ++i) std::cout << indices[i] << " "; std::cout << endl << std::endl; Assert (ierr <= 0, @@ -3433,19 +3462,27 @@ namespace TrilinosWrappers // called frequently and do only involve // a call to some Trilinos function. inline - unsigned int + SparseMatrix::size_type SparseMatrix::m () const { - return matrix -> NumGlobalRows(); +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + return matrix->NumGlobalRows(); +#else + return matrix->NumGlobalRows64(); +#endif } inline - unsigned int + SparseMatrix::size_type SparseMatrix::n () const { - return matrix -> NumGlobalCols(); +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + return matrix->NumGlobalCols(); +#else + return matrix->NumGlobalCols64(); +#endif } @@ -3460,12 +3497,17 @@ namespace TrilinosWrappers inline - std::pair<unsigned int, unsigned int> + std::pair<SparseMatrix::size_type, SparseMatrix::size_type> SparseMatrix::local_range () const { - unsigned int begin, end; - begin = matrix -> RowMap().MinMyGID(); - end = matrix -> RowMap().MaxMyGID()+1; + size_type begin, end; +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + begin = matrix->RowMap().MinMyGID(); + end = matrix->RowMap().MaxMyGID()+1; +#else + begin = matrix->RowMap().MinMyGID64(); + end = matrix->RowMap().MaxMyGID64()+1; +#endif return std::make_pair (begin, end); } @@ -3473,10 +3515,14 @@ namespace TrilinosWrappers inline - unsigned int + SparseMatrix::size_type SparseMatrix::n_nonzero_elements () const { +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE return matrix->NumGlobalNonzeros(); +#else + return matrix->NumGlobalNonzeros64(); +#endif } @@ -3628,6 +3674,9 @@ namespace TrilinosWrappers ExcMessage ("Column map of matrix does not fit with vector map!")); Assert (out.vector_partitioner().SameAs(m.RangeMap()) == true, ExcMessage ("Row map of matrix does not fit with vector map!")); + (void)m; + (void)in; + (void)out; } } } @@ -3641,12 +3690,16 @@ namespace TrilinosWrappers { Assert (&src != &dst, ExcSourceEqualsDestination()); Assert (matrix->Filled(), ExcMatrixNotCompressed()); + (void)src; + (void)dst; internal::SparseMatrix::check_vector_map_equality(*matrix, src, dst); - const int dst_local_size = dst.end() - dst.begin(); - AssertDimension (dst_local_size, matrix->RangeMap().NumMyElements()); - const int src_local_size = src.end() - src.begin(); - AssertDimension (src_local_size, matrix->DomainMap().NumMyElements()); + const size_type dst_local_size = dst.end() - dst.begin(); + AssertDimension (dst_local_size, static_cast<size_type>(matrix->RangeMap().NumMyElements())); + (void)dst_local_size; + const size_type src_local_size = src.end() - src.begin(); + AssertDimension (src_local_size, static_cast<size_type>(matrix->DomainMap().NumMyElements())); + (void)src_local_size; Epetra_MultiVector tril_dst (View, matrix->RangeMap(), dst.begin(), matrix->DomainMap().NumMyPoints(), 1); @@ -3660,7 +3713,7 @@ namespace TrilinosWrappers } - + template <typename VectorType> inline void @@ -3671,10 +3724,10 @@ namespace TrilinosWrappers Assert (matrix->Filled(), ExcMatrixNotCompressed()); internal::SparseMatrix::check_vector_map_equality(*matrix, dst, src); - const int dst_local_size = dst.end() - dst.begin(); - AssertDimension (dst_local_size, matrix->DomainMap().NumMyElements()); - const int src_local_size = src.end() - src.begin(); - AssertDimension (src_local_size, matrix->RangeMap().NumMyElements()); + const size_type dst_local_size = dst.end() - dst.begin(); + AssertDimension (dst_local_size, static_cast<size_type>(matrix->DomainMap().NumMyElements())); + const size_type src_local_size = src.end() - src.begin(); + AssertDimension (src_local_size, static_cast<size_type>(matrix->RangeMap().NumMyElements())); Epetra_MultiVector tril_dst (View, matrix->DomainMap(), dst.begin(), matrix->DomainMap().NumMyPoints(), 1); 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 0fc9641727..bd0d7c70ea 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 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 @@ -70,30 +75,35 @@ namespace TrilinosWrappers class Accessor { public: + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * Constructor. */ Accessor (const SparsityPattern *sparsity_pattern, - const unsigned int row, - const unsigned int index); + const size_type row, + const size_type index); /** * Row number of the element * represented by this object. */ - unsigned int row() const; + size_type row() const; /** * Index in row of the element * represented by this object. */ - unsigned int index() const; + size_type index() const; /** * Column number of the element * represented by this object. */ - unsigned int column() const; + size_type column() const; /** * Exception @@ -104,7 +114,7 @@ namespace TrilinosWrappers * Exception */ DeclException3 (ExcAccessToNonlocalRow, - int, int, int, + size_type, size_type, size_type, << "You tried to access row " << arg1 << " of a distributed sparsity pattern, " << " but only rows " << arg2 << " through " << arg3 @@ -119,12 +129,12 @@ namespace TrilinosWrappers /** * Current row number. */ - unsigned int a_row; + size_type a_row; /** * Current index in row. */ - unsigned int a_index; + size_type a_index; /** * Cache where we store the @@ -151,7 +161,7 @@ namespace TrilinosWrappers * than one accessor can access * this data if necessary. */ - std_cxx1x::shared_ptr<const std::vector<unsigned int> > colnum_cache; + std_cxx1x::shared_ptr<const std::vector<size_type> > colnum_cache; /** * Discard the old row caches @@ -178,6 +188,10 @@ namespace TrilinosWrappers class Iterator { public: + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; /** * Constructor. Create an @@ -186,8 +200,8 @@ namespace TrilinosWrappers * the index within it. */ Iterator (const SparsityPattern *sparsity_pattern, - const unsigned int row, - const unsigned int index); + const size_type row, + const size_type index); /** * Prefix increment. @@ -235,7 +249,7 @@ namespace TrilinosWrappers * Exception */ DeclException2 (ExcInvalidIndexWithinRow, - int, int, + size_type, size_type, << "Attempt to access element " << arg2 << " of row " << arg1 << " which doesn't have that many elements."); @@ -277,6 +291,11 @@ namespace TrilinosWrappers { public: + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * Declare a typedef for the * iterator class. @@ -321,9 +340,9 @@ namespace TrilinosWrappers * will reduce the setup time of the * sparsity pattern. */ - SparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int n_entries_per_row = 0); + SparsityPattern (const size_type m, + const size_type n, + const size_type n_entries_per_row = 0); /** * Generate a sparsity pattern that is @@ -338,9 +357,9 @@ namespace TrilinosWrappers * each row (an information usually * not available, though). */ - SparsityPattern (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &n_entries_per_row); + SparsityPattern (const size_type m, + const size_type n, + const std::vector<size_type> &n_entries_per_row); /** * Copy constructor. Sets the calling @@ -376,9 +395,9 @@ namespace TrilinosWrappers * pattern. */ void - reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_entries_per_row = 0); + reinit (const size_type m, + const size_type n, + const size_type n_entries_per_row = 0); /** * Initialize a sparsity pattern that @@ -393,9 +412,9 @@ namespace TrilinosWrappers * each row. */ void - reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &n_entries_per_row); + reinit (const size_type m, + const size_type n, + const std::vector<size_type> &n_entries_per_row); /** * Copy function. Sets the calling @@ -488,8 +507,8 @@ namespace TrilinosWrappers * increases the performance when * creating the sparsity pattern. */ - SparsityPattern (const Epetra_Map &parallel_partitioning, - const unsigned int n_entries_per_row = 0); + SparsityPattern (const Epetra_Map &parallel_partitioning, + const size_type n_entries_per_row = 0); /** * Same as before, but now use the @@ -510,8 +529,8 @@ namespace TrilinosWrappers * sparsity pattern is designed to * describe. */ - SparsityPattern (const Epetra_Map &parallel_partitioning, - const std::vector<unsigned int> &n_entries_per_row); + SparsityPattern (const Epetra_Map &parallel_partitioning, + const std::vector<size_type> &n_entries_per_row); /** * This constructor is similar to the @@ -543,7 +562,7 @@ namespace TrilinosWrappers */ SparsityPattern (const Epetra_Map &row_parallel_partitioning, const Epetra_Map &col_parallel_partitioning, - const unsigned int n_entries_per_row = 0); + const size_type n_entries_per_row = 0); /** * This constructor is similar to the @@ -565,9 +584,9 @@ namespace TrilinosWrappers * the number of entries in each row of * the newly generated matrix. */ - SparsityPattern (const Epetra_Map &row_parallel_partitioning, - const Epetra_Map &col_parallel_partitioning, - const std::vector<unsigned int> &n_entries_per_row); + SparsityPattern (const Epetra_Map &row_parallel_partitioning, + const Epetra_Map &col_parallel_partitioning, + const std::vector<size_type> &n_entries_per_row); /** * Reinitialization function for @@ -595,8 +614,8 @@ namespace TrilinosWrappers * add() function. */ void - reinit (const Epetra_Map &parallel_partitioning, - const unsigned int n_entries_per_row = 0); + reinit (const Epetra_Map &parallel_partitioning, + const size_type n_entries_per_row = 0); /** * Same as before, but now use the @@ -617,8 +636,8 @@ namespace TrilinosWrappers * designed to describe. */ void - reinit (const Epetra_Map &parallel_partitioning, - const std::vector<unsigned int> &n_entries_per_row); + reinit (const Epetra_Map &parallel_partitioning, + const std::vector<size_type> &n_entries_per_row); /** * This reinit function is similar to @@ -651,7 +670,7 @@ namespace TrilinosWrappers void reinit (const Epetra_Map &row_parallel_partitioning, const Epetra_Map &col_parallel_partitioning, - const unsigned int n_entries_per_row = 0); + const size_type n_entries_per_row = 0); /** * This reinit function is similar to @@ -677,9 +696,9 @@ namespace TrilinosWrappers * matrix. */ void - reinit (const Epetra_Map &row_parallel_partitioning, - const Epetra_Map &col_parallel_partitioning, - const std::vector<unsigned int> &n_entries_per_row); + reinit (const Epetra_Map &row_parallel_partitioning, + const Epetra_Map &col_parallel_partitioning, + const std::vector<size_type> &n_entries_per_row); /** * Reinit function. Takes one of the @@ -750,9 +769,9 @@ namespace TrilinosWrappers * increases the performance when * creating the sparsity pattern. */ - SparsityPattern (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD, - const unsigned int n_entries_per_row = 0); + SparsityPattern (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD, + const size_type n_entries_per_row = 0); /** * Same as before, but now use the @@ -775,7 +794,7 @@ namespace TrilinosWrappers */ SparsityPattern (const IndexSet &parallel_partitioning, const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row); + const std::vector<size_type> &n_entries_per_row); /** * This constructor is similar to the @@ -800,10 +819,10 @@ namespace TrilinosWrappers * row is specified as the maximum * number of entries argument. */ - SparsityPattern (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD, - const unsigned int n_entries_per_row = 0); + SparsityPattern (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD, + const size_type n_entries_per_row = 0); /** * This constructor is similar to the @@ -825,10 +844,10 @@ namespace TrilinosWrappers * the number of entries in each row of * the newly generated matrix. */ - SparsityPattern (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row); + SparsityPattern (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator, + const std::vector<size_type> &n_entries_per_row); /** * Reinitialization function for @@ -857,9 +876,9 @@ namespace TrilinosWrappers * add() function. */ void - reinit (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD, - const unsigned int n_entries_per_row = 0); + reinit (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD, + const size_type n_entries_per_row = 0); /** * Same as before, but now use the @@ -880,9 +899,9 @@ namespace TrilinosWrappers * designed to describe. */ void - reinit (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row); + reinit (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator, + const std::vector<size_type> &n_entries_per_row); /** * This reinit function is similar to @@ -914,10 +933,10 @@ namespace TrilinosWrappers * <tt>n_entries_per_row</tt>. */ void - reinit (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD, - const unsigned int n_entries_per_row = 0); + reinit (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD, + const size_type n_entries_per_row = 0); /** * Same as before, but now using a @@ -927,10 +946,10 @@ namespace TrilinosWrappers * sparsity pattern. */ void - reinit (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row); + reinit (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator, + const std::vector<size_type> &n_entries_per_row); /** * Reinit function. Takes one of the @@ -1003,13 +1022,13 @@ namespace TrilinosWrappers * Return the number of rows in this * sparsity pattern. */ - unsigned int n_rows () const; + size_type n_rows () const; /** * Return the number of columns in * this sparsity pattern. */ - unsigned int n_cols () const; + size_type n_cols () const; /** * Return the local dimension of the @@ -1040,7 +1059,7 @@ namespace TrilinosWrappers * it will be a pair (i,i+n), where * <tt>n=local_size()</tt>. */ - std::pair<unsigned int, unsigned int> + std::pair<size_type, size_type> local_range () const; /** @@ -1048,19 +1067,19 @@ namespace TrilinosWrappers * in the local range or not, * see also local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return the number of nonzero * elements of this sparsity pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Number of entries in a * specific row. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Compute the bandwidth of the @@ -1073,7 +1092,7 @@ namespace TrilinosWrappers * bandwidth a $n\times m$ matrix can * have is $\max\{n-1,m-1\}$. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return whether the object is @@ -1089,8 +1108,8 @@ namespace TrilinosWrappers * sparsity pattern (i.e., it may be * non-zero) or not. */ - bool exists (const unsigned int i, - const unsigned int j) const; + bool exists (const size_type i, + const size_type j) const; /** * Determine an estimate for the @@ -1109,8 +1128,8 @@ namespace TrilinosWrappers * Add the element (<i>i,j</i>) to * the sparsity pattern. */ - void add (const unsigned int i, - const unsigned int j); + void add (const size_type i, + const size_type j); /** @@ -1118,10 +1137,10 @@ namespace TrilinosWrappers * the sparsity pattern. */ template <typename ForwardIterator> - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted = false); //@} /** * @name Access of underlying Trilinos data @@ -1216,7 +1235,7 @@ namespace TrilinosWrappers * that the iterator may not be * dereferencable in that case. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row @@ -1233,7 +1252,7 @@ namespace TrilinosWrappers * the end iterator for the * last row of a matrix. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; //@} /** @@ -1309,7 +1328,7 @@ namespace TrilinosWrappers * Exception */ DeclException2 (ExcInvalidIndex, - int, int, + size_type, size_type, << "The entry with index <" << arg1 << ',' << arg2 << "> does not exist."); @@ -1322,7 +1341,7 @@ namespace TrilinosWrappers * Exception */ DeclException4 (ExcAccessToNonLocalElement, - int, int, int, int, + size_type, size_type, size_type, size_type, << "You tried to access element (" << arg1 << "/" << arg2 << ")" << " of a distributed matrix, but only rows " @@ -1333,7 +1352,7 @@ namespace TrilinosWrappers * Exception */ DeclException2 (ExcAccessToNonPresentElement, - int, int, + size_type, size_type, << "You tried to access element (" << arg1 << "/" << arg2 << ")" << " of a sparse matrix, but it appears to not" @@ -1382,8 +1401,8 @@ namespace TrilinosWrappers inline Accessor::Accessor (const SparsityPattern *sp, - const unsigned int row, - const unsigned int index) + const size_type row, + const size_type index) : sparsity_pattern(const_cast<SparsityPattern *>(sp)), a_row(row), @@ -1394,7 +1413,7 @@ namespace TrilinosWrappers inline - unsigned int + Accessor::size_type Accessor::row() const { Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern()); @@ -1404,7 +1423,7 @@ namespace TrilinosWrappers inline - unsigned int + Accessor::size_type Accessor::column() const { Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern()); @@ -1414,7 +1433,7 @@ namespace TrilinosWrappers inline - unsigned int + Accessor::size_type Accessor::index() const { Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern()); @@ -1425,8 +1444,8 @@ namespace TrilinosWrappers inline Iterator::Iterator(const SparsityPattern *sp, - const unsigned int row, - const unsigned int index) + const size_type row, + const size_type index) : accessor(sp, row, index) {} @@ -1544,9 +1563,9 @@ namespace TrilinosWrappers inline SparsityPattern::const_iterator - SparsityPattern::begin(const unsigned int r) const + SparsityPattern::begin(const size_type r) const { - Assert (r < n_rows(), ExcIndexRange(r, 0, n_rows())); + Assert (r < n_rows(), ExcIndexRangeType<size_type>(r, 0, n_rows())); if (row_length(r) > 0) return const_iterator(this, r, 0); else @@ -1557,14 +1576,14 @@ namespace TrilinosWrappers inline SparsityPattern::const_iterator - SparsityPattern::end(const unsigned int r) const + SparsityPattern::end(const size_type r) const { - Assert (r < n_rows(), ExcIndexRange(r, 0, n_rows())); + Assert (r < n_rows(), ExcIndexRangeType<size_type>(r, 0, n_rows())); // place the iterator on the first entry // past this line, or at the end of the // matrix - for (unsigned int i=r+1; i<n_rows(); ++i) + for (size_type i=r+1; i<n_rows(); ++i) if (row_length(i) > 0) return const_iterator(this, i, 0); @@ -1577,14 +1596,19 @@ namespace TrilinosWrappers inline bool - SparsityPattern::in_local_range (const unsigned int index) const + SparsityPattern::in_local_range (const size_type index) const { - int begin, end; + TrilinosWrappers::types::int_type begin, end; +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE begin = graph->RowMap().MinMyGID(); end = graph->RowMap().MaxMyGID()+1; +#else + begin = graph->RowMap().MinMyGID64(); + end = graph->RowMap().MaxMyGID64()+1; +#endif - return ((index >= static_cast<unsigned int>(begin)) && - (index < static_cast<unsigned int>(end))); + return ((index >= static_cast<size_type>(begin)) && + (index < static_cast<size_type>(end))); } @@ -1609,8 +1633,8 @@ namespace TrilinosWrappers inline void - SparsityPattern::add (const unsigned int i, - const unsigned int j) + SparsityPattern::add (const size_type i, + const size_type j) { add_entries (i, &j, &j+1); } @@ -1620,19 +1644,33 @@ namespace TrilinosWrappers template <typename ForwardIterator> inline void - SparsityPattern::add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool /*indices_are_sorted*/) + SparsityPattern::add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool /*indices_are_sorted*/) { if (begin == end) return; - int *col_index_ptr = (int *)(&*begin); + // verify that the size of the data type Trilinos expects matches that the + // iterator points to. we allow for some slippage between signed and + // unsigned and only compare that they are both eiter 32 or 64 bit. to + // write this test properly, not that we cannot compare the size of + // '*begin' because 'begin' may be an iterator and '*begin' may be an + // accessor class. consequently, we need to somehow get an actual value + // 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()); + + TrilinosWrappers::types::int_type *col_index_ptr = + (TrilinosWrappers::types::int_type *)(&*begin); const int n_cols = static_cast<int>(end - begin); compressed = false; - const int ierr = graph->InsertGlobalIndices (1, (int *)&row, + const int ierr = graph->InsertGlobalIndices (1, + (TrilinosWrappers::types::int_type *)&row, n_cols, col_index_ptr); AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); @@ -1695,9 +1733,9 @@ namespace TrilinosWrappers inline - SparsityPattern::SparsityPattern (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator, - const unsigned int n_entries_per_row) + SparsityPattern::SparsityPattern (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator, + const size_type n_entries_per_row) : compressed (false) { @@ -1711,7 +1749,7 @@ namespace TrilinosWrappers inline SparsityPattern::SparsityPattern (const IndexSet &parallel_partitioning, const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) : compressed (false) { @@ -1723,10 +1761,10 @@ namespace TrilinosWrappers inline - SparsityPattern::SparsityPattern (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator, - const unsigned int n_entries_per_row) + SparsityPattern::SparsityPattern (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator, + const size_type n_entries_per_row) : compressed (false) { @@ -1744,7 +1782,7 @@ namespace TrilinosWrappers SparsityPattern (const IndexSet &row_parallel_partitioning, const IndexSet &col_parallel_partitioning, const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) : compressed (false) { @@ -1759,9 +1797,9 @@ namespace TrilinosWrappers inline void - SparsityPattern::reinit (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator, - const unsigned int n_entries_per_row) + SparsityPattern::reinit (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator, + const size_type n_entries_per_row) { Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator, false); @@ -1773,7 +1811,7 @@ namespace TrilinosWrappers inline void SparsityPattern::reinit (const IndexSet &parallel_partitioning, const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) { Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator, false); @@ -1783,10 +1821,10 @@ namespace TrilinosWrappers inline - void SparsityPattern::reinit (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator, - const unsigned int n_entries_per_row) + void SparsityPattern::reinit (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator, + const size_type n_entries_per_row) { Epetra_Map row_map = row_parallel_partitioning.make_trilinos_map (communicator, false); @@ -1801,7 +1839,7 @@ namespace TrilinosWrappers SparsityPattern::reinit (const IndexSet &row_parallel_partitioning, const IndexSet &col_parallel_partitioning, const MPI_Comm &communicator, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) { Epetra_Map row_map = row_parallel_partitioning.make_trilinos_map (communicator, false); diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index 79bafae4fa..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 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 @@ -41,6 +46,28 @@ template <typename> class Vector; namespace TrilinosWrappers { class SparseMatrix; + + 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 + // 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 + // function necessary. + long long int gid(const Epetra_BlockMap &map, int i) + { + return map.GID64(i); + } +#endif + } + /** * Namespace for Trilinos vector classes that work in parallel over * MPI. This namespace is restricted to vectors only, whereas matrices @@ -127,12 +154,12 @@ namespace TrilinosWrappers * @code * TrilinosWrappers::Vector vector; * // do some write operations on the vector - * for (unsigned int i=0; i<vector->size(); ++i) + * for (size_type i=0; i<vector->size(); ++i) * vector(i) = i; * * // do some additions to vector elements, but * // only for some elements - * for (unsigned int i=0; i<vector->size(); ++i) + * for (size_type i=0; i<vector->size(); ++i) * if (some_condition(i) == true) * vector(i) += 1; * @@ -166,6 +193,11 @@ namespace TrilinosWrappers class Vector : public VectorBase { public: + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * A variable that indicates whether this vector * supports distributed data storage. If true, then @@ -248,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 @@ -367,7 +409,7 @@ namespace TrilinosWrappers * this is all we need to * generate a parallel vector. */ - Vector (const Epetra_Map &parallel_partitioning); + explicit Vector (const Epetra_Map &parallel_partitioning); /** * Copy constructor from the @@ -380,8 +422,8 @@ namespace TrilinosWrappers * that sets the partitioning * details. */ - explicit Vector (const Epetra_Map &parallel_partitioning, - const VectorBase &v); + Vector (const Epetra_Map &parallel_partitioning, + const VectorBase &v); /** * Reinitialize from a deal.II @@ -409,8 +451,8 @@ namespace TrilinosWrappers * elements. */ template <typename Number> - explicit Vector (const Epetra_Map &parallel_partitioning, - const dealii::Vector<Number> &v); + Vector (const Epetra_Map &parallel_partitioning, + const dealii::Vector<Number> &v); //@} /** * @name Initialization with an IndexSet @@ -426,7 +468,14 @@ namespace TrilinosWrappers * need to generate a %parallel * vector. */ - Vector (const IndexSet &parallel_partitioning, + explicit Vector (const IndexSet &parallel_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); /** @@ -440,9 +489,9 @@ namespace TrilinosWrappers * communicator that set the * partitioning details. */ - explicit Vector (const IndexSet &parallel_partitioning, - const VectorBase &v, - const MPI_Comm &communicator = MPI_COMM_WORLD); + Vector (const IndexSet &parallel_partitioning, + const VectorBase &v, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Copy-constructor from deal.II @@ -451,9 +500,9 @@ namespace TrilinosWrappers * copies all the elements. */ template <typename Number> - explicit Vector (const IndexSet &parallel_partitioning, - const dealii::Vector<Number> &v, - const MPI_Comm &communicator = MPI_COMM_WORLD); + Vector (const IndexSet &parallel_partitioning, + const dealii::Vector<Number> &v, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Reinit functionality. This function @@ -529,7 +578,7 @@ namespace TrilinosWrappers // deal.II might not use doubles, so // that a direct access is not possible. for (int i=0; i<size; ++i) - (*vector)[0][i] = v(parallel_partitioner.GID(i)); + (*vector)[0][i] = v(gid(parallel_partitioner,i)); } @@ -550,7 +599,7 @@ namespace TrilinosWrappers if (size() != v.size()) { vector.reset (new Epetra_FEVector(Epetra_Map - (static_cast<int>(v.size()), 0, + (static_cast<TrilinosWrappers::types::int_type>(v.size()), 0, #ifdef DEAL_II_WITH_MPI Epetra_MpiComm(MPI_COMM_SELF) #else @@ -584,6 +633,11 @@ namespace TrilinosWrappers class Vector : public VectorBase { public: + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * A variable that indicates whether this vector * supports distributed data storage. If true, then @@ -614,7 +668,7 @@ namespace TrilinosWrappers * input the number of elements * in the vector. */ - Vector (const unsigned int n); + explicit Vector (const size_type n); /** * This constructor takes as @@ -628,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 @@ -641,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 @@ -667,8 +721,8 @@ namespace TrilinosWrappers * the vector to the size * specified by <tt>n</tt>. */ - void reinit (const unsigned int n, - const bool fast = false); + void reinit (const size_type n, + const bool fast = false); /** * Initialization with an @@ -799,7 +853,7 @@ namespace TrilinosWrappers template <typename number> Vector::Vector (const dealii::Vector<number> &v) { - Epetra_LocalMap map ((int)v.size(), 0, Utilities::Trilinos::comm_self()); + Epetra_LocalMap map ((TrilinosWrappers::types::int_type)v.size(), 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector(map)); *this = v; } @@ -825,13 +879,13 @@ namespace TrilinosWrappers { vector.reset(); - Epetra_LocalMap map ((int)v.size(), 0, + Epetra_LocalMap map ((TrilinosWrappers::types::int_type)v.size(), 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector(map)); } const Epetra_Map &map = vector_partitioner(); - const int size = map.NumMyElements(); + const TrilinosWrappers::types::int_type size = map.NumMyElements(); Assert (map.MaxLID() == size-1, ExcDimensionMismatch(map.MaxLID(), size-1)); @@ -839,7 +893,7 @@ namespace TrilinosWrappers // Need to copy out values, since the // deal.II might not use doubles, so // that a direct access is not possible. - for (int i=0; i<size; ++i) + for (TrilinosWrappers::types::int_type i=0; i<size; ++i) (*vector)[0][i] = v(i); return *this; 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 05d5f24117..674b6ca0d4 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 @@ -52,7 +57,6 @@ namespace TrilinosWrappers // forward declaration class VectorBase; - /** * @cond internal */ @@ -65,6 +69,11 @@ namespace TrilinosWrappers */ namespace internal { + /** + * Declare type for container size. + */ + typedef dealii::types::global_dof_index size_type; + /** * This class implements a * wrapper for accessing the @@ -90,10 +99,11 @@ namespace TrilinosWrappers * the actual vector class to * create it. */ - VectorReference (VectorBase &vector, - const unsigned int index); + VectorReference (VectorBase &vector, + const size_type index); public: + /** * This looks like a copy * operator, but does something @@ -187,7 +197,7 @@ namespace TrilinosWrappers * Exception */ DeclException3 (ExcAccessToNonLocalElement, - int, int, int, + size_type, size_type, size_type, << "You tried to access element " << arg1 << " of a distributed vector, but it is not stored on " << "the current processor. Note: the elements stored " @@ -208,7 +218,7 @@ namespace TrilinosWrappers * Index of the referenced element * of the vector. */ - const unsigned int index; + const size_type index; /** * Make the vector class a @@ -269,7 +279,7 @@ namespace TrilinosWrappers */ typedef TrilinosScalar value_type; typedef TrilinosScalar real_type; - typedef std::size_t size_type; + typedef dealii::types::global_dof_index size_type; typedef value_type *iterator; typedef const value_type *const_iterator; typedef internal::VectorReference reference; @@ -457,7 +467,7 @@ namespace TrilinosWrappers * Return the global dimension of * the vector. */ - unsigned int size () const; + size_type size () const; /** * Return the local dimension of @@ -477,7 +487,7 @@ namespace TrilinosWrappers * elements, they are included in * this number. */ - unsigned int local_size () const; + size_type local_size () const; /** * Return a pair of indices @@ -509,7 +519,7 @@ namespace TrilinosWrappers * trigger an assertion if the local portion of the vector * is not contiguous. */ - std::pair<unsigned int, unsigned int> local_range () const; + std::pair<size_type, size_type> local_range () const; /** * Return whether @p index is in @@ -519,7 +529,7 @@ namespace TrilinosWrappers * @note The same limitation for the applicability of this * function applies as listed in the documentation of local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return an index set that describes which elements of this vector @@ -635,7 +645,7 @@ namespace TrilinosWrappers * element, both read and write. */ reference - operator () (const unsigned int index); + operator () (const size_type index); /** * Provide read-only access to an @@ -643,7 +653,7 @@ namespace TrilinosWrappers * the <code>el()</code> command. */ TrilinosScalar - operator () (const unsigned int index) const; + operator () (const size_type index) const; /** * Provide access to a given @@ -652,7 +662,7 @@ namespace TrilinosWrappers * Exactly the same as operator(). */ reference - operator [] (const unsigned int index); + operator [] (const size_type index); /** * Provide read-only access to an @@ -662,7 +672,7 @@ namespace TrilinosWrappers * Exactly the same as operator(). */ TrilinosScalar - operator [] (const unsigned int index) const; + operator [] (const size_type index) const; /** * Return the value of the vector @@ -675,12 +685,12 @@ namespace TrilinosWrappers * elements sits on another * process. */ - TrilinosScalar el (const unsigned int index) const; + TrilinosScalar el (const size_type index) const; /** * Make the Vector class a bit like the <tt>vector<></tt> 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(). */ @@ -715,7 +725,7 @@ namespace TrilinosWrappers * argument, the corresponding * values in the second. */ - void set (const std::vector<unsigned int> &indices, + void set (const std::vector<size_type> &indices, const std::vector<TrilinosScalar> &values); /** @@ -725,7 +735,7 @@ namespace TrilinosWrappers * takes a deal.II vector of * values. */ - void set (const std::vector<unsigned int> &indices, + void set (const std::vector<size_type> &indices, const ::dealii::Vector<TrilinosScalar> &values); //@} @@ -745,8 +755,8 @@ namespace TrilinosWrappers * the number of elements to be * set. */ - void set (const unsigned int n_elements, - const unsigned int *indices, + void set (const size_type n_elements, + const size_type *indices, const TrilinosScalar *values); /** @@ -757,7 +767,7 @@ namespace TrilinosWrappers * components specified by @p * indices. */ - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const std::vector<TrilinosScalar> &values); /** @@ -767,7 +777,7 @@ namespace TrilinosWrappers * takes a deal.II vector of * values. */ - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const ::dealii::Vector<TrilinosScalar> &values); /** @@ -779,8 +789,8 @@ namespace TrilinosWrappers * other two <tt>add()</tt> * functions above. */ - void add (const unsigned int n_elements, - const unsigned int *indices, + void add (const size_type n_elements, + const size_type *indices, const TrilinosScalar *values); /** @@ -1043,7 +1053,7 @@ namespace TrilinosWrappers * Exception */ DeclException3 (ExcAccessToNonlocalElement, - int, int, int, + size_type, size_type, size_type, << "You tried to access element " << arg1 << " of a distributed vector, but only entries " << arg2 << " through " << arg3 @@ -1134,8 +1144,8 @@ namespace TrilinosWrappers namespace internal { inline - VectorReference::VectorReference (VectorBase &vector, - const unsigned int index) + VectorReference::VectorReference (VectorBase &vector, + const size_type index) : vector (vector), index (index) @@ -1233,9 +1243,9 @@ namespace TrilinosWrappers inline bool - VectorBase::in_local_range (const unsigned int index) const + VectorBase::in_local_range (const size_type index) const { - const std::pair<unsigned int, unsigned int> range = local_range(); + std::pair<size_type, size_type> range = local_range(); return ((index >= range.first) && (index < range.second)); } @@ -1248,11 +1258,23 @@ namespace TrilinosWrappers { IndexSet is (size()); - // TODO: Trilinos does allow non-contiguous ranges for locally - // owned elements. if that is the case for the current - // vector, local_range() will throw an exception. Fix this. - const std::pair<unsigned int, unsigned int> x = local_range(); - is.add_range (x.first, x.second); + // easy case: local range is contiguous + if (vector->Map().LinearMap()) + { + const std::pair<size_type, size_type> x = local_range(); + is.add_range (x.first, x.second); + } + else if (vector->Map().NumMyElements() > 0) + { + const size_type n_indices = vector->Map().NumMyElements(); +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + unsigned int *vector_indices = (unsigned int *)vector->Map().MyGlobalElements(); +#else + size_type *vector_indices = (size_type *)vector->Map().MyGlobalElements64(); +#endif + is.add_indices(vector_indices, vector_indices+n_indices); + is.compress(); + } return is; } @@ -1270,7 +1292,7 @@ namespace TrilinosWrappers inline internal::VectorReference - VectorBase::operator () (const unsigned int index) + VectorBase::operator () (const size_type index) { return internal::VectorReference (*this, index); } @@ -1279,7 +1301,7 @@ namespace TrilinosWrappers inline internal::VectorReference - VectorBase::operator [] (const unsigned int index) + VectorBase::operator [] (const size_type index) { return operator() (index); } @@ -1287,7 +1309,7 @@ namespace TrilinosWrappers inline TrilinosScalar - VectorBase::operator [] (const unsigned int index) const + VectorBase::operator [] (const size_type index) const { return operator() (index); } @@ -1445,7 +1467,7 @@ namespace TrilinosWrappers inline void - VectorBase::set (const std::vector<unsigned int> &indices, + VectorBase::set (const std::vector<size_type> &indices, const std::vector<TrilinosScalar> &values) { // if we have ghost values, do not allow @@ -1462,7 +1484,7 @@ namespace TrilinosWrappers inline void - VectorBase::set (const std::vector<unsigned int> &indices, + VectorBase::set (const std::vector<size_type> &indices, const ::dealii::Vector<TrilinosScalar> &values) { // if we have ghost values, do not allow @@ -1479,8 +1501,8 @@ namespace TrilinosWrappers inline void - VectorBase::set (const unsigned int n_elements, - const unsigned int *indices, + VectorBase::set (const size_type n_elements, + const size_type *indices, const TrilinosScalar *values) { // if we have ghost values, do not allow @@ -1493,14 +1515,14 @@ namespace TrilinosWrappers if (last_action != Insert) last_action = Insert; - for (unsigned int i=0; i<n_elements; ++i) + for (size_type i=0; i<n_elements; ++i) { - const unsigned int row = indices[i]; - const int local_row = vector->Map().LID(static_cast<int>(row)); + const size_type row = indices[i]; + const TrilinosWrappers::types::int_type local_row = vector->Map().LID(static_cast<TrilinosWrappers::types::int_type>(row)); if (local_row == -1) { const int ierr = vector->ReplaceGlobalValues (1, - (const int *)(&row), + (const TrilinosWrappers::types::int_type *)(&row), &values[i]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); compressed = false; @@ -1514,7 +1536,7 @@ namespace TrilinosWrappers inline void - VectorBase::add (const std::vector<unsigned int> &indices, + VectorBase::add (const std::vector<size_type> &indices, const std::vector<TrilinosScalar> &values) { // if we have ghost values, do not allow @@ -1530,7 +1552,7 @@ namespace TrilinosWrappers inline void - VectorBase::add (const std::vector<unsigned int> &indices, + VectorBase::add (const std::vector<size_type> &indices, const ::dealii::Vector<TrilinosScalar> &values) { // if we have ghost values, do not allow @@ -1546,8 +1568,8 @@ namespace TrilinosWrappers inline void - VectorBase::add (const unsigned int n_elements, - const unsigned int *indices, + VectorBase::add (const size_type n_elements, + const size_type *indices, const TrilinosScalar *values) { // if we have ghost values, do not allow @@ -1561,14 +1583,14 @@ namespace TrilinosWrappers last_action = Add; } - for (unsigned int i=0; i<n_elements; ++i) + for (size_type i=0; i<n_elements; ++i) { - const unsigned int row = indices[i]; - const int local_row = vector->Map().LID(static_cast<int>(row)); + const size_type row = indices[i]; + const TrilinosWrappers::types::int_type local_row = vector->Map().LID(static_cast<TrilinosWrappers::types::int_type>(row)); if (local_row == -1) { const int ierr = vector->SumIntoGlobalValues (1, - (const int *)(&row), + (const TrilinosWrappers::types::int_type *)(&row), &values[i]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); compressed = false; @@ -1581,31 +1603,38 @@ namespace TrilinosWrappers inline - unsigned int + VectorBase::size_type VectorBase::size () const { - return (unsigned int) (vector->Map().MaxAllGID() + 1 - - vector->Map().MinAllGID()); +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + return (size_type) (vector->Map().MaxAllGID() + 1 - vector->Map().MinAllGID()); +#else + return (size_type) (vector->Map().MaxAllGID64() + 1 - vector->Map().MinAllGID64()); +#endif } inline - unsigned int + VectorBase::size_type VectorBase::local_size () const { - return (unsigned int) vector->Map().NumMyElements(); + return (size_type) vector->Map().NumMyElements(); } inline - std::pair<unsigned int, unsigned int> + std::pair<VectorBase::size_type, VectorBase::size_type> VectorBase::local_range () const { - int begin, end; - begin = vector->Map().MinMyGID(); - end = vector->Map().MaxMyGID()+1; +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + const TrilinosWrappers::types::int_type begin = vector->Map().MinMyGID(); + const TrilinosWrappers::types::int_type end = vector->Map().MaxMyGID()+1; +#else + const TrilinosWrappers::types::int_type begin = vector->Map().MinMyGID64(); + const TrilinosWrappers::types::int_type end = vector->Map().MaxMyGID64()+1; +#endif Assert (end-begin == vector->Map().NumMyElements(), ExcMessage ("This function only makes sense if the elements that this " @@ -1711,11 +1740,11 @@ namespace TrilinosWrappers TrilinosScalar norm = 0; TrilinosScalar sum=0; - const unsigned int n_local = local_size(); + const size_type n_local = local_size(); // loop over all the elements because // Trilinos does not support lp norms - for (unsigned int i=0; i<n_local; i++) + for (size_type i=0; i<n_local; i++) sum += std::pow(std::fabs((*vector)[0][i]), p); norm = std::pow(sum, static_cast<TrilinosScalar>(1./p)); @@ -1823,8 +1852,8 @@ namespace TrilinosWrappers Assert (!has_ghost_elements(), ExcGhostsPresent()); Assert (numbers::is_finite(s), ExcNumberNotFinite()); - unsigned int n_local = local_size(); - for (unsigned int i=0; i<n_local; i++) + size_type n_local = local_size(); + for (size_type i=0; i<n_local; i++) (*vector)[0][i] += s; } diff --git a/deal.II/include/deal.II/lac/vector.h b/deal.II/include/deal.II/lac/vector.h index 6c7fe3e9ce..6866873d44 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 @@ -118,7 +123,7 @@ public: typedef const value_type *const_iterator; typedef value_type &reference; typedef const value_type &const_reference; - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Declare a type that has holds @@ -286,7 +291,7 @@ public: * i.e. the vector is replaced by * one of length zero. */ - explicit Vector (const unsigned int n); + explicit Vector (const size_type n); /** * Initialize the vector with a @@ -313,7 +318,7 @@ public: * @p PETScWrappers::Vector class. * * For the PETSc vector wrapper class, - * thios function compresses the + * this function compresses the * underlying representation of the PETSc * object, i.e. flushes the buffers of * the vector object if it has any. This @@ -354,8 +359,8 @@ public: * classes to handle memory * separately. */ - virtual void reinit (const unsigned int N, - const bool fast=false); + virtual void reinit (const size_type N, + const bool fast=false); /** * Change the dimension to that of the @@ -599,7 +604,7 @@ public: * Since this is not a distributed * vector the method always returns true. */ - bool in_local_range (const types::global_dof_index global_index) const; + bool in_local_range (const size_type global_index) const; /** * Return an index set that describes which elements of this vector @@ -624,7 +629,7 @@ public: /** * Return dimension of the vector. */ - unsigned int size () const; + std::size_t size () const; /** * Return whether the vector contains only @@ -689,13 +694,13 @@ public: * Access the value of the @p ith * component. */ - Number operator() (const unsigned int i) const; + Number operator() (const size_type i) const; /** * Access the @p ith component * as a writeable reference. */ - Number &operator() (const unsigned int i); + Number &operator() (const size_type i); /** * Access the value of the @p ith @@ -703,7 +708,7 @@ public: * * Exactly the same as operator(). */ - Number operator[] (const unsigned int i) const; + Number operator[] (const size_type i) const; /** * Access the @p ith component @@ -711,7 +716,7 @@ public: * * Exactly the same as operator(). */ - Number &operator[] (const unsigned int i); + Number &operator[] (const size_type i); //@} @@ -741,7 +746,7 @@ public: * indices. */ template <typename OtherNumber> - void add (const std::vector<unsigned int> &indices, + void add (const std::vector<size_type> &indices, const std::vector<OtherNumber> &values); /** @@ -752,8 +757,8 @@ public: * values. */ template <typename OtherNumber> - void add (const std::vector<unsigned int> &indices, - const Vector<OtherNumber> &values); + void add (const std::vector<size_type> &indices, + const Vector<OtherNumber> &values); /** * Take an address where @@ -765,8 +770,8 @@ public: * functions above. */ template <typename OtherNumber> - void add (const unsigned int n_elements, - const unsigned int *indices, + void add (const size_type n_elements, + const size_type *indices, const OtherNumber *values); /** @@ -1059,7 +1064,7 @@ protected: * vector. Get this number by * calling <tt>size()</tt>. */ - unsigned int vec_size; + size_type vec_size; /** * Amount of memory actually @@ -1073,7 +1078,7 @@ protected: * memory when the number of * needed elements is reduced. */ - unsigned int max_vec_size; + size_type max_vec_size; /** * Pointer to the array of @@ -1137,7 +1142,7 @@ Vector<Number>::Vector (const InputIterator first, const InputIterator last) template <typename Number> inline -Vector<Number>::Vector (const unsigned int n) +Vector<Number>::Vector (const size_type n) : vec_size(0), max_vec_size(0), @@ -1163,7 +1168,7 @@ Vector<Number>::~Vector () template <typename Number> inline -void Vector<Number>::reinit (const unsigned int n, const bool fast) +void Vector<Number>::reinit (const size_type n, const bool fast) { if (n==0) { @@ -1225,7 +1230,7 @@ Vector<Number>::operator = (const Vector<Number2> &v) template <typename Number> inline -unsigned int Vector<Number>::size () const +std::size_t Vector<Number>::size () const { return vec_size; } @@ -1234,7 +1239,7 @@ unsigned int Vector<Number>::size () const template <typename Number> inline bool Vector<Number>::in_local_range -(const types::global_dof_index) const +(const size_type) const { return true; } @@ -1283,7 +1288,7 @@ Vector<Number>::end () const template <typename Number> inline -Number Vector<Number>::operator() (const unsigned int i) const +Number Vector<Number>::operator() (const size_type i) const { Assert (i<vec_size, ExcIndexRange(i,0,vec_size)); return val[i]; @@ -1293,9 +1298,9 @@ Number Vector<Number>::operator() (const unsigned int i) const template <typename Number> inline -Number &Vector<Number>::operator() (const unsigned int i) +Number &Vector<Number>::operator() (const size_type i) { - Assert (i<vec_size, ExcIndexRange(i,0,vec_size)); + Assert (i<vec_size, ExcIndexRangeType<size_type>(i,0,vec_size)); return val[i]; } @@ -1303,7 +1308,7 @@ Number &Vector<Number>::operator() (const unsigned int i) template <typename Number> inline -Number Vector<Number>::operator[] (const unsigned int i) const +Number Vector<Number>::operator[] (const size_type i) const { return operator()(i); } @@ -1312,7 +1317,7 @@ Number Vector<Number>::operator[] (const unsigned int i) const template <typename Number> inline -Number &Vector<Number>::operator[] (const unsigned int i) +Number &Vector<Number>::operator[] (const size_type i) { return operator()(i); } @@ -1337,7 +1342,7 @@ template <typename Number> template <typename OtherNumber> inline void -Vector<Number>::add (const std::vector<unsigned int> &indices, +Vector<Number>::add (const std::vector<size_type> &indices, const std::vector<OtherNumber> &values) { Assert (indices.size() == values.size(), @@ -1351,8 +1356,8 @@ template <typename Number> template <typename OtherNumber> inline void -Vector<Number>::add (const std::vector<unsigned int> &indices, - const Vector<OtherNumber> &values) +Vector<Number>::add (const std::vector<size_type> &indices, + const Vector<OtherNumber> &values) { Assert (indices.size() == values.size(), ExcDimensionMismatch(indices.size(), values.size())); @@ -1365,11 +1370,11 @@ template <typename Number> template <typename OtherNumber> inline void -Vector<Number>::add (const unsigned int n_indices, - const unsigned int *indices, +Vector<Number>::add (const size_type n_indices, + const size_type *indices, const OtherNumber *values) { - for (unsigned int i=0; i<n_indices; ++i) + for (size_type i=0; i<n_indices; ++i) { Assert (indices[i] < vec_size, ExcIndexRange(indices[i],0,vec_size)); Assert (numbers::is_finite(values[i]), diff --git a/deal.II/include/deal.II/lac/vector.templates.h b/deal.II/include/deal.II/lac/vector.templates.h index 5cb3ba459a..8aa37a6396 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 @@ -295,7 +300,7 @@ Vector<Number>::all_zero () const { Assert (vec_size!=0, ExcEmptyObject()); - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) if (val[i] != Number(0)) return false; return true; @@ -309,7 +314,7 @@ Vector<Number>::is_non_negative () const { Assert (vec_size!=0, ExcEmptyObject()); - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) if ( ! internal::is_non_negative (val[i])) return false; @@ -322,10 +327,12 @@ namespace internal { namespace Vector { + typedef types::global_dof_index size_type; + template<typename T> void set_subrange (const T s, - const unsigned int begin, - const unsigned int end, + const size_type begin, + const size_type end, dealii::Vector<T> &dst) { if (s == T()) @@ -335,8 +342,8 @@ namespace internal } template<typename T> - void copy_subrange (const unsigned int begin, - const unsigned int end, + void copy_subrange (const size_type begin, + const size_type end, const dealii::Vector<T> &src, dealii::Vector<T> &dst) { @@ -345,8 +352,8 @@ namespace internal } template<typename T, typename U> - void copy_subrange (const unsigned int begin, - const unsigned int end, + void copy_subrange (const size_type begin, + const size_type end, const dealii::Vector<T> &src, dealii::Vector<U> &dst) { @@ -358,8 +365,8 @@ namespace internal } template<typename T, typename U> - void copy_subrange_wrap (const unsigned int begin, - const unsigned int end, + void copy_subrange_wrap (const size_type begin, + const size_type end, const dealii::Vector<T> &src, dealii::Vector<U> &dst) { @@ -373,8 +380,8 @@ namespace internal if (PointerComparison::equal(&src, &dst)) return; - const unsigned int vec_size = src.size(); - const unsigned int dst_size = dst.size(); + const size_type vec_size = src.size(); + const 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) @@ -576,7 +583,7 @@ namespace internal const Number *X, const Number2 *Y, const ResultType power, - const unsigned int vec_size, + const size_type vec_size, ResultType &result) { if (vec_size <= 4096) @@ -586,24 +593,24 @@ namespace internal // order to obtain known loop bounds for most of the work. const Number *X_original = X; ResultType outer_results [128]; - unsigned int n_chunks = vec_size / 32; - const unsigned int remainder = vec_size % 32; + size_type n_chunks = vec_size / 32; + const size_type remainder = vec_size % 32; Assert (remainder == 0 || n_chunks < 128, ExcInternalError()); - for (unsigned int i=0; i<n_chunks; ++i) + for (size_type i=0; i<n_chunks; ++i) { ResultType r0 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r0 += op(X, Y, power); ResultType r1 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r1 += op(X, Y, power); r0 += r1; r1 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r1 += op(X, Y, power); ResultType r2 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r2 += op(X, Y, power); r1 += r2; r0 += r1; @@ -615,31 +622,31 @@ namespace internal // fall-through to work on these values. if (remainder > 0) { - const unsigned int inner_chunks = remainder / 8; + const size_type inner_chunks = remainder / 8; Assert (inner_chunks <= 3, ExcInternalError()); - const unsigned int remainder_inner = remainder % 8; + const size_type remainder_inner = remainder % 8; ResultType r0 = ResultType(), r1 = ResultType(), r2 = ResultType(); switch (inner_chunks) { case 3: r2 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r2 += op(X, Y, power); // no break case 2: r1 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r1 += op(X, Y, power); r1 += r2; // no break case 1: r2 = op(X, Y, power); - for (unsigned int j=1; j<8; ++j) + for (size_type j=1; j<8; ++j) r2 += op(X, Y, power); // no break default: - for (unsigned int j=0; j<remainder_inner; ++j) + for (size_type j=0; j<remainder_inner; ++j) r0 += op(X, Y, power); r0 += r2; r0 += r1; @@ -648,7 +655,7 @@ namespace internal } n_chunks++; } - AssertDimension(static_cast<unsigned int>(X - X_original), vec_size); + AssertDimension(static_cast<size_type> (X - X_original), vec_size); // now sum the results from the chunks // recursively @@ -656,7 +663,7 @@ namespace internal { if (n_chunks % 2 == 1) outer_results[n_chunks++] = ResultType(); - for (unsigned int i=0; i<n_chunks; i+=2) + for (size_type i=0; i<n_chunks; i+=2) outer_results[i/2] = outer_results[i] + outer_results[i+1]; n_chunks /= 2; } @@ -668,7 +675,7 @@ namespace internal // split the vector into smaller pieces to be // worked on recursively and create tasks for // them. Make pieces divisible by 1024. - const unsigned int new_size = (vec_size / 4096) * 1024; + const size_type new_size = (vec_size / 4096) * 1024; ResultType r0, r1, r2, r3; Threads::TaskGroup<> task_group; task_group += Threads::new_task(&accumulate<Operation,Number,Number2, @@ -697,7 +704,7 @@ namespace internal // split vector into four pieces and work on // the pieces recursively. Make pieces (except last) // divisible by 1024. - const unsigned int new_size = (vec_size / 4096) * 1024; + const size_type new_size = (vec_size / 4096) * 1024; ResultType r0, r1, r2, r3; accumulate (op, X, Y, power, new_size, r0); accumulate (op, X+new_size, Y+new_size, power, new_size, r1); @@ -800,7 +807,7 @@ Vector<Number>::l2_norm () const { real_type scale = 0.; real_type sum = 1.; - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) { if (val[i] != Number()) { @@ -843,7 +850,7 @@ Vector<Number>::lp_norm (const real_type p) const { real_type scale = 0.; real_type sum = 1.; - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) { if (val[i] != Number()) { @@ -872,7 +879,7 @@ Vector<Number>::linfty_norm () const real_type max = 0.; - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) max = std::max (numbers::NumberTraits<Number>::abs(val[i]), max); return max; @@ -903,7 +910,7 @@ Vector<Number> &Vector<Number>::operator -= (const Vector<Number> &v) (boost::lambda::_1 - boost::lambda::_2), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] -= v.val[i]; return *this; @@ -922,7 +929,7 @@ void Vector<Number>::add (const Number v) (boost::lambda::_1 + v), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] += v; } @@ -941,7 +948,7 @@ void Vector<Number>::add (const Vector<Number> &v) (boost::lambda::_1 + boost::lambda::_2), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] += v.val[i]; } @@ -966,7 +973,7 @@ void Vector<Number>::add (const Number a, const Vector<Number> &v, (boost::lambda::_1 + a*boost::lambda::_2 + b*boost::lambda::_3), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] += a * v.val[i] + b * w.val[i]; } @@ -988,7 +995,7 @@ void Vector<Number>::sadd (const Number x, (x*boost::lambda::_1 + boost::lambda::_2), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = x * val[i] + v.val[i]; } @@ -1016,7 +1023,7 @@ void Vector<Number>::sadd (const Number x, const Number a, (x*boost::lambda::_1 + a*boost::lambda::_2 + b*boost::lambda::_3), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = x*val[i] + a * v.val[i] + b * w.val[i]; } @@ -1047,7 +1054,7 @@ void Vector<Number>::scale (const Vector<Number> &s) (boost::lambda::_1*boost::lambda::_2), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] *= s.val[i]; } @@ -1060,7 +1067,7 @@ void Vector<Number>::scale (const Vector<Number2> &s) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size)); - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] *= s.val[i]; } @@ -1082,7 +1089,7 @@ void Vector<Number>::equ (const Number a, (a*boost::lambda::_1), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = a * u.val[i]; } @@ -1104,7 +1111,7 @@ void Vector<Number>::equ (const Number a, // because // operator*(complex<float>,complex<double>) // is not defined by default - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = a * Number(u.val[i]); } @@ -1129,7 +1136,7 @@ void Vector<Number>::equ (const Number a, const Vector<Number> &u, (a*boost::lambda::_1 + b*boost::lambda::_2), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = a * u.val[i] + b * v.val[i]; } @@ -1153,7 +1160,7 @@ void Vector<Number>::equ (const Number a, const Vector<Number> &u, (a*boost::lambda::_1 + b*boost::lambda::_2 + c*boost::lambda::_3), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = a * u.val[i] + b * v.val[i] + c * w.val[i]; } @@ -1178,7 +1185,7 @@ void Vector<Number>::ratio (const Vector<Number> &a, (boost::lambda::_1 / boost::lambda::_2), internal::Vector::minimum_parallel_grain_size); else if (vec_size > 0) - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) val[i] = a.val[i]/b.val[i]; } @@ -1191,9 +1198,9 @@ Vector<Number>::operator = (const BlockVector<Number> &v) if (v.size() != vec_size) reinit (v.size(), true); - unsigned int this_index = 0; - for (unsigned int b=0; b<v.n_blocks(); ++b) - for (unsigned int i=0; i<v.block(b).size(); ++i, ++this_index) + size_type this_index = 0; + for (size_type b=0; b<v.n_blocks(); ++b) + for (size_type i=0; i<v.block(b).size(); ++i, ++this_index) val[this_index] = v.block(b)(i); return *this; @@ -1299,7 +1306,7 @@ Vector<Number>::operator == (const Vector<Number2> &v) const // because // operator==(complex<float>,complex<double>) // is not defined by default - for (unsigned int i=0; i<vec_size; ++i) + for (size_type i=0; i<vec_size; ++i) if (val[i] != Number(v.val[i])) return false; @@ -1313,7 +1320,7 @@ void Vector<Number>::print (const char *format) const { Assert (vec_size!=0, ExcEmptyObject()); - for (unsigned int j=0; j<size(); ++j) + for (size_type j=0; j<size(); ++j) internal::print (val[j], format); std::printf ("\n"); } @@ -1339,10 +1346,10 @@ void Vector<Number>::print (std::ostream &out, out.setf (std::ios::fixed, std::ios::floatfield); if (across) - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << val[i] << ' '; else - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << val[i] << std::endl; out << std::endl; @@ -1361,10 +1368,10 @@ Vector<Number>::print (LogStream &out, const unsigned int width, const bool acro Assert (vec_size!=0, ExcEmptyObject()); if (across) - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << std::setw(width) << val[i] << ' '; else - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << val[i] << std::endl; out << std::endl; } @@ -1381,10 +1388,14 @@ void Vector<Number>::block_write (std::ostream &out) const // some resources that lead to // problems in a multithreaded // environment - const unsigned int sz = size(); + const size_type sz = size(); char buf[16]; - std::sprintf(buf, "%d", sz); +#ifdef DEAL_II_USE_LARGE_INDEX_TYPE + std::sprintf(buf, "%llu", sz); +#else + std::sprintf(buf, "%u", sz); +#endif std::strcat(buf, "\n["); out.write(buf, std::strlen(buf)); @@ -1406,7 +1417,7 @@ void Vector<Number>::block_read (std::istream &in) { AssertThrow (in, ExcIO()); - unsigned int sz; + size_type sz; char buf[16]; diff --git a/deal.II/include/deal.II/lac/vector_memory.h b/deal.II/include/deal.II/lac/vector_memory.h index a5f35ac422..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 @@ -253,13 +258,18 @@ template<class VECTOR = dealii::Vector<double> > class GrowingVectorMemory : public VectorMemory<VECTOR> { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. The argument * allows to preallocate a * certain number of vectors. The * default is not to do this. */ - GrowingVectorMemory (const unsigned int initial_size = 0, + GrowingVectorMemory (const size_type initial_size = 0, const bool log_statistics = false); /** @@ -356,7 +366,7 @@ private: * nothing after first * initialization */ - void initialize(const unsigned int size); + void initialize(const size_type size); /** * Pointer to the storage * object @@ -376,13 +386,13 @@ private: * output at the end of an * object's lifetime. */ - unsigned int total_alloc; + size_type total_alloc; /** * Number of vectors currently * allocated in this object; used * for detecting memory leaks. */ - unsigned int current_alloc; + size_type current_alloc; /** * A flag controlling the logging diff --git a/deal.II/include/deal.II/lac/vector_view.h b/deal.II/include/deal.II/lac/vector_view.h index 7c875227cd..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 @@ -132,6 +137,12 @@ template<typename Number> class VectorView : public Vector<Number> { public: + + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Read write constructor. Takes the size * of the vector, just like the standard @@ -139,7 +150,7 @@ public: * from the location of the pointer @p * ptr. */ - VectorView(const unsigned int new_size, Number *ptr); + VectorView(const size_type new_size, Number *ptr); /** * The constant constructor is the same @@ -154,7 +165,7 @@ public: * construct it as a non const object or * attempt to write on it. */ - VectorView(const unsigned int new_size, const Number *ptr); + VectorView(const size_type new_size, const Number *ptr); /** * This desctructor will only reset the @@ -211,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. @@ -221,7 +232,7 @@ public: * call this reinit function if you * really know what you are doing. */ - virtual void reinit (const unsigned int N, + virtual void reinit (const size_type N, const bool fast=false); /** This reinit function is @@ -229,7 +240,7 @@ public: new object with the given size, starting from the pointer ptr. */ - void reinit(const unsigned int N, Number *ptr); + void reinit(const size_type N, Number *ptr); /** This reinit function is equivalent to constructing a @@ -238,7 +249,7 @@ public: pointer ptr. The same considerations made for the constructor apply here. */ - void reinit(const unsigned int N, const Number *ptr); + void reinit(const size_type N, const Number *ptr); /** * This function is here to prevent @@ -257,7 +268,7 @@ public: template<typename Number> inline -VectorView<Number>::VectorView(const unsigned int new_size, Number *ptr) +VectorView<Number>::VectorView(const size_type new_size, Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; @@ -268,7 +279,7 @@ VectorView<Number>::VectorView(const unsigned int new_size, Number *ptr) template<typename Number> inline -VectorView<Number>::VectorView(const unsigned int new_size, const Number *ptr) +VectorView<Number>::VectorView(const size_type new_size, const Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; @@ -291,7 +302,7 @@ VectorView<Number>::~VectorView() template<typename Number> inline -void VectorView<Number>::reinit(const unsigned int N, const bool fast) +void VectorView<Number>::reinit(const size_type N, const bool fast) { this->vec_size = N; this->max_vec_size = N; @@ -302,7 +313,7 @@ void VectorView<Number>::reinit(const unsigned int N, const bool fast) template<typename Number> inline -void VectorView<Number>::reinit(const unsigned int new_size, Number *ptr) +void VectorView<Number>::reinit(const size_type new_size, Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; @@ -312,7 +323,7 @@ void VectorView<Number>::reinit(const unsigned int new_size, Number *ptr) template<typename Number> inline -void VectorView<Number>::reinit(const unsigned int new_size, const Number *ptr) +void VectorView<Number>::reinit(const size_type new_size, const Number *ptr) { this->vec_size = new_size; this->max_vec_size = new_size; 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 b7a791dd2b..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-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_dof_info_h #define __deal2__matrix_free_dof_info_h @@ -22,6 +26,8 @@ #include <deal.II/dofs/dof_handler.h> #include <deal.II/matrix_free/helper_functions.h> +#include <deal.II/base/std_cxx1x/array.h> + #include <memory> @@ -66,6 +72,7 @@ namespace internal */ void clear (); + /** * Returns a pointer to the first index in the DoF row @p row. */ @@ -140,7 +147,7 @@ namespace internal * assigned the correct index after all the ghost indices have been * collected by the call to @p assign_ghosts. */ - void read_dof_indices (const std::vector<unsigned int> &local_indices, + void read_dof_indices (const std::vector<types::global_dof_index> &local_indices, const std::vector<unsigned int> &lexicographic_inv, const ConstraintMatrix &constraints, const unsigned int cell_number, @@ -265,7 +272,7 @@ namespace internal /** * Renumbers the degrees of freedom to give good access for this class. */ - void renumber_dofs (std::vector<unsigned int> &renumbering); + void renumber_dofs (std::vector<types::global_dof_index> &renumbering); /** * Returns the memory consumption in bytes of this class. @@ -299,13 +306,19 @@ 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<std_cxx1x::tuple<unsigned int, - unsigned int, - unsigned int> > row_starts; + std::vector<std_cxx1x::array<unsigned int, 3> > row_starts; /** - * Stores the 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 <tt>0</tt> and + * <tt>n_locally_owned_dofs-1</tt> and ghost indices in the range + * <tt>n_locally_owned_dofs</tt> to + * <tt>n_locally_owned_dofs+n_ghost_dofs</tt>. 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 @@ -340,7 +353,7 @@ namespace internal /** * Stores the rowstart indices of the compressed row storage in the @p - * dof_indices_plain fields. + * plain_dof_indices fields. */ std::vector<unsigned int> row_starts_plain_indices; @@ -405,7 +418,7 @@ namespace internal * calling @p assign_ghosts. Then, all information is collected by the * partitioner. */ - std::vector<unsigned int> ghost_dofs; + std::vector<types::global_dof_index> ghost_dofs; }; @@ -418,7 +431,7 @@ namespace internal 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; } @@ -430,7 +443,7 @@ namespace internal 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; } @@ -442,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]); } @@ -453,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; } @@ -465,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; } @@ -477,8 +489,7 @@ 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]); } @@ -490,7 +501,7 @@ namespace internal // 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_unsigned_int, + Assert (row_starts_plain_indices[row]==numbers::invalid_unsigned_int, ExcInternalError()); return begin_indices(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 64623405d5..16c53c268d 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 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/multithread_info.h> @@ -27,8 +31,8 @@ namespace internal struct ConstraintComparator { - bool operator()(const std::pair<unsigned int,double> &p1, - const std::pair<unsigned int,double> &p2) const + bool operator()(const std::pair<types::global_dof_index,double> &p1, + const std::pair<types::global_dof_index,double> &p2) const { return p1.second < p2.second; } @@ -51,12 +55,13 @@ namespace internal * access later on. */ unsigned short - insert_entries (const std::vector<std::pair<unsigned int,double> > &entries); + insert_entries (const std::vector<std::pair<types::global_dof_index,double> > &entries); + + std::vector<std::pair<types::global_dof_index, double> > constraint_entries; + std::vector<types::global_dof_index> constraint_indices; - std::vector<std::pair<unsigned int, double> > constraint_entries; - std::vector<unsigned int> constraint_indices; - std::pair<std::vector<Number>,unsigned int> next_constraint; - std::map<std::vector<Number>,unsigned int,FPArrayComparator<double> > constraints; + std::pair<std::vector<Number>, types::global_dof_index> next_constraint; + std::map<std::vector<Number>, types::global_dof_index, FPArrayComparator<double> > constraints; }; @@ -69,7 +74,7 @@ namespace internal template <typename Number> unsigned short ConstraintValues<Number>:: - insert_entries (const std::vector<std::pair<unsigned int,double> > &entries) + insert_entries (const std::vector<std::pair<types::global_dof_index,double> > &entries) { next_constraint.first.resize(entries.size()); if (entries.size() > 0) @@ -78,7 +83,7 @@ namespace internal constraint_entries = entries; std::sort(constraint_entries.begin(), constraint_entries.end(), ConstraintComparator()); - for (unsigned int j=0; j<constraint_entries.size(); j++) + for (types::global_dof_index j=0; j<constraint_entries.size(); j++) { // copy the indices of the constraint entries after sorting. constraint_indices[j] = constraint_entries[j].first; @@ -96,10 +101,11 @@ namespace internal // equal. this was quite lenghty and now we use a std::map with a // user-defined comparator to compare floating point arrays to a // tolerance 1e-13. - std::pair<typename std::map<std::vector<double>, unsigned int, + std::pair<typename std::map<std::vector<double>, types::global_dof_index, FPArrayComparator<double> >::iterator, bool> it = constraints.insert(next_constraint); - unsigned int insert_position = deal_II_numbers::invalid_unsigned_int; + + types::global_dof_index insert_position = deal_II_numbers::invalid_dof_index; if (it.second == false) insert_position = it.first->second; else @@ -167,7 +173,7 @@ namespace internal void - DoFInfo::read_dof_indices (const std::vector<unsigned int> &local_indices, + DoFInfo::read_dof_indices (const std::vector<types::global_dof_index> &local_indices, const std::vector<unsigned int> &lexicographic_inv, const ConstraintMatrix &constraints, const unsigned int cell_number, @@ -176,8 +182,11 @@ namespace internal { Assert (vector_partitioner.get() !=0, ExcInternalError()); const unsigned int n_mpi_procs = vector_partitioner->n_mpi_processes(); - const unsigned int first_owned = vector_partitioner->local_range().first; - const unsigned int last_owned = vector_partitioner->local_range().second; + const types::global_dof_index first_owned = vector_partitioner->local_range().first; + const types::global_dof_index last_owned = vector_partitioner->local_range().second; + Assert (last_owned-first_owned < std::numeric_limits<unsigned int>::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<unsigned short,unsigned short> constraint_iterator (0,0); @@ -185,9 +194,9 @@ namespace internal dofs_per_cell[0] : dofs_per_cell[cell_active_fe_index[cell_number]]; for (unsigned int i=0; i<dofs_this_cell; i++) { - unsigned int current_dof = + types::global_dof_index current_dof = local_indices[lexicographic_inv[i]]; - const std::vector<std::pair<unsigned int,double> > + const std::vector<std::pair<types::global_dof_index,double> > *entries_ptr = constraints.get_constraint_entries(current_dof); @@ -206,9 +215,9 @@ namespace internal // check whether this dof is identity constrained to another // dof. then we can simply insert that dof and there is no need // to actually resolve the constraint entries - const std::vector<std::pair<unsigned int,double> > + const std::vector<std::pair<types::global_dof_index,double> > &entries = *entries_ptr; - const unsigned int n_entries = entries.size(); + const types::global_dof_index n_entries = entries.size(); if (n_entries == 1 && std::fabs(entries[0].second-1.)<1e-14) { current_dof = entries[0].first; @@ -228,7 +237,7 @@ namespace internal // space or mark it as ghost if necessary if (n_entries > 0) { - const std::vector<unsigned int> &constraint_indices = + const std::vector<types::global_dof_index> &constraint_indices = constraint_values.constraint_indices; for (unsigned int j=0; j<n_entries; ++j) { @@ -236,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 @@ -249,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<unsigned int>(constraint_indices[j] - + first_owned)); } } } @@ -270,7 +279,7 @@ no_constraint: else current_dof -= first_owned; - dof_indices.push_back (current_dof); + dof_indices.push_back (static_cast<unsigned int>(current_dof)); // make sure constraint_iterator.first is always within the // bounds of unsigned short @@ -280,9 +289,9 @@ no_constraint: constraint_iterator.first++; } } - row_starts[cell_number+1] = std_cxx1x::tuple<unsigned int,unsigned int, - unsigned int> - (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 @@ -291,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<dofs_this_cell; ++i) { - unsigned int current_dof = + types::global_dof_index current_dof = local_indices[lexicographic_inv[i]]; if (n_mpi_procs > 1 && (current_dof < first_owned || @@ -310,7 +318,8 @@ no_constraint: } else current_dof -= first_owned; - plain_dof_indices.push_back (current_dof); + plain_dof_indices.push_back (static_cast<unsigned int> + (current_dof)); } } } @@ -326,8 +335,8 @@ no_constraint: // sort ghost dofs and compress out duplicates const unsigned int n_owned = (vector_partitioner->local_range().second- vector_partitioner->local_range().first); - const unsigned int 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<unsigned int>::iterator dof = dof_indices.begin(); dof!=dof_indices.end(); ++dof) @@ -341,18 +350,19 @@ no_constraint: // since we need to go back to the local_to_global indices and // replace the temporary numbering of ghosts by the real number in // the index set, we need to store these values - std::vector<std::pair<unsigned int,unsigned int> > ghost_origin(n_ghosts); - for (unsigned int i=0; i<n_ghosts; ++i) + std::vector<std::pair<types::global_dof_index,unsigned int> > ghost_origin(n_ghosts); + for (std::size_t i=0; i<n_ghosts; ++i) { ghost_origin[i].first = ghost_dofs[i]; ghost_origin[i].second = i; } std::sort (ghost_origin.begin(), ghost_origin.end()); - unsigned int last_contiguous_start = ghost_origin[0].first; + + types::global_dof_index last_contiguous_start = ghost_origin[0].first; ghost_numbering[ghost_origin[0].second] = 0; - for (unsigned int i=1; i<n_ghosts; i++) + for (std::size_t i=1; i<n_ghosts; i++) { - if (ghost_origin[i].first>ghost_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); @@ -371,7 +381,7 @@ no_constraint: // dofs. the ghost index set should store the same number { AssertDimension (n_unique_ghosts, ghost_indices.n_elements()); - for (unsigned int i=0; i<n_ghosts; ++i) + for (std::size_t i=0; i<n_ghosts; ++i) Assert (ghost_numbering[i] == ghost_indices.index_within_set(ghost_dofs[i]), ExcInternalError()); @@ -384,9 +394,9 @@ no_constraint: const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int i=0; i<n_boundary_cells; ++i) { - unsigned int *data_ptr = const_cast<unsigned int *> - (begin_indices(boundary_cells[i])); - const unsigned int *row_end = end_indices(boundary_cells[i]); + unsigned int *data_ptr = const_cast<unsigned int *> (begin_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) ? @@ -400,10 +410,8 @@ no_constraint: { if (row_length_indicators(boundary_cells[i]) > 0) { - unsigned int *data_ptr = const_cast<unsigned int *> - (begin_indices_plain(boundary_cells[i])); - const unsigned int *row_end = - (end_indices_plain(boundary_cells[i])); + unsigned int *data_ptr = const_cast<unsigned int *> (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) ? @@ -416,8 +424,8 @@ no_constraint: } } - std::vector<unsigned int> new_ghosts; - ghost_dofs.swap(new_ghosts); + std::vector<types::global_dof_index> 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 @@ -601,8 +609,7 @@ no_constraint: std::swap (new_active_fe_index, cell_active_fe_index); } - std::vector<std_cxx1x::tuple<unsigned int,unsigned int, - unsigned int> > new_row_starts; + std::vector<std_cxx1x::array<unsigned int, 3> > new_row_starts; std::vector<unsigned int> new_dof_indices; std::vector<std::pair<unsigned short,unsigned short> > new_constraint_indicator; @@ -633,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<unsigned int,unsigned int,unsigned int> - (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); @@ -694,7 +700,7 @@ no_constraint: } else { - const unsigned int constraint_loc = constr_ind[j]->second; + const unsigned short constraint_loc = constr_ind[j]->second; new_constraint_indicator.push_back (std::pair<unsigned short,unsigned short> (m_index, constraint_loc)); for (unsigned int k=constraint_pool_row_index[constraint_loc]; @@ -717,9 +723,9 @@ no_constraint: } AssertDimension (position_cell+1, row_starts.size()); - new_row_starts[size_info.n_macro_cells] = - std_cxx1x::tuple<unsigned int,unsigned int,unsigned int> - (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(), @@ -736,8 +742,8 @@ no_constraint: // locally owned plus the number of ghosts const unsigned int index_range = (vector_partitioner->local_range().second- vector_partitioner->local_range().first) - + vector_partitioner->ghost_indices().n_elements(); - for (unsigned int i=0; i<dof_indices.size(); ++i) + + vector_partitioner->ghost_indices().n_elements(); + for (std::size_t i=0; i<dof_indices.size(); ++i) AssertIndexRange (dof_indices[i], index_range); // sanity check 2: for the constraint indicators, the first index should @@ -1638,7 +1644,7 @@ not_connect: namespace internal { // rudimentary version of a vector that keeps entries always ordered - class ordered_vector : public std::vector<unsigned int> + class ordered_vector : public std::vector<types::global_dof_index> { public: ordered_vector () @@ -1646,20 +1652,20 @@ not_connect: reserve (2000); } - void reserve (const unsigned int size) + void reserve (const std::size_t size) { if (size > 0) - this->std::vector<unsigned int>::reserve (size); + this->std::vector<types::global_dof_index>::reserve (size); } // 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 unsigned int entry, - std::vector<unsigned int>::iterator &dat) + std::vector<types::global_dof_index>::iterator &dat) { - AssertIndexRange (static_cast<unsigned int>(dat - begin()), size()+1); - AssertIndexRange (static_cast<unsigned int>(end() - dat), size()+1); + AssertIndexRange (static_cast<std::size_t>(dat - begin()), size()+1); + AssertIndexRange (static_cast<std::size_t>(end() - dat), size()+1); AssertIndexRange (size(), capacity()); while (dat != end() && *dat < entry) ++dat; @@ -1671,7 +1677,7 @@ not_connect: } else if (*dat > entry) { - dat = this->std::vector<unsigned int>::insert (dat, entry); + dat = this->std::vector<types::global_dof_index>::insert (dat, entry); ++dat; } else @@ -1691,9 +1697,10 @@ not_connect: CompressedSimpleSparsityPattern &connectivity) const { AssertDimension (row_starts.size()-1, size_info.n_active_cells); - 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_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; @@ -1824,7 +1831,7 @@ not_connect: if (connectivity_dof.n_rows()==connectivity_dof.n_cols()) ++sp; row_entries.reserve (row_entries.size() + end_cell - it); - std::vector<unsigned int>::iterator insert_pos = row_entries.begin(); + std::vector<types::global_dof_index>::iterator insert_pos = row_entries.begin(); for ( ; sp != connectivity_dof.end(*it); ++sp) if (sp->column() >= block) break; @@ -1839,7 +1846,7 @@ not_connect: else { const unsigned int *it = begin_indices (block), - * end_cell = end_indices (block); + * end_cell = end_indices (block); for ( ; it != end_cell; ++it) if (row_lengths[*it] > 0) { @@ -1848,7 +1855,7 @@ not_connect: if (connectivity_dof.n_rows()==connectivity_dof.n_cols()) ++sp; row_entries.reserve (row_entries.size() + end_cell - it); - std::vector<unsigned int>::iterator insert_pos = row_entries.begin(); + std::vector<types::global_dof_index>::iterator insert_pos = row_entries.begin(); for ( ; sp != connectivity_dof.end(*it); ++sp) if (sp->column() >= block) break; @@ -1863,45 +1870,50 @@ not_connect: - void DoFInfo::renumber_dofs (std::vector<unsigned int> &renumbering) + void DoFInfo::renumber_dofs (std::vector<types::global_dof_index> &renumbering) { // first renumber all locally owned degrees of freedom AssertDimension (vector_partitioner->local_size(), vector_partitioner->size()); const unsigned int local_size = vector_partitioner->local_size(); renumbering.resize (0); - renumbering.resize (local_size, numbers::invalid_unsigned_int); - unsigned int counter = 0; + renumbering.resize (local_size, numbers::invalid_dof_index); + + types::global_dof_index counter = 0; std::vector<unsigned int>::iterator dof_ind = dof_indices.begin(), end_ind = dof_indices.end(); for ( ; dof_ind != end_ind; ++dof_ind) { if (*dof_ind < local_size) { - if (renumbering[*dof_ind] == numbers::invalid_unsigned_int) + if (renumbering[*dof_ind] == numbers::invalid_dof_index) renumbering[*dof_ind] = counter++; *dof_ind = renumbering[*dof_ind]; } } AssertIndexRange (counter, local_size+1); - for (unsigned int i=0; i<renumbering.size(); ++i) - if (renumbering[i] == numbers::invalid_unsigned_int) + for (std::size_t i=0; i<renumbering.size(); ++i) + if (renumbering[i] == numbers::invalid_dof_index) renumbering[i] = counter++; // adjust the constrained DoFs std::vector<unsigned int> new_constrained_dofs (constrained_dofs.size()); - for (unsigned int i=0; i<constrained_dofs.size(); ++i) + for (std::size_t i=0; i<constrained_dofs.size(); ++i) new_constrained_dofs[i] = renumbering[constrained_dofs[i]]; // the new constrained DoFs should be sorted already as they are not // contained in dof_indices and then get contiguous numbers #ifdef DEBUG - for (unsigned int i=1; i<new_constrained_dofs.size(); ++i) + for (std::size_t i=1; i<new_constrained_dofs.size(); ++i) Assert (new_constrained_dofs[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; i<renumbering.size(); ++i) + renumbering[i] = vector_partitioner->local_to_global(renumbering[i]); + AssertDimension (counter, renumbering.size()); } @@ -1911,8 +1923,7 @@ not_connect: DoFInfo::memory_consumption () const { std::size_t memory = sizeof(*this); - memory += (row_starts.capacity()*sizeof(std_cxx1x::tuple<unsigned int, - unsigned int, unsigned int>)); + memory += (row_starts.capacity()*sizeof(std_cxx1x::array<unsigned int,3>)); memory += MemoryConsumption::memory_consumption (dof_indices); memory += MemoryConsumption::memory_consumption (row_starts_plain_indices); memory += MemoryConsumption::memory_consumption (plain_dof_indices); @@ -1930,8 +1941,7 @@ not_connect: { out << " Memory row starts indices: "; size_info.print_memory_statistics - (out, (row_starts.capacity()*sizeof(std_cxx1x::tuple<unsigned int, - unsigned int, unsigned int>))); + (out, (row_starts.capacity()*sizeof(std_cxx1x::array<unsigned int, 3>))); out << " Memory dof indices: "; size_info.print_memory_statistics (out, MemoryConsumption::memory_consumption (dof_indices)); @@ -1959,9 +1969,8 @@ not_connect: for (unsigned int row=0 ; row<n_rows ; ++row) { out << "Entries row " << row << ": "; - const unsigned int - *glob_indices = begin_indices(row), - *end_row = end_indices(row); + const unsigned int *glob_indices = begin_indices(row), + *end_row = end_indices(row); unsigned int index = 0; const std::pair<unsigned short,unsigned short> *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 187716af64..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; @@ -1824,8 +1828,7 @@ FEEvaluationBase<dim,dofs_per_cell_,n_q_points_,n_components_,Number> 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<dim,dofs_per_cell_,n_q_points_,n_components_,Number> // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector<VectorType, - IsBlockVector<VectorType>::value>::BaseVectorType *src_data[n_components]; + IsBlockVector<VectorType>::value>::BaseVectorType *src_data[n_components]; for (unsigned int d=0; d<n_components; ++d) src_data[d] = internal::BlockVectorSelector<VectorType, IsBlockVector<VectorType>::value>::get_vector_component(const_cast<VectorType &>(src), d); @@ -2210,7 +2213,7 @@ FEEvaluationBase<dim,dofs_per_cell_,n_q_points_,n_components_,Number> // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data const typename internal::BlockVectorSelector<VectorType, - IsBlockVector<VectorType>::value>::BaseVectorType *src_data[n_components]; + IsBlockVector<VectorType>::value>::BaseVectorType *src_data[n_components]; for (unsigned int d=0; d<n_components; ++d) src_data[d] = internal::BlockVectorSelector<VectorType, IsBlockVector<VectorType>::value>::get_vector_component(const_cast<VectorType &>(src), d); @@ -2277,7 +2280,7 @@ FEEvaluationBase<dim,dofs_per_cell_,n_q_points_,n_components_,Number> // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector<VectorType, - IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components]; + IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components]; for (unsigned int d=0; d<n_components; ++d) dst_data[d] = internal::BlockVectorSelector<VectorType, IsBlockVector<VectorType>::value>::get_vector_component(dst, d); @@ -2355,7 +2358,7 @@ FEEvaluationBase<dim,dofs_per_cell_,n_q_points_,n_components_,Number> // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector<VectorType, - IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components]; + IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components]; for (unsigned int d=0; d<n_components; ++d) dst_data[d] = internal::BlockVectorSelector<VectorType, IsBlockVector<VectorType>::value>::get_vector_component(dst, d); @@ -2441,8 +2444,7 @@ FEEvaluationBase<dim,dofs_per_cell_,n_q_points_,n_components_,Number> // points to the global indices stored in index_local_to_global 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<Number> *shape_values, - const VectorizedArray<Number> in [], - VectorizedArray<Number> out []) + const VectorizedArray<Number> in [], + VectorizedArray<Number> 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<n_cols; ++col) { - VectorizedArray<Number> 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<mid; ++ind) - { - if (dof_to_quad == true) - { - val0 = shape_values[ind*n_q_points_1d+col]; - val1 = shape_values[ind*n_q_points_1d+nn-1-col]; - } - else - { - val0 = shape_values[col*n_q_points_1d+ind]; - val1 = shape_values[(col+1)*n_q_points_1d-1-ind]; - } - in0 = in[stride*ind]; - in1 = in[stride*(mm-1-ind)]; - res0 += val0 * in0; - res1 += val1 * in0; - res0 += val1 * in1; - res1 += val0 * in1; - } - } - else - res0 = res1 = VectorizedArray<Number>(); - 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<Number> 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<mid; ++ind) + { + if (dof_to_quad == true) + { + val0 = shape_values[ind*n_q_points_1d+col]; + val1 = shape_values[ind*n_q_points_1d+nn-1-col]; + } + else + { + val0 = shape_values[col*n_q_points_1d+ind]; + val1 = shape_values[(col+1)*n_q_points_1d-1-ind]; + } + in0 = in[stride*ind]; + in1 = in[stride*(mm-1-ind)]; + res0 += val0 * in0; + res1 += val1 * in0; + res0 += val1 * in1; + res1 += val0 * in1; + } + } + else + res0 = res1 = VectorizedArray<Number>(); + 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<Number> res0; - VectorizedArray<Number> val0 = shape_values[n_cols]; - if (mid > 0) - { - res0 = in[0] + in[stride*(mm-1)]; - res0 *= val0; - for (int ind=1; ind<mid; ++ind) - { - val0 = shape_values[ind*n_q_points_1d+n_cols]; - VectorizedArray<Number> val1 = in[stride*ind] + in[stride*(mm-1-ind)]; - val1 *= val0; - res0 += val1; - } - } - else - res0 = VectorizedArray<Number>(); - if (add == false) - out[stride*n_cols] = res0; - else - out[stride*n_cols] += res0; + VectorizedArray<Number> res0; + VectorizedArray<Number> val0 = shape_values[n_cols]; + if (mid > 0) + { + res0 = in[0] + in[stride*(mm-1)]; + res0 *= val0; + for (int ind=1; ind<mid; ++ind) + { + val0 = shape_values[ind*n_q_points_1d+n_cols]; + VectorizedArray<Number> val1 = in[stride*ind] + in[stride*(mm-1-ind)]; + val1 *= val0; + res0 += val1; + } + } + else + res0 = VectorizedArray<Number>(); + if (add == false) + out[stride*n_cols] = res0; + else + out[stride*n_cols] += res0; } else if (dof_to_quad == false && nn%2 == 1) { - VectorizedArray<Number> res0; - if (mid > 0) - { - VectorizedArray<Number> val0 = shape_values[n_cols*n_q_points_1d]; - res0 = in[0] + in[stride*(mm-1)]; - res0 *= val0; - for (int ind=1; ind<mid; ++ind) - { - val0 = shape_values[n_cols*n_q_points_1d+ind]; - VectorizedArray<Number> 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<Number> res0; + if (mid > 0) + { + VectorizedArray<Number> val0 = shape_values[n_cols*n_q_points_1d]; + res0 = in[0] + in[stride*(mm-1)]; + res0 *= val0; + for (int ind=1; ind<mid; ++ind) + { + val0 = shape_values[n_cols*n_q_points_1d+ind]; + VectorizedArray<Number> 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<Number> *shape_gradients, - const VectorizedArray<Number> in [], - VectorizedArray<Number> out []) + const VectorizedArray<Number> in [], + VectorizedArray<Number> 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<Number> *shape_hessians, - const VectorizedArray<Number> in [], - VectorizedArray<Number> out []) + const VectorizedArray<Number> in [], + VectorizedArray<Number> 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<Number> *shape_gradients, - const VectorizedArray<Number> in [], - VectorizedArray<Number> out []) + const VectorizedArray<Number> in [], + VectorizedArray<Number> 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 <deal.II/base/utilities.h> #include <deal.II/base/memory_consumption.h> 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 1cee5ba92b..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,18 +558,21 @@ 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. + * 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 + * <tt>get_vector_partitioner()->local_to_global</tt> 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<unsigned int> & 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<unsigned int> &renumbering, + void renumber_dofs (std::vector<types::global_dof_index> &renumbering, const unsigned int vector_component = 0); //@} @@ -1159,7 +1166,7 @@ MatrixFree<dim,Number>::create_cell_subrange_hp_by_index template <int dim, typename Number> inline void -MatrixFree<dim,Number>::renumber_dofs (std::vector<unsigned int> &renumbering, +MatrixFree<dim,Number>::renumber_dofs (std::vector<types::global_dof_index> &renumbering, const unsigned int vector_component) { AssertIndexRange(vector_component, dof_info.size()); @@ -1203,8 +1210,7 @@ MatrixFree<dim,Number>::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<dim,Number>::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<dim,Number>::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<dim,Number>::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<Number>::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 301920ad23..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 <deal.II/base/utilities.h> #include <deal.II/base/memory_consumption.h> @@ -174,7 +178,7 @@ internal_reinit(const Mapping<dim> &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<Number>::n_array_elements; // if indices are not initialized, the cell_level_index might not be @@ -296,7 +300,7 @@ internal_reinit(const Mapping<dim> &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<Number>::n_array_elements; // if indices are not initialized, the cell_level_index might not be @@ -459,14 +463,12 @@ void MatrixFree<dim,Number>::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<unsigned int> local_dof_indices; - std::vector<std::vector<unsigned int> > ghost_dofs(n_fe); + std::vector<types::global_dof_index> local_dof_indices; std::vector<std::vector<std::vector<unsigned int> > > lexicographic_inv(n_fe); internal::MatrixFreeFunctions::ConstraintValues<double> constraint_values; @@ -526,7 +528,7 @@ void MatrixFree<dim,Number>::initialize_indices dynamic_cast<const FE_Poly<TensorProductPolynomials<dim>,dim,dim>*> (&fe.base_element(0)); const FE_Poly<TensorProductPolynomials<dim,Polynomials:: - PiecewisePolynomial<double> >,dim,dim> *fe_poly_piece = + PiecewisePolynomial<double> >,dim,dim> *fe_poly_piece = dynamic_cast<const FE_Poly<TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double> >,dim,dim>*> (&fe.base_element(0)); @@ -577,23 +579,22 @@ void MatrixFree<dim,Number>::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<unsigned int,unsigned int, - unsigned int> (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); // cache the constrained indices for use in matrix-vector products { - const unsigned int + const types::global_dof_index start_index = dof_info[no].vector_partitioner->local_range().first, end_index = dof_info[no].vector_partitioner->local_range().second; - for (unsigned int i=start_index; i<end_index; ++i) + for (types::global_dof_index i=start_index; i<end_index; ++i) if (constraint[no]->is_constrained(i)==true) - dof_info[no].constrained_dofs.push_back(i-start_index); + dof_info[no].constrained_dofs. + push_back(static_cast<unsigned int>(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 @@ -749,7 +750,7 @@ void MatrixFree<dim,Number>::initialize_indices } // set constraint pool from the std::map and reorder the indices - typename std::map<std::vector<double>, unsigned int, + typename std::map<std::vector<double>, types::global_dof_index, internal::MatrixFreeFunctions::FPArrayComparator<double> >::iterator it = constraint_values.constraints.begin(), end = constraint_values.constraints.end(); diff --git a/deal.II/include/deal.II/matrix_free/shape_info.h b/deal.II/include/deal.II/matrix_free/shape_info.h index 654db99e48..ea987f2d25 100644 --- a/deal.II/include/deal.II/matrix_free/shape_info.h +++ b/deal.II/include/deal.II/matrix_free/shape_info.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_shape_info_h #define __deal2__matrix_free_shape_info_h diff --git a/deal.II/include/deal.II/matrix_free/shape_info.templates.h b/deal.II/include/deal.II/matrix_free/shape_info.templates.h index 77386ed65d..1f9147f828 100644 --- a/deal.II/include/deal.II/matrix_free/shape_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/shape_info.templates.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. +// +// --------------------------------------------------------------------- + #include <deal.II/base/utilities.h> #include <deal.II/base/memory_consumption.h> @@ -61,13 +65,13 @@ namespace internal const FE_Poly<TensorProductPolynomials<dim>,dim,dim> *fe_poly = dynamic_cast<const FE_Poly<TensorProductPolynomials<dim>,dim,dim>*>(&fe); const FE_Poly<TensorProductPolynomials<dim,Polynomials:: - PiecewisePolynomial<double> >,dim,dim> *fe_poly_piece = + PiecewisePolynomial<double> >,dim,dim> *fe_poly_piece = dynamic_cast<const FE_Poly<TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double> >,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<dim>()) == 1. otherwise, need diff --git a/deal.II/include/deal.II/meshworker/assembler.h b/deal.II/include/deal.II/meshworker/assembler.h index 76fef0934e..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 @@ -154,7 +159,7 @@ namespace MeshWorker */ void assemble(VECTOR &global, const BlockVector<double> &local, - const std::vector<unsigned int> &dof); + const std::vector<types::global_dof_index> &dof); /** * The global matrices, @@ -270,10 +275,10 @@ namespace MeshWorker void assemble( MatrixBlock<MATRIX> &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2); + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2); /** * The global matrices, @@ -428,12 +433,12 @@ namespace MeshWorker void assemble( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2, + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2, bool transpose = false); /** @@ -443,12 +448,12 @@ namespace MeshWorker void assemble_fluxes( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2); + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local @@ -457,12 +462,12 @@ namespace MeshWorker void assemble_up( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2); + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local @@ -471,12 +476,12 @@ namespace MeshWorker void assemble_down( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2); + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local @@ -485,12 +490,12 @@ namespace MeshWorker void assemble_in( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2); + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local @@ -499,12 +504,12 @@ namespace MeshWorker void assemble_out( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2); + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2); /** * The level matrices, @@ -599,7 +604,7 @@ namespace MeshWorker ResidualLocalBlocksToGlobalBlocks<VECTOR>::assemble( VECTOR &global, const BlockVector<double> &local, - const std::vector<unsigned int> &dof) + const std::vector<types::global_dof_index> &dof) { if (constraints == 0) { @@ -699,10 +704,10 @@ namespace MeshWorker MatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble( MatrixBlock<MATRIX> &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2) + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2) { if (constraints == 0) { @@ -727,11 +732,11 @@ namespace MeshWorker else { const BlockIndices &bi = this->block_info->local(); - std::vector<unsigned int> sliced_row_indices (bi.block_size(block_row)); + std::vector<types::global_dof_index> sliced_row_indices (bi.block_size(block_row)); for (unsigned int i=0; i<sliced_row_indices.size(); ++i) sliced_row_indices[i] = dof1[bi.block_start(block_row)+i]; - std::vector<unsigned int> sliced_col_indices (bi.block_size(block_col)); + std::vector<types::global_dof_index> sliced_col_indices (bi.block_size(block_col)); for (unsigned int i=0; i<sliced_col_indices.size(); ++i) sliced_col_indices[i] = dof2[bi.block_start(block_col)+i]; @@ -751,8 +756,8 @@ namespace MeshWorker { // Row and column index of // the block we are dealing with - const unsigned int row = matrices->block(i).row; - const unsigned int col = matrices->block(i).column; + const types::global_dof_index row = matrices->block(i).row; + const types::global_dof_index col = matrices->block(i).column; assemble(matrices->block(i), info.matrix(i,false).matrix, row, col, info.indices, info.indices); } @@ -770,8 +775,8 @@ namespace MeshWorker { // Row and column index of // the block we are dealing with - const unsigned int row = matrices->block(i).row; - const unsigned int col = matrices->block(i).column; + const types::global_dof_index row = matrices->block(i).row; + const types::global_dof_index col = matrices->block(i).column; assemble(matrices->block(i), info1.matrix(i,false).matrix, row, col, info1.indices, info1.indices); assemble(matrices->block(i), info1.matrix(i,true).matrix, row, col, info1.indices, info2.indices); @@ -852,12 +857,12 @@ namespace MeshWorker MGMatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2, + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2, bool transpose) { for (unsigned int j=0; j<local.n_rows(); ++j) @@ -931,12 +936,12 @@ namespace MeshWorker MGMatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble_fluxes( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2) + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2) { for (unsigned int j=0; j<local.n_rows(); ++j) for (unsigned int k=0; k<local.n_cols(); ++k) @@ -984,12 +989,12 @@ namespace MeshWorker MGMatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble_up( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2) + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2) { for (unsigned int j=0; j<local.n_rows(); ++j) for (unsigned int k=0; k<local.n_cols(); ++k) @@ -1037,12 +1042,12 @@ namespace MeshWorker MGMatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble_down( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2) + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2) { for (unsigned int j=0; j<local.n_rows(); ++j) for (unsigned int k=0; k<local.n_cols(); ++k) @@ -1090,12 +1095,12 @@ namespace MeshWorker MGMatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble_in( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2) + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2) { // AssertDimension(local.n(), dof1.size()); // AssertDimension(local.m(), dof2.size()); @@ -1155,12 +1160,12 @@ namespace MeshWorker MGMatrixLocalBlocksToGlobalBlocks<MATRIX, number>::assemble_out( MATRIX &global, const FullMatrix<number> &local, - unsigned int block_row, - unsigned int block_col, - const std::vector<unsigned int> &dof1, - const std::vector<unsigned int> &dof2, - unsigned int level1, - unsigned int level2) + const unsigned int block_row, + const unsigned int block_col, + const std::vector<types::global_dof_index> &dof1, + const std::vector<types::global_dof_index> &dof2, + const unsigned int level1, + const unsigned int level2) { // AssertDimension(local.n(), dof1.size()); // AssertDimension(local.m(), dof2.size()); diff --git a/deal.II/include/deal.II/meshworker/dof_info.h b/deal.II/include/deal.II/meshworker/dof_info.h index cc12fedd04..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 @@ -97,13 +102,13 @@ namespace MeshWorker * The DoF indices of the * current cell */ - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; /** * The DoF indices on the current cell, organized by local blocks. * The size of this vector is zero, unless local blocks are used. */ - std::vector<std::vector<unsigned int> > indices_by_block; + std::vector<std::vector<types::global_dof_index> > indices_by_block; /** * Constructor setting the @@ -117,7 +122,7 @@ namespace MeshWorker * pointer empty, but setting * the #aux_local_indices. */ - DoFInfo (const DoFHandler<dim, spacedim>& dof_handler); + DoFInfo (const DoFHandler<dim, spacedim> &dof_handler); /** * Set the current cell and @@ -132,7 +137,7 @@ namespace MeshWorker template <class DHCellIterator, class DHFaceIterator> void reinit(const DHCellIterator &c, const DHFaceIterator &f, - const unsigned int n); + const unsigned int face_no); /** * Set the current subface and fill @p indices if the #cell @@ -141,8 +146,8 @@ namespace MeshWorker template <class DHCellIterator, class DHFaceIterator> void reinit(const DHCellIterator &c, const DHFaceIterator &f, - const unsigned int n, - const unsigned int s); + const unsigned int face_no, + const unsigned int subface_no); /** * Switch to a new face of the same cell. Does not change @p @@ -150,16 +155,16 @@ namespace MeshWorker */ template <class DHFaceIterator> void set_face (const DHFaceIterator &f, - const unsigned int n); - + 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. */ template <class DHFaceIterator> void set_subface (const DHFaceIterator &f, - const unsigned int n, - const unsigned int s); + const unsigned int face_no, + const unsigned int subface_no); const BlockIndices &local_indices() const; @@ -183,7 +188,7 @@ namespace MeshWorker void get_indices(const DHCellIterator &c); /// Auxiliary vector - std::vector<unsigned int> indices_org; + std::vector<types::global_dof_index> indices_org; /** * An auxiliary local @@ -282,7 +287,7 @@ namespace MeshWorker template <int dim, int spacedim, typename number> DoFInfo<dim,spacedim,number>::DoFInfo(const DoFHandler<dim,spacedim> &dof_handler) { - std::vector<unsigned int> aux(1); + std::vector<types::global_dof_index> aux(1); aux[0] = dof_handler.get_fe().dofs_per_cell; aux_local_indices.reinit(aux); } @@ -313,7 +318,7 @@ namespace MeshWorker get_indices(c); level_cell = c->is_level_cell(); - cell = static_cast<typename Triangulation<dim,spacedim>::cell_iterator> (c); + cell = typename Triangulation<dim,spacedim>::cell_iterator(*c); face_number = deal_II_numbers::invalid_unsigned_int; sub_number = deal_II_numbers::invalid_unsigned_int; if (block_info) @@ -328,10 +333,10 @@ namespace MeshWorker inline void DoFInfo<dim,spacedim,number>::set_face( const DHFaceIterator &f, - unsigned int n) + const unsigned int face_no) { face = static_cast<typename Triangulation<dim>::face_iterator> (f); - face_number = n; + face_number = face_no; sub_number = deal_II_numbers::invalid_unsigned_int; } @@ -342,15 +347,15 @@ namespace MeshWorker DoFInfo<dim,spacedim,number>::reinit( const DHCellIterator &c, const DHFaceIterator &f, - unsigned int n) + const unsigned int face_no) { if ((cell.state() != IteratorState::valid) - || cell != static_cast<typename Triangulation<dim>::cell_iterator> (c)) + || cell != typename Triangulation<dim>::cell_iterator(*c)) get_indices(c); level_cell = c->is_level_cell(); - cell = static_cast<typename Triangulation<dim>::cell_iterator> (c); - set_face(f,n); + cell = typename Triangulation<dim>::cell_iterator(*c); + set_face(f,face_no); if (block_info) LocalResults<number>::reinit(block_info->local()); @@ -364,12 +369,12 @@ namespace MeshWorker inline void DoFInfo<dim,spacedim,number>::set_subface( const DHFaceIterator &f, - unsigned int n, - unsigned int s) + const unsigned int face_no, + const unsigned int subface_no) { face = static_cast<typename Triangulation<dim>::face_iterator> (f); - face_number = n; - sub_number = s; + face_number = face_no; + sub_number = subface_no; } @@ -379,8 +384,8 @@ namespace MeshWorker DoFInfo<dim,spacedim,number>::reinit( const DHCellIterator &c, const DHFaceIterator &f, - unsigned int n, - unsigned int s) + const unsigned int face_no, + const unsigned int subface_no) { if (cell.state() != IteratorState::valid || cell != static_cast<typename Triangulation<dim>::cell_iterator> (c)) @@ -388,7 +393,7 @@ namespace MeshWorker level_cell = c->is_level_cell(); cell = static_cast<typename Triangulation<dim>::cell_iterator> (c); - set_subface(f,n,s); + set_subface(f, face_no, subface_no); if (block_info) LocalResults<number>::reinit(block_info->local()); 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 <deal.II/meshworker/dof_info.h> #include <deal.II/base/quadrature_lib.h> 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..4323bbf83a 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 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 <deal.II/meshworker/dof_info.h> #include <deal.II/meshworker/integration_info.h> 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<dim, spacedim, number> &dinfo, - IntegrationInfo<dim, spacedim> &info) const = 0; + IntegrationInfo<dim, spacedim> &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<dim, spacedim, number> &dinfo, - IntegrationInfo<dim, spacedim> &info) const = 0; + IntegrationInfo<dim, spacedim> &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<dim, spacedim, number> &dinfo1, DoFInfo<dim, spacedim, number> &dinfo2, IntegrationInfo<dim, spacedim> &info1, - IntegrationInfo<dim, spacedim> &info2) const = 0; + IntegrationInfo<dim, spacedim> &info2) const; /** - * The flag indicating whether - * the cell integrator cell() - * is to be used in the - * loop. Defaults to - * <tt>true</tt>. + * The flag indicating whether the cell integrator cell() is to be + * used in the loop. Defaults to <tt>true</tt>. */ bool use_cell; /** - * The flag indicating whether - * the boundary integrator - * boundary() is to be - * used in the loop. Defaults - * to <tt>true</tt>. + * The flag indicating whether the boundary integrator boundary() + * is to be used in the loop. Defaults to <tt>true</tt>. */ bool use_boundary; /** - * The flag indicating whether - * the interior face integrator - * face() is to be used in the - * loop. Defaults to - * <tt>true</tt>. + * The flag indicating whether the interior face integrator face() + * is to be used in the loop. Defaults to <tt>true</tt>. */ 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 b4429031f7..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 <typename> class TriaActiveIterator; +template <typename> class FilteredIterator; namespace internal { @@ -46,6 +52,12 @@ namespace internal return true; } + template <class ACCESSOR> + inline bool is_active_iterator(const FilteredIterator<TriaActiveIterator<ACCESSOR> > &) + { + return true; + } + template<int dim, class DOFINFO, class A> void assemble(const MeshWorker::DoFInfoBox<dim, DOFINFO> &dinfo, A *assembler) { @@ -250,7 +262,8 @@ namespace MeshWorker typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)>& face_worker, ASSEMBLER &assembler, - bool cells_first = true) + bool cells_first = true, + bool unique_faces_only = true) { DoFInfoBox<dim, DOFINFO> dof_info(dinfo); @@ -266,7 +279,7 @@ namespace MeshWorker WorkStream::run(begin, end, std_cxx1x::bind(&cell_action<INFOBOX, DOFINFO, dim, spacedim, ITERATOR>, std_cxx1x::_1, std_cxx1x::_3, std_cxx1x::_2, - cell_worker, boundary_worker, face_worker, cells_first, true), + cell_worker, boundary_worker, face_worker, cells_first, unique_faces_only), std_cxx1x::bind(&internal::assemble<dim,DOFINFO,ASSEMBLER>, std_cxx1x::_1, &assembler), info, dof_info); #else @@ -276,7 +289,7 @@ namespace MeshWorker info, cell_worker, boundary_worker, face_worker, cells_first, - true); + unique_faces_only); dof_info.assemble(assembler); } #endif 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 3858b436ad..88e201777a 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<const ConstraintMatrix,ResidualSimple<VECTOR> > constraints; }; - - + + /** * Assemble local matrices into a single global matrix. If this global * matrix has a block structure, this structure is not used, but @@ -212,8 +217,8 @@ namespace MeshWorker * into #matrix. */ void assemble(const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2); + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2); /** * The global matrix being @@ -330,16 +335,16 @@ namespace MeshWorker */ void assemble(MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2); + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2); /** * Assemble a single matrix into a global matrix. */ void assemble(MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level); /** @@ -348,8 +353,8 @@ namespace MeshWorker void assemble_up(MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level = numbers::invalid_unsigned_int); /** * Assemble a single matrix into a global matrix. @@ -357,8 +362,8 @@ namespace MeshWorker void assemble_down(MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level = numbers::invalid_unsigned_int); /** @@ -367,8 +372,8 @@ namespace MeshWorker void assemble_in(MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level = numbers::invalid_unsigned_int); /** @@ -377,8 +382,8 @@ namespace MeshWorker void assemble_out(MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level = numbers::invalid_unsigned_int); /** @@ -510,8 +515,8 @@ namespace MeshWorker inline void ResidualSimple<MATRIX>::initialize_local_blocks(const BlockIndices &) {} - - + + template <class VECTOR> template <class DOFINFO> inline void @@ -535,13 +540,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 <class VECTOR> @@ -561,27 +566,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;i<info1.vector(k).n_blocks();++i) - { - constraints->distribute_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; i<info1.vector(k).n_blocks(); ++i) + { + constraints->distribute_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()); + } } } } @@ -651,8 +656,8 @@ namespace MeshWorker template <class MATRIX> inline void MatrixSimple<MATRIX>::assemble(const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2) + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2) { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); @@ -721,9 +726,9 @@ namespace MeshWorker info2.indices_by_block[row], info1.indices_by_block[column]); } else - { - Assert(false, ExcNotImplemented()); - } + { + Assert(false, ExcNotImplemented()); + } } @@ -810,8 +815,8 @@ namespace MeshWorker MGMatrixSimple<MATRIX>::assemble( MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2) + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2) { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); @@ -841,8 +846,8 @@ namespace MeshWorker MGMatrixSimple<MATRIX>::assemble( MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level) { AssertDimension(M.m(), i1.size()); @@ -865,15 +870,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])) || @@ -894,8 +892,8 @@ namespace MeshWorker MGMatrixSimple<MATRIX>::assemble_up( MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level) { AssertDimension(M.n(), i1.size()); @@ -924,8 +922,8 @@ namespace MeshWorker MGMatrixSimple<MATRIX>::assemble_down( MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level) { AssertDimension(M.m(), i1.size()); @@ -954,8 +952,8 @@ namespace MeshWorker MGMatrixSimple<MATRIX>::assemble_in( MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level) { AssertDimension(M.m(), i1.size()); @@ -973,6 +971,17 @@ namespace MeshWorker for (unsigned int j=0; j<i1.size(); ++j) for (unsigned int k=0; k<i2.size(); ++k) if (std::fabs(M(j,k)) >= 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])) { @@ -997,8 +1006,8 @@ namespace MeshWorker MGMatrixSimple<MATRIX>::assemble_out( MATRIX &G, const FullMatrix<double> &M, - const std::vector<unsigned int> &i1, - const std::vector<unsigned int> &i2, + const std::vector<types::global_dof_index> &i1, + const std::vector<types::global_dof_index> &i2, const unsigned int level) { AssertDimension(M.n(), i1.size()); diff --git a/deal.II/include/deal.II/meshworker/vector_selector.h b/deal.II/include/deal.II/meshworker/vector_selector.h index 0edf1df4f6..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 @@ -290,7 +295,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<1,dim> > > > &gradients, std::vector<std::vector<std::vector<Tensor<2,dim> > > > &hessians, const FEValuesBase<dim,spacedim> &fe, - const std::vector<unsigned int> &index, + const std::vector<types::global_dof_index> &index, const unsigned int component, const unsigned int n_comp, const unsigned int start, @@ -313,7 +318,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<2,dim> > > > &hessians, const FEValuesBase<dim,spacedim> &fe, const unsigned int level, - const std::vector<unsigned int> &index, + const std::vector<types::global_dof_index> &index, const unsigned int component, const unsigned int n_comp, const unsigned int start, @@ -382,7 +387,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<1,dim> > > > &gradients, std::vector<std::vector<std::vector<Tensor<2,dim> > > > &hessians, const FEValuesBase<dim,spacedim> &fe, - const std::vector<unsigned int> &index, + const std::vector<types::global_dof_index> &index, const unsigned int component, const unsigned int n_comp, const unsigned int start, @@ -455,7 +460,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<2,dim> > > > &hessians, const FEValuesBase<dim,spacedim> &fe, const unsigned int level, - const std::vector<unsigned int> &index, + const std::vector<types::global_dof_index> &index, const unsigned int component, const unsigned int n_comp, const unsigned int start, 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 36a2dbb1ee..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 <deal.II/meshworker/vector_selector.h> #include <deal.II/base/vector_slice.h> @@ -42,7 +47,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<1,dim> > > > &, std::vector<std::vector<std::vector<Tensor<2,dim> > > > &, const FEValuesBase<dim,spacedim> &, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, const unsigned int, const unsigned int, const unsigned int, @@ -60,7 +65,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<2,dim> > > > &, const FEValuesBase<dim,spacedim> &, const unsigned int, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, const unsigned int, const unsigned int, const unsigned int, @@ -110,7 +115,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<1,dim> > > > &gradients, std::vector<std::vector<std::vector<Tensor<2,dim> > > > &hessians, const FEValuesBase<dim,spacedim> &fe, - const std::vector<unsigned int> &index, + const std::vector<types::global_dof_index> &index, const unsigned int component, const unsigned int n_comp, const unsigned int start, @@ -194,7 +199,7 @@ namespace MeshWorker std::vector<std::vector<std::vector<Tensor<2,dim> > > > &hessians, const FEValuesBase<dim,spacedim> &fe, const unsigned int level, - const std::vector<unsigned int> &index, + const std::vector<types::global_dof_index> &index, const unsigned int component, const unsigned int n_comp, const unsigned int start, 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 fc31e5e29e..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,7 +313,7 @@ MGCoarseGridHouseholder<number, VECTOR>::initialize( template<typename number, class VECTOR> void MGCoarseGridHouseholder<number, VECTOR>::operator() ( - const unsigned int, + const unsigned int /*level*/, VECTOR &dst, const VECTOR &src) const { @@ -339,7 +344,7 @@ MGCoarseGridSVD<number, VECTOR>::initialize( template<typename number, class VECTOR> void MGCoarseGridSVD<number, VECTOR>::operator() ( - const unsigned int, + const unsigned int /*level*/, VECTOR &dst, const VECTOR &src) const { 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 c442ae7d67..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,6 +40,8 @@ template <int dim> struct FunctionMap; class MGConstrainedDoFs : public Subscriptor { public: + + typedef std::vector<std::set<types::global_dof_index> >::size_type size_dof; /** * Fill the internal data * structures with values @@ -67,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 unsigned int index) const; + 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 unsigned int index) const; + 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 unsigned int index) const; + 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 unsigned int index) const; + 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<std::set<unsigned int> > & + const std::vector<std::set<types::global_dof_index> > & 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<std::set<unsigned int> > & + const std::vector<std::set<types::global_dof_index> > & 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<std::vector<bool> > & 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<std::vector<bool> > & 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<std::set<unsigned int> > boundary_indices; + std::vector<std::set<types::global_dof_index> > 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<std::set<unsigned int> > non_refinement_edge_indices; + std::vector<std::set<types::global_dof_index> > 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<std::vector<bool> > 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<std::vector<bool> > refinement_edge_boundary_indices; }; @@ -187,7 +175,7 @@ inline void MGConstrainedDoFs::initialize(const DoFHandler<dim,spacedim> &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); @@ -211,7 +199,7 @@ MGConstrainedDoFs::initialize( const typename FunctionMap<dim>::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); @@ -252,7 +240,7 @@ MGConstrainedDoFs::clear() inline bool MGConstrainedDoFs::is_boundary_index (const unsigned int level, - const unsigned int index) const + const types::global_dof_index index) const { AssertIndexRange(level, boundary_indices.size()); if (boundary_indices[level].find(index) != boundary_indices[level].end()) @@ -264,7 +252,7 @@ MGConstrainedDoFs::is_boundary_index (const unsigned int level, inline bool MGConstrainedDoFs::non_refinement_edge_index (const unsigned int level, - const unsigned int index) const + const types::global_dof_index index) const { AssertIndexRange(level, non_refinement_edge_indices.size()); @@ -277,7 +265,7 @@ MGConstrainedDoFs::non_refinement_edge_index (const unsigned int level, inline bool MGConstrainedDoFs::at_refinement_edge (const unsigned int level, - const unsigned int index) const + const types::global_dof_index index) const { AssertIndexRange(level, refinement_edge_indices.size()); AssertIndexRange(index, refinement_edge_indices[level].size()); @@ -289,7 +277,7 @@ MGConstrainedDoFs::at_refinement_edge (const unsigned int level, inline bool MGConstrainedDoFs::at_refinement_edge_boundary (const unsigned int level, - const unsigned int index) const + const types::global_dof_index index) const { AssertIndexRange(level, refinement_edge_boundary_indices.size()); AssertIndexRange(index, refinement_edge_boundary_indices[level].size()); @@ -298,14 +286,14 @@ MGConstrainedDoFs::at_refinement_edge_boundary (const unsigned int level, } inline -const std::vector<std::set<unsigned int> > & +const std::vector<std::set<types::global_dof_index> > & MGConstrainedDoFs::get_boundary_indices () const { return boundary_indices; } inline -const std::vector<std::set<unsigned int> > & +const std::vector<std::set<types::global_dof_index> > & MGConstrainedDoFs::get_non_refinement_edge_indices () const { return non_refinement_edge_indices; 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<MATRIX, PRECONDITIONER, VECTOR>::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<MATRIX, PRECONDITIONER, VECTOR>::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 cd14c068db..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 @@ -176,7 +181,7 @@ namespace MGTools template <class DH> void count_dofs_per_block (const DH &dof_handler, - std::vector<std::vector<unsigned int> > &dofs_per_block, + std::vector<std::vector<types::global_dof_index> > &dofs_per_block, std::vector<unsigned int> target_block = std::vector<unsigned int>()); /** @@ -192,7 +197,7 @@ namespace MGTools template <int dim, int spacedim> void count_dofs_per_component (const DoFHandler<dim,spacedim> &mg_dof, - std::vector<std::vector<unsigned int> > &result, + std::vector<std::vector<types::global_dof_index> > &result, const bool only_once = false, std::vector<unsigned int> target_component = std::vector<unsigned int>()); @@ -204,7 +209,7 @@ namespace MGTools template <int dim, int spacedim> void count_dofs_per_component (const DoFHandler<dim,spacedim> &mg_dof, - std::vector<std::vector<unsigned int> > &result, + std::vector<std::vector<types::global_dof_index> > &result, std::vector<unsigned int> target_component) DEAL_II_DEPRECATED; /** @@ -233,7 +238,7 @@ namespace MGTools void make_boundary_list (const DoFHandler<dim,spacedim> &mg_dof, const typename FunctionMap<dim>::type &function_map, - std::vector<std::set<unsigned int> > &boundary_indices, + std::vector<std::set<types::global_dof_index> > &boundary_indices, const ComponentMask &component_mask = ComponentMask()); /** @@ -253,7 +258,7 @@ namespace MGTools */ template <typename number> void - apply_boundary_values (const std::set<unsigned int> &boundary_dofs, + apply_boundary_values (const std::set<types::global_dof_index> &boundary_dofs, SparseMatrix<number> &matrix, const bool preserve_symmetry, const bool ignore_zeros = false) DEAL_II_DEPRECATED; @@ -263,7 +268,7 @@ namespace MGTools */ template <typename number> void - apply_boundary_values (const std::set<unsigned int> &boundary_dofs, + apply_boundary_values (const std::set<types::global_dof_index> &boundary_dofs, BlockSparseMatrix<number> &matrix, const bool preserve_symmetry) DEAL_II_DEPRECATED; @@ -302,7 +307,7 @@ namespace MGTools template <int dim, int spacedim> void extract_non_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler, - std::vector<std::set<unsigned int> > &non_interface_dofs); + std::vector<std::set<types::global_dof_index> > &non_interface_dofs); } /* @} */ diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.h b/deal.II/include/deal.II/multigrid/mg_transfer.h index d938dab05a..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<typename VECTOR::value_type> Matrix; - + template <class CSP, class DH> - 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 <class CSP, class DH> - 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 <class CSP, class DH> - 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,44 +235,68 @@ 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; private: /** * Sizes of the multi-level vectors. */ - std::vector<unsigned int> sizes; + std::vector<types::global_dof_index> sizes; /** - * Sparsity patterns for transfer - * matrices. + * Sparsity patterns for transfer matrices. */ std::vector<std_cxx1x::shared_ptr<typename internal::MatrixSelector<VECTOR>::Sparsity> > prolongation_sparsities; /** - * The actual prolongation matrix. - * column indices belong to the - * dof indices of the mother cell, - * i.e. the coarse level. - * while row indices belong to the - * child cell, i.e. the fine level. + * The actual prolongation matrix. column indices belong to the dof + * indices of the mother cell, i.e. the coarse level. while row + * indices belong to the child cell, i.e. the fine level. */ std::vector<std_cxx1x::shared_ptr<typename internal::MatrixSelector<VECTOR>::Matrix> > prolongation_matrices; /** - * Mapping for the - * <tt>copy_to/from_mg</tt>-functions. - * The data is first the global - * index, then the level index. + * 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. */ - std::vector<std::vector<std::pair<unsigned int, unsigned int> > > + std::vector<std::vector<std::pair<types::global_dof_index, unsigned int> > > copy_indices; + /** + * Additional degrees of freedom for the copy_to_mg() + * function. These are the ones where the global degree of freedom + * is locally owned and the level degree of freedom is not. + * + * Organization of the data is like for #copy_indices_mine. + */ + std::vector<std::vector<std::pair<types::global_dof_index, unsigned int> > > + copy_indices_to_me; + + /** + * Additional degrees of freedom for the copy_from_mg() + * function. These are the ones where the level degree of freedom + * is locally owned and the global degree of freedom is not. + * + * Organization of the data is like for #copy_indices_mine. + */ + std::vector<std::vector<std::pair<types::global_dof_index, unsigned int> > > + copy_indices_from_me; + + /** * The vector that stores what * has been given to the 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 eac5bb03d7..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 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 @@ -86,9 +91,9 @@ namespace target_component.end()); const unsigned int n_target_blocks = max_block + 1; - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > ndofs(mg_dof.get_tria().n_levels(), - std::vector<unsigned int>(n_target_blocks)); + std::vector<types::global_dof_index>(n_target_blocks)); MGTools::count_dofs_per_block (mg_dof, ndofs, target_component); for (unsigned int level=v.min_level(); @@ -151,23 +156,22 @@ MGTransferPrebuilt<VECTOR>::copy_to_mg ( { reinit_vector(mg_dof_handler, component_to_block_map, dst); bool first = true; - for (unsigned int level=mg_dof_handler.get_tria().n_levels(); level != 0;) + for (unsigned int level=mg_dof_handler.get_tria().n_global_levels(); level != 0;) { --level; VECTOR &dst_level = dst[level]; - typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; + typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT; for (IT i= copy_indices[level].begin(); i != copy_indices[level].end(); ++i) dst_level(i->second) = src(i->first); - // For non-DG: degrees of - // freedom in the refinement - // face may need special - // attention, since they belong - // to the coarse level, but - // have fine level basis - // functions + // for (IT i= copy_indices_to_me[level].begin(); + // i != copy_indices_to_me[level].end(); ++i) + // dst_level(i->second) = src(i->first); + + dst_level.compress(VectorOperation::insert); + if (!first) restrict_and_add (level+1, dst[level], dst[level+1]); @@ -193,11 +197,12 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg( // have fine level basis // functions dst = 0; - for (unsigned int level=0; level<mg_dof_handler.get_tria().n_levels(); ++level) + for (unsigned int level=0; level<mg_dof_handler.get_tria().n_global_levels(); ++level) { - typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; + typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT; - if (constraints == 0) + // 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); @@ -205,6 +210,17 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg( 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); + 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); } } @@ -225,12 +241,28 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg_add ( // to the coarse level, but // have fine level basis // functions - for (unsigned int level=0; level<mg_dof_handler.get_tria().n_levels(); ++level) + for (unsigned int level=0; level<mg_dof_handler.get_tria().n_global_levels(); ++level) { - typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) += src[level](i->second); + typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::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); + 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); + + // 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); + 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); } } 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 c348a24308..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 @@ -123,18 +128,18 @@ protected: /** * Sizes of the multi-level vectors. */ - mutable std::vector<std::vector<unsigned int> > sizes; + mutable std::vector<std::vector<types::global_dof_index> > sizes; /** * Start index of each block. */ - std::vector<unsigned int> block_start; + std::vector<types::global_dof_index> block_start; /** * Start index of each block on * all levels. */ - std::vector<std::vector<unsigned int> > mg_block_start; + std::vector<std::vector<types::global_dof_index> > mg_block_start; /** * Call build_matrices() @@ -520,7 +525,7 @@ private: /*@}*/ -//--------------------------------------------------------------------------- +//----------inline function definition-------------------------------------------------- template <typename number> inline void MGTransferBlockSelect<number>::select(const unsigned int block) 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 b3acd4e31d..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 @@ -33,7 +37,6 @@ DEAL_II_NAMESPACE_OPEN typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; - template <typename number> template <int dim, typename number2, int spacedim> void 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 708175b29a..40259aa4dd 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer_component.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer_component.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $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 @@ -125,18 +130,18 @@ protected: /** * Sizes of the multi-level vectors. */ - mutable std::vector<std::vector<unsigned int> > sizes; + mutable std::vector<std::vector<types::global_dof_index> > sizes; /** * Start index of each component. */ - std::vector<unsigned int> component_start; + std::vector<types::global_dof_index> component_start; /** * Start index of each component on * all levels. */ - std::vector<std::vector<unsigned int> > mg_component_start; + std::vector<std::vector<types::global_dof_index> > mg_component_start; /** * Call build_matrices() @@ -165,7 +170,7 @@ protected: * The data is first the global * index, then the level index. */ - std::vector<std::vector<std::pair<unsigned int, unsigned int> > > + std::vector<std::vector<std::pair<types::global_dof_index, unsigned int> > > copy_to_and_from_indices; /** @@ -174,7 +179,7 @@ protected: * boundary values in the * restriction matrix. */ - std::vector<std::set<unsigned int> > boundary_indices; + std::vector<std::set<types::global_dof_index> > boundary_indices; }; //TODO:[GK] Update documentation for copy_* functions @@ -268,8 +273,8 @@ public: = std::vector<unsigned int>(), const std::vector<unsigned int> &mg_target_component = std::vector<unsigned int>(), - const std::vector<std::set<unsigned int> > &boundary_indices - = std::vector<std::set<unsigned int> >() + const std::vector<std::set<types::global_dof_index> > &boundary_indices + = std::vector<std::set<types::global_dof_index> >() ); /** 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 4745515668..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 @@ -99,7 +103,7 @@ MGTransferSelect<number>::copy_from_mg ( //the block back to dst. const unsigned int n_blocks = *std::max_element(target_component.begin(), target_component.end()) + 1; - std::vector<unsigned int> dofs_per_block (n_blocks); + std::vector<types::global_dof_index> dofs_per_block (n_blocks); DoFTools::count_dofs_per_block (mg_dof_handler, dofs_per_block, target_component); BlockVector<number> tmp; tmp.reinit(n_blocks); @@ -169,7 +173,7 @@ MGTransferSelect<number>::do_copy_from_mg ( for (; level_cell != endc; ++level_cell) { const unsigned int level = level_cell->level(); - typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; + typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT; for (IT i=copy_to_and_from_indices[level].begin(); i != copy_to_and_from_indices[level].end(); ++i) dst(i->first) = src[level](i->second); @@ -188,8 +192,8 @@ MGTransferSelect<number>::do_copy_from_mg_add ( const FiniteElement<dim> &fe = mg_dof_handler.get_fe(); const unsigned int dofs_per_cell = fe.dofs_per_cell; - std::vector<unsigned int> global_dof_indices (dofs_per_cell); - std::vector<unsigned int> level_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> global_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> level_dof_indices (dofs_per_cell); typename DoFHandler<dim,spacedim>::active_cell_iterator level_cell = mg_dof_handler.begin_active(); @@ -206,7 +210,7 @@ MGTransferSelect<number>::do_copy_from_mg_add ( for (; level_cell != endc; ++level_cell) { const unsigned int level = level_cell->level(); - typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; + typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT; for (IT i=copy_to_and_from_indices[level].begin(); i != copy_to_and_from_indices[level].end(); ++i) dst(i->first) += src[level](i->second); diff --git a/deal.II/include/deal.II/multigrid/multigrid.h b/deal.II/include/deal.II/multigrid/multigrid.h index 4116300ad5..461a93fb56 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 @@ -600,7 +605,7 @@ Multigrid<VECTOR>::Multigrid (const DoFHandler<dim> &mg_dof_handler, : cycle_type(cycle), minlevel(0), - maxlevel(mg_dof_handler.get_tria().n_levels()-1), + maxlevel(mg_dof_handler.get_tria().n_global_levels()-1), defect(minlevel,maxlevel), solution(minlevel,maxlevel), t(minlevel,maxlevel), diff --git a/deal.II/include/deal.II/multigrid/multigrid.templates.h b/deal.II/include/deal.II/multigrid/multigrid.templates.h index cfee9c22a9..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 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 <deal.II/multigrid/multigrid.h> @@ -153,6 +158,10 @@ Multigrid<VECTOR>::level_v_step(const unsigned int level) deallog << "Residual on level " << level << std::endl; // t = A*solution[level] matrix->vmult(level, t[level], solution[level]); + + if (debug>2) + deallog << "Residual norm " << t[level].l2_norm() + << std::endl; // std::cout<<std::endl; // t[level].print(std::cout, 2,false); @@ -168,7 +177,7 @@ Multigrid<VECTOR>::level_v_step(const unsigned int level) { edge_out->vmult_add(level, t[level], solution[level]); if (debug>2) - deallog << "Norm t[" << level << "] " << t[level].l2_norm() << std::endl; + deallog << "Norm t[" << level << "] " << t[level].l2_norm() << std::endl; } if (l==level && edge_down != 0) @@ -179,7 +188,7 @@ Multigrid<VECTOR>::level_v_step(const unsigned int level) deallog << "restrict t[" << l-1 << "] " << t[l-1].l2_norm() << std::endl; defect[l-1] -= t[l-1]; if (debug>3) - deallog << "defect d[" << l-1 << "] " << defect[l-1].l2_norm() << std::endl; + deallog << "defect d[" << l-1 << "] " << defect[l-1].l2_norm() << std::endl; } // do recursion @@ -194,6 +203,8 @@ Multigrid<VECTOR>::level_v_step(const unsigned int level) // do coarse grid correction transfer->prolongate(level, t[level], solution[level-1]); + if (debug>2) + deallog << "Prolongate norm " << t[level].l2_norm() << std::endl; solution[level] += t[level]; 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..bb2d8f01f1 100644 --- a/deal.II/include/deal.II/numerics/data_out.h +++ b/deal.II/include/deal.II/numerics/data_out.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__data_out_h #define __deal2__data_out_h 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..07c33fd264 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 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..95f4f57378 100644 --- a/deal.II/include/deal.II/numerics/data_out_rotation.h +++ b/deal.II/include/deal.II/numerics/data_out_rotation.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $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 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..0473525720 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 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 <deal.II/numerics/dof_output_operator.h> #include <deal.II/numerics/data_out.h> 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..f47c98b30b 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 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 <deal.II/base/utilities.h> #include <deal.II/base/logstream.h> @@ -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<Point<dim> > qp = get_reference_coordinates (cell, p); if (!qp) { const std::pair<typename DH::active_cell_iterator, Point<dim> > 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<typename DH::active_cell_iterator, Point<dim> > 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<typename DH::active_cell_iterator, Point<dim> > 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<typename DH::active_cell_iterator, Point<dim> > 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<typename DH::active_cell_iterator, Point<dim> > 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<Point<dim> >(1, my_pair.second)); maps.push_back(std::vector<unsigned int>(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 fb3dca6ce8..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 @@ -366,7 +371,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const weight = 0, std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); @@ -379,7 +384,7 @@ namespace MatrixCreator // SparseMatrix<double> &matrix, // const FunctionMap<1>::type &boundary_functions, // Vector<double> &rhs_vector, -// std::vector<unsigned int>&dof_to_boundary_mapping, +// std::vector<types::global_dof_index>&dof_to_boundary_mapping, // const Function<1> * const a = 0); // //codimension 1 // @@ -389,7 +394,7 @@ namespace MatrixCreator // SparseMatrix<double> &matrix, // const FunctionMap<2>::type &boundary_functions, // Vector<double> &rhs_vector, -// std::vector<unsigned int>&dof_to_boundary_mapping, +// std::vector<types::global_dof_index>&dof_to_boundary_mapping, // const Function<2> * const a = 0); @@ -405,7 +410,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const a = 0, std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); @@ -420,7 +425,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const a = 0, std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); @@ -434,7 +439,7 @@ namespace MatrixCreator // SparseMatrix<double> &matrix, // const FunctionMap<1>::type &boundary_functions, // Vector<double> &rhs_vector, -// std::vector<unsigned int>&dof_to_boundary_mapping, +// std::vector<types::global_dof_index>&dof_to_boundary_mapping, // const Function<1> * const a = 0); /** @@ -447,7 +452,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const a = 0, std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); @@ -798,7 +803,7 @@ namespace MatrixTools */ template <typename number> void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, SparseMatrix<number> &matrix, Vector<number> &solution, Vector<number> &right_hand_side, @@ -815,7 +820,7 @@ namespace MatrixTools */ template <typename number> void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, BlockSparseMatrix<number> &matrix, BlockVector<number> &solution, BlockVector<number> &right_hand_side, @@ -860,7 +865,7 @@ namespace MatrixTools * step-18. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, PETScWrappers::SparseMatrix &matrix, PETScWrappers::Vector &solution, PETScWrappers::Vector &right_hand_side, @@ -871,7 +876,7 @@ namespace MatrixTools * matrices. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, PETScWrappers::MPI::SparseMatrix &matrix, PETScWrappers::MPI::Vector &solution, PETScWrappers::MPI::Vector &right_hand_side, @@ -903,7 +908,7 @@ namespace MatrixTools * to this function is the same. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, PETScWrappers::MPI::SparseMatrix &matrix, PETScWrappers::Vector &solution, PETScWrappers::MPI::Vector &right_hand_side, @@ -913,8 +918,8 @@ namespace MatrixTools * Same as above but for BlockSparseMatrix. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, - PETScWrappers::MPI::BlockSparseMatrix &matrix, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, + PETScWrappers::MPI::BlockSparseMatrix &matrix, PETScWrappers::MPI::BlockVector &solution, PETScWrappers::MPI::BlockVector &right_hand_side, const bool eliminate_columns = true); @@ -961,7 +966,7 @@ namespace MatrixTools * across an MPI system. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::Vector &solution, TrilinosWrappers::Vector &right_hand_side, @@ -973,7 +978,7 @@ namespace MatrixTools * working on block structures. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::BlockVector &solution, TrilinosWrappers::BlockVector &right_hand_side, @@ -1016,7 +1021,7 @@ namespace MatrixTools * types. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::MPI::Vector &solution, TrilinosWrappers::MPI::Vector &right_hand_side, @@ -1028,7 +1033,7 @@ namespace MatrixTools * on block structures. */ void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::MPI::BlockVector &solution, TrilinosWrappers::MPI::BlockVector &right_hand_side, @@ -1072,8 +1077,8 @@ namespace MatrixTools * documentation of this class. */ void - local_apply_boundary_values (const std::map<unsigned int,double> &boundary_values, - const std::vector<unsigned int> &local_dof_indices, + local_apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, + const std::vector<types::global_dof_index> &local_dof_indices, FullMatrix<double> &local_matrix, Vector<double> &local_rhs, const bool eliminate_columns); 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 0e7877caf1..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 @@ -62,10 +67,10 @@ namespace internal { public: PointGeometryData(const Point <dim> &new_requested_location, const std::vector <Point <dim> > &new_locations, - const std::vector <int> &new_sol_indices); + const std::vector <types::global_dof_index> &new_sol_indices); Point <dim> requested_location; std::vector <Point <dim> > support_point_locations; - std::vector <int> solution_indices; + std::vector <types::global_dof_index> solution_indices; }; } } diff --git a/deal.II/include/deal.II/numerics/solution_transfer.h b/deal.II/include/deal.II/numerics/solution_transfer.h index 443d140306..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 @@ -377,7 +382,7 @@ private: * Stores the number of DoFs before the * refinement and/or coarsening. */ - unsigned int n_dofs_old; + types::global_dof_index n_dofs_old; /** * Declaration of @@ -408,7 +413,7 @@ private: * and stores all dof indices * of the cells that'll be refined */ - std::vector<std::vector<unsigned int> > indices_on_cell; + std::vector<std::vector<types::global_dof_index> > indices_on_cell; /** * All cell data (the dof indices and @@ -432,7 +437,7 @@ private: struct Pointerstruct { Pointerstruct() : indices_ptr(0), dof_values_ptr(0), active_fe_index(0) {}; - Pointerstruct(std::vector<unsigned int> *indices_ptr_in, + Pointerstruct(std::vector<types::global_dof_index> *indices_ptr_in, const unsigned int active_fe_index_in = 0) : indices_ptr(indices_ptr_in), @@ -445,7 +450,7 @@ private: active_fe_index(active_fe_index_in) {}; std::size_t memory_consumption () const; - std::vector<unsigned int> *indices_ptr; + std::vector<types::global_dof_index> *indices_ptr; std::vector<Vector<typename VECTOR::value_type> > *dof_values_ptr; unsigned int active_fe_index; }; 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 12fa9add4e..96fd9a1b7c 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 @@ -653,7 +658,7 @@ namespace VectorTools /** * Calls the project() - * function, see above, with + * function above, with * <tt>mapping=MappingQ1@<dim@>()</tt>. */ template <int dim, class VECTOR, int spacedim> @@ -668,6 +673,40 @@ namespace VectorTools Quadrature<dim-1>(0)), const bool project_to_boundary_first = false); + /** + * Same as above, but for arguments of type hp::DoFHandler, + * hp::QuadratureCollection, hp::MappingCollection + */ + template <int dim, class VECTOR, int spacedim> + void project (const hp::MappingCollection<dim, spacedim> &mapping, + const hp::DoFHandler<dim,spacedim> &dof, + const ConstraintMatrix &constraints, + const hp::QCollection<dim> &quadrature, + const Function<spacedim> &function, + VECTOR &vec, + const bool enforce_zero_boundary = false, + const hp::QCollection<dim-1> &q_boundary = hp::QCollection<dim-1>(dim > 1 ? + QGauss<dim-1>(2) : + Quadrature<dim-1>(0)), + const bool project_to_boundary_first = false); + + /** + * Calls the project() + * function above, with a collection of + * MappingQ1@<dim@>() objects. + */ + template <int dim, class VECTOR, int spacedim> + void project (const hp::DoFHandler<dim,spacedim> &dof, + const ConstraintMatrix &constraints, + const hp::QCollection<dim> &quadrature, + const Function<spacedim> &function, + VECTOR &vec, + const bool enforce_zero_boundary = false, + const hp::QCollection<dim-1> &q_boundary = hp::QCollection<dim-1>(dim > 1 ? + QGauss<dim-1>(2) : + Quadrature<dim-1>(0)), + const bool project_to_boundary_first = false); + /** * Compute Dirichlet boundary * conditions. This function makes up a map @@ -758,7 +797,19 @@ namespace VectorTools interpolate_boundary_values (const Mapping<DH::dimension,DH::space_dimension> &mapping, const DH &dof, const typename FunctionMap<DH::space_dimension>::type &function_map, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, + const ComponentMask &component_mask = ComponentMask()); + + /** + * Like the previous function, but take a mapping collection to go with + * the hp::DoFHandler object. + */ + template <int dim, int spacedim> + void + interpolate_boundary_values (const hp::MappingCollection<dim,spacedim> &mapping, + const hp::DoFHandler<dim,spacedim> &dof, + const typename FunctionMap<spacedim>::type &function_map, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask = ComponentMask()); /** @@ -778,7 +829,7 @@ namespace VectorTools const DH &dof, const types::boundary_id boundary_component, const Function<DH::space_dimension> &boundary_function, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask = ComponentMask()); /** @@ -797,7 +848,7 @@ namespace VectorTools interpolate_boundary_values (const DH &dof, const types::boundary_id boundary_component, const Function<DH::space_dimension> &boundary_function, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask = ComponentMask()); @@ -814,7 +865,7 @@ namespace VectorTools void interpolate_boundary_values (const DH &dof, const typename FunctionMap<DH::space_dimension>::type &function_map, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask = ComponentMask()); @@ -1033,7 +1084,7 @@ namespace VectorTools const DoFHandler<dim,spacedim> &dof, const typename FunctionMap<spacedim>::type &boundary_functions, const Quadrature<dim-1> &q, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); /** @@ -1045,7 +1096,30 @@ namespace VectorTools void project_boundary_values (const DoFHandler<dim,spacedim> &dof, const typename FunctionMap<spacedim>::type &boundary_function, const Quadrature<dim-1> &q, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, + std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); + + /** + * Same as above, but for objects of type hp::DoFHandler + */ + template <int dim, int spacedim> + void project_boundary_values (const hp::MappingCollection<dim, spacedim> &mapping, + const hp::DoFHandler<dim,spacedim> &dof, + const typename FunctionMap<spacedim>::type &boundary_functions, + const hp::QCollection<dim-1> &q, + std::map<types::global_dof_index,double> &boundary_values, + std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); + + /** + * Calls the project_boundary_values() + * function, see above, with + * <tt>mapping=MappingQ1@<dim@>()</tt>. + */ + template <int dim, int spacedim> + void project_boundary_values (const hp::DoFHandler<dim,spacedim> &dof, + const typename FunctionMap<spacedim>::type &boundary_function, + const hp::QCollection<dim-1> &q, + std::map<types::global_dof_index,double> &boundary_values, std::vector<unsigned int> component_mapping = std::vector<unsigned int>()); /** 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 e598adf066..a501795529 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 @@ -128,10 +133,10 @@ namespace VectorTools // the following vector collects all rep dofs. // the position of a rep dof within this vector // is called rep index. - std::vector<std::vector<unsigned int> > dofs_of_rep_points(fe.size()); + std::vector<std::vector<types::global_dof_index> > dofs_of_rep_points(fe.size()); // the following table converts a dof i // to the rep index. - std::vector<std::vector<unsigned int> > dof_to_rep_index_table(fe.size()); + std::vector<std::vector<types::global_dof_index> > dof_to_rep_index_table(fe.size()); std::vector<unsigned int> n_rep_points (fe.size(), 0); @@ -173,7 +178,7 @@ namespace VectorTools const unsigned int max_rep_points = *std::max_element (n_rep_points.begin(), n_rep_points.end()); - std::vector<unsigned int> dofs_on_cell (fe.max_dofs_per_cell()); + std::vector<types::global_dof_index> dofs_on_cell (fe.max_dofs_per_cell()); std::vector<Point<DH::space_dimension> > rep_points (max_rep_points); // get space for the values of the @@ -287,8 +292,8 @@ namespace VectorTools Vector<double> cell_data_1(dof_1.get_fe().dofs_per_cell); Vector<double> cell_data_2(dof_2.get_fe().dofs_per_cell); - std::vector<short unsigned int> touch_count (dof_2.n_dofs(), 0); - std::vector<unsigned int> local_dof_indices (dof_2.get_fe().dofs_per_cell); + std::vector<short unsigned int> touch_count (dof_2.n_dofs(), 0); //TODO: check on datatype... kinda strange (UK) + std::vector<types::global_dof_index> local_dof_indices (dof_2.get_fe().dofs_per_cell); typename DoFHandler<dim,spacedim>::active_cell_iterator h = dof_1.begin_active(); typename DoFHandler<dim,spacedim>::active_cell_iterator l = dof_2.begin_active(); @@ -329,57 +334,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 <class DH> void - interpolate_zero_boundary_values (const dealii::DoFHandler<1> &dof_handler, - std::map<unsigned int,double> &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; i<dof_handler.get_fe().dofs_per_vertex; ++i) - boundary_values[cell->vertex_dof_index (direction, i)] = 0.; - } - } - - - - // codimension 1 - void - interpolate_zero_boundary_values (const dealii::DoFHandler<1,2> &dof_handler, - std::map<unsigned int,double> &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; i<dof_handler.get_fe().dofs_per_vertex; ++i) - boundary_values[cell->vertex_dof_index (direction, i)] = 0.; - } - } - - - - template <int dim, int spacedim> - void - interpolate_zero_boundary_values (const dealii::DoFHandler<dim,spacedim> &dof_handler, - std::map<unsigned int,double> &boundary_values) + interpolate_zero_boundary_values (const DH &dof_handler, + std::map<types::global_dof_index,double> &boundary_values) { - const FiniteElement<dim,spacedim> &fe = dof_handler.get_fe(); + const unsigned int dim = DH::dimension; // loop over all boundary faces // to get all dof indices of @@ -402,16 +367,18 @@ namespace VectorTools // that is actually wholly on // the boundary, not only by // one line or one vertex - typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator + typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); - std::vector<unsigned int> face_dof_indices (fe.dofs_per_face); + std::vector<types::global_dof_index> face_dof_indices; for (; cell!=endc; ++cell) for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f) if (cell->at_boundary(f)) { - cell->face(f)->get_dof_indices (face_dof_indices); - for (unsigned int i=0; i<fe.dofs_per_face; ++i) + face_dof_indices.resize (cell->get_fe().dofs_per_face); + cell->face(f)->get_dof_indices (face_dof_indices, + cell->active_fe_index()); + for (unsigned int i=0; i<cell->get_fe().dofs_per_face; ++i) // enter zero boundary values // for all boundary nodes // @@ -531,132 +498,185 @@ namespace VectorTools } - - template <int dim, class VECTOR, int spacedim> - void project (const Mapping<dim, spacedim> &mapping, - const DoFHandler<dim,spacedim> &dof, - const ConstraintMatrix &constraints, - const Quadrature<dim> &quadrature, - const Function<spacedim> &function, - VECTOR &vec_result, - const bool enforce_zero_boundary, - const Quadrature<dim-1> &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<unsigned int,double> 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<spacedim>::type boundary_functions; - for (types::boundary_id c=0; c<numbers::internal_face_boundary_id; ++c) - boundary_functions[c] = &function; - project_boundary_values (dof, boundary_functions, q_boundary, - boundary_values); - } + /** + * Compute the boundary values to be used in the project() functions. + */ + template <int dim, int spacedim, + template <int,int> class DH, + template <int,int> class M_or_MC, + template <int> class Q_or_QC> + void project_compute_b_v (const M_or_MC<dim, spacedim> &mapping, + const DH<dim,spacedim> &dof, + const Function<spacedim> &function, + const bool enforce_zero_boundary, + const Q_or_QC<dim-1> &q_boundary, + const bool project_to_boundary_first, + std::map<types::global_dof_index,double> &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<types::boundary_id> + used_boundary_indicators = dof.get_tria().get_boundary_indicators(); + + typename FunctionMap<spacedim>::type boundary_functions; + for (unsigned int i=0; i<used_boundary_indicators.size(); ++i) + boundary_functions[used_boundary_indicators[i]] = &function; + project_boundary_values (mapping, dof, boundary_functions, q_boundary, + boundary_values); + } + } - // set up mass matrix and right hand side - Vector<double> 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<types::global_dof_index,double> &boundary_values) { - for (std::map<unsigned int,double>::iterator it=boundary_values.begin(); + for (std::map<types::global_dof_index,double>::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<double> mass_matrix (sparsity); - Vector<double> 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 <int dim, int spacedim, + class Vector, + template <int,int> class DH, + template <int,int> class M_or_MC, + template <int> class Q_or_QC> + void do_project (const M_or_MC<dim, spacedim> &mapping, + const DH<dim,spacedim> &dof, + const ConstraintMatrix &constraints, + const Q_or_QC<dim> &quadrature, + const Function<spacedim> &function, + Vector &vec_result, + const bool enforce_zero_boundary, + const Q_or_QC<dim-1> &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<types::global_dof_index,double> 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<double> vec (dof.n_dofs()); + SparsityPattern sparsity; { - const Function<spacedim>* 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<double> mass_matrix (sparsity); + dealii::Vector<double> 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<spacedim> *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<double> and that wouldn't - // necessarily go together with the matrix and other functions - for (unsigned int i=0; i<vec.size(); ++i) - vec_result(i) = vec(i); + // copy vec into vec_result. we can't use vec_result itself above, since + // it may be of another type than Vector<double> and that wouldn't + // necessarily go together with the matrix and other functions + for (unsigned int i=0; i<vec.size(); ++i) + vec_result(i) = vec(i); + } + } + + + template <int dim, class VECTOR, int spacedim> + void project (const Mapping<dim, spacedim> &mapping, + const DoFHandler<dim,spacedim> &dof, + const ConstraintMatrix &constraints, + const Quadrature<dim> &quadrature, + const Function<spacedim> &function, + VECTOR &vec_result, + const bool enforce_zero_boundary, + const Quadrature<dim-1> &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 +696,39 @@ namespace VectorTools + template <int dim, class VECTOR, int spacedim> + void project (const hp::MappingCollection<dim, spacedim> &mapping, + const hp::DoFHandler<dim,spacedim> &dof, + const ConstraintMatrix &constraints, + const hp::QCollection<dim> &quadrature, + const Function<spacedim> &function, + VECTOR &vec_result, + const bool enforce_zero_boundary, + const hp::QCollection<dim-1> &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 <int dim, class VECTOR, int spacedim> + void project (const hp::DoFHandler<dim,spacedim> &dof, + const ConstraintMatrix &constraints, + const hp::QCollection<dim> &quadrature, + const Function<spacedim> &function, + VECTOR &vec, + const bool enforce_zero_boundary, + const hp::QCollection<dim-1> &q_boundary, + const bool project_to_boundary_first) + { + project(hp::StaticMappingQ1<dim,spacedim>::mapping_collection, + dof, constraints, quadrature, function, vec, + enforce_zero_boundary, q_boundary, project_to_boundary_first); + } + template <int dim, int spacedim> void create_right_hand_side (const Mapping<dim, spacedim> &mapping, @@ -700,7 +753,7 @@ namespace VectorTools n_q_points = fe_values.n_quadrature_points, n_components = fe.n_components(); - std::vector<unsigned int> dofs (dofs_per_cell); + std::vector<types::global_dof_index> dofs (dofs_per_cell); Vector<double> cell_vector (dofs_per_cell); typename DoFHandler<dim,spacedim>::active_cell_iterator @@ -822,7 +875,7 @@ namespace VectorTools const unsigned int n_components = fe.n_components(); - std::vector<unsigned int> dofs (fe.max_dofs_per_cell()); + std::vector<types::global_dof_index> dofs (fe.max_dofs_per_cell()); Vector<double> cell_vector (fe.max_dofs_per_cell()); typename hp::DoFHandler<dim,spacedim>::active_cell_iterator @@ -965,7 +1018,7 @@ namespace VectorTools const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); cell_point.first->get_dof_indices (local_dof_indices); for (unsigned int i=0; i<dofs_per_cell; i++) @@ -1009,7 +1062,7 @@ namespace VectorTools const unsigned int dofs_per_cell = cell_point.first->get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); cell_point.first->get_dof_indices (local_dof_indices); for (unsigned int i=0; i<dofs_per_cell; i++) @@ -1058,7 +1111,7 @@ namespace VectorTools const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); cell_point.first->get_dof_indices (local_dof_indices); for (unsigned int i=0; i<dofs_per_cell; i++) @@ -1105,7 +1158,7 @@ namespace VectorTools const unsigned int dofs_per_cell = cell_point.first->get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); cell_point.first->get_dof_indices (local_dof_indices); for (unsigned int i=0; i<dofs_per_cell; i++) @@ -1183,7 +1236,7 @@ namespace VectorTools n_q_points = fe_values.n_quadrature_points, n_components = fe.n_components(); - std::vector<unsigned int> dofs (dofs_per_cell); + std::vector<types::global_dof_index> dofs (dofs_per_cell); Vector<double> cell_vector (dofs_per_cell); typename DoFHandler<dim,spacedim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -1350,7 +1403,7 @@ namespace VectorTools const unsigned int n_components = fe.n_components(); - std::vector<unsigned int> dofs (fe.max_dofs_per_cell()); + std::vector<types::global_dof_index> dofs (fe.max_dofs_per_cell()); Vector<double> cell_vector (fe.max_dofs_per_cell()); typename hp::DoFHandler<dim,spacedim>::active_cell_iterator @@ -1479,7 +1532,7 @@ namespace VectorTools // ----------- interpolate_boundary_values for std::map -------------------- - namespace internal + namespace { // interpolate boundary values in // 1d. in higher dimensions, we @@ -1488,12 +1541,13 @@ namespace VectorTools // faces are points and it is far // easier to simply work on // individual vertices - template <class DH> + template <class DH, + template <int,int> class M_or_MC> static inline - void interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension> &, + void do_interpolate_boundary_values (const M_or_MC<DH::dimension, DH::space_dimension> &, const DH &dof, const typename FunctionMap<DH::space_dimension>::type &function_map, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask, const dealii::internal::int2type<1>) { @@ -1566,13 +1620,14 @@ namespace VectorTools - template <class DH> + template <class DH, + template <int,int> class M_or_MC> static inline void - interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension> &mapping, + do_interpolate_boundary_values (const M_or_MC<DH::dimension, DH::space_dimension> &mapping, const DH &dof, const typename FunctionMap<DH::space_dimension>::type &function_map, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask, const dealii::internal::int2type<DH::dimension>) { @@ -1603,7 +1658,7 @@ namespace VectorTools ExcDimensionMismatch(n_components, i->second->n_components)); // field to store the indices - std::vector<unsigned int> face_dofs; + std::vector<types::global_dof_index> face_dofs; face_dofs.reserve (DoFTools::max_dofs_per_face(dof)); std::vector<Point<spacedim> > dof_locations; @@ -1917,11 +1972,10 @@ namespace VectorTools interpolate_boundary_values (const Mapping<DH::dimension, DH::space_dimension> &mapping, const DH &dof, const typename FunctionMap<DH::space_dimension>::type &function_map, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &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<DH::dimension>()); } @@ -1934,7 +1988,7 @@ namespace VectorTools const DH &dof, const types::boundary_id boundary_component, const Function<DH::space_dimension> &boundary_function, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask) { typename FunctionMap<DH::space_dimension>::type function_map; @@ -1944,13 +1998,27 @@ namespace VectorTools } + template <int dim, int spacedim> + void + interpolate_boundary_values (const hp::MappingCollection<dim,spacedim> &mapping, + const hp::DoFHandler<dim,spacedim> &dof, + const typename FunctionMap<spacedim>::type &function_map, + std::map<types::global_dof_index,double> &boundary_values, + const ComponentMask &component_mask_) + { + do_interpolate_boundary_values (mapping, dof, function_map, boundary_values, + component_mask_, + dealii::internal::int2type<dim>()); + } + + template <class DH> void interpolate_boundary_values (const DH &dof, const types::boundary_id boundary_component, const Function<DH::space_dimension> &boundary_function, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask) { interpolate_boundary_values(StaticMappingQ1<DH::dimension,DH::space_dimension>::mapping, @@ -1964,7 +2032,7 @@ namespace VectorTools void interpolate_boundary_values (const DH &dof, const typename FunctionMap<DH::space_dimension>::type &function_map, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, const ComponentMask &component_mask) { interpolate_boundary_values(StaticMappingQ1<DH::dimension,DH::space_dimension>::mapping, @@ -1988,10 +2056,10 @@ namespace VectorTools ConstraintMatrix &constraints, const ComponentMask &component_mask_) { - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; interpolate_boundary_values (mapping, dof, function_map, boundary_values, component_mask_); - std::map<unsigned int,double>::const_iterator boundary_value = + std::map<types::global_dof_index,double>::const_iterator boundary_value = boundary_values.begin(); for ( ; boundary_value !=boundary_values.end(); ++boundary_value) { @@ -2060,211 +2128,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<unsigned int,double> &boundary_values, - std::vector<unsigned int> 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<unsigned int,double> &boundary_values, - std::vector<unsigned int> 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 <int dim, int spacedim, + template <int,int> class DH, + template <int,int> class M_or_MC, + template <int> class Q_or_QC> + void + do_project_boundary_values (const M_or_MC<dim, spacedim> &mapping, + const DH<dim, spacedim> &dof, + const typename FunctionMap<spacedim>::type &boundary_functions, + const Q_or_QC<dim-1> &q, + std::map<types::global_dof_index,double> &boundary_values, + std::vector<unsigned int> 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<types::global_dof_index> dof_to_boundary_mapping; + std::set<types::boundary_id> selected_boundary_components; + for (typename FunctionMap<spacedim>::type::const_iterator i=boundary_functions.begin(); + i!=boundary_functions.end(); ++i) + selected_boundary_components.insert (i->first); - template <int dim, int spacedim> - void - project_boundary_values (const Mapping<dim, spacedim> &mapping, - const DoFHandler<dim, spacedim> &dof, - const typename FunctionMap<spacedim>::type &boundary_functions, - const Quadrature<dim-1> &q, - std::map<unsigned int,double> &boundary_values, - std::vector<unsigned int> 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<unsigned int> dof_to_boundary_mapping; - std::set<types::boundary_id> selected_boundary_components; - for (typename FunctionMap<spacedim>::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<dim,spacedim>::active_cell_iterator cell = dof.begin_active(); - cell != dof.end(); ++cell) - for (unsigned int f=0; f<GeometryInfo<dim>::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<dim,spacedim>::active_cell_iterator cell = dof.begin_active(); + cell != dof.end(); ++cell) + for (unsigned int f=0; f<GeometryInfo<dim>::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<double> mass_matrix(sparsity); - Vector<double> rhs(sparsity.n_rows()); + // make mass matrix and right hand side + SparseMatrix<double> mass_matrix(sparsity); + Vector<double> rhs(sparsity.n_rows()); - MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, - mass_matrix, boundary_functions, - rhs, dof_to_boundary_mapping, (const Function<spacedim> *) 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. + MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, + mass_matrix, boundary_functions, + rhs, dof_to_boundary_mapping, (const Function<spacedim> *) 0, + component_mapping); - // The Bogner-Fox-Schmidt element - // is an example for those. + // 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. //TODO: Maybe we should figure out if the element really needs this - FilteredMatrix<Vector<double> > filtered_mass_matrix(mass_matrix, true); - FilteredMatrix<Vector<double> > filtered_precondition; - std::vector<bool> excluded_dofs(mass_matrix.m(), false); + FilteredMatrix<Vector<double> > filtered_mass_matrix(mass_matrix, true); + FilteredMatrix<Vector<double> > filtered_precondition; + std::vector<bool> excluded_dofs(mass_matrix.m(), false); - double max_element = 0.; - for (unsigned int i=0; i<mass_matrix.m(); ++i) - if (mass_matrix.diag_element(i) > max_element) - max_element = mass_matrix.diag_element(i); + double max_element = 0.; + for (unsigned int i=0; i<mass_matrix.m(); ++i) + if (mass_matrix.diag_element(i) > max_element) + max_element = mass_matrix.diag_element(i); - for (unsigned int i=0; i<mass_matrix.m(); ++i) - if (mass_matrix.diag_element(i) < 1.e-8 * max_element) - { - filtered_mass_matrix.add_constraint(i, 0.); - filtered_precondition.add_constraint(i, 0.); - mass_matrix.diag_element(i) = 1.; - excluded_dofs[i] = true; - } + for (unsigned int i=0; i<mass_matrix.m(); ++i) + if (mass_matrix.diag_element(i) < 1.e-8 * max_element) + { + filtered_mass_matrix.add_constraint(i, 0.); + filtered_precondition.add_constraint(i, 0.); + mass_matrix.diag_element(i) = 1.; + excluded_dofs[i] = true; + } - Vector<double> 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<dof_to_boundary_mapping.size(); ++i) - if (dof_to_boundary_mapping[i] != DoFHandler<dim,spacedim>::invalid_dof_index - && ! excluded_dofs[dof_to_boundary_mapping[i]]) - { - Assert(numbers::is_finite(boundary_projection(dof_to_boundary_mapping[i])), ExcNumberNotFinite()); + Vector<double> 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<dof_to_boundary_mapping.size(); ++i) + if (dof_to_boundary_mapping[i] != DoFHandler<dim,spacedim>::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 <int dim, int spacedim> + void + project_boundary_values (const Mapping<dim, spacedim> &mapping, + const DoFHandler<dim, spacedim> &dof, + const typename FunctionMap<spacedim>::type &boundary_functions, + const Quadrature<dim-1> &q, + std::map<types::global_dof_index,double> &boundary_values, + std::vector<unsigned int> component_mapping) + { + do_project_boundary_values(mapping, dof, boundary_functions, q, + boundary_values, component_mapping); } @@ -2274,7 +2332,7 @@ namespace VectorTools project_boundary_values (const DoFHandler<dim,spacedim> &dof, const typename FunctionMap<spacedim>::type &boundary_functions, const Quadrature<dim-1> &q, - std::map<unsigned int,double> &boundary_values, + std::map<types::global_dof_index,double> &boundary_values, std::vector<unsigned int> component_mapping) { project_boundary_values(StaticMappingQ1<dim,spacedim>::mapping, dof, boundary_functions, q, @@ -2283,7 +2341,37 @@ namespace VectorTools -// ----- implementation for project_boundary_values with ConstraintMatrix ----- + template <int dim, int spacedim> + void project_boundary_values (const hp::MappingCollection<dim, spacedim> &mapping, + const hp::DoFHandler<dim,spacedim> &dof, + const typename FunctionMap<spacedim>::type &boundary_functions, + const hp::QCollection<dim-1> &q, + std::map<types::global_dof_index,double> &boundary_values, + std::vector<unsigned int> component_mapping) + { + do_project_boundary_values (mapping, dof, + boundary_functions, + q, boundary_values, + component_mapping); + } + + + + template <int dim, int spacedim> + void project_boundary_values (const hp::DoFHandler<dim,spacedim> &dof, + const typename FunctionMap<spacedim>::type &boundary_function, + const hp::QCollection<dim-1> &q, + std::map<types::global_dof_index,double> &boundary_values, + std::vector<unsigned int> component_mapping) + { + project_boundary_values (hp::StaticMappingQ1<dim,spacedim>::mapping_collection, dof, + boundary_function, + q, boundary_values, + component_mapping); + } + + + // ----- implementation for project_boundary_values with ConstraintMatrix ----- @@ -2296,10 +2384,10 @@ namespace VectorTools ConstraintMatrix &constraints, std::vector<unsigned int> component_mapping) { - std::map<unsigned int,double> boundary_values; + std::map<types::global_dof_index,double> boundary_values; project_boundary_values (mapping, dof, boundary_functions, q, boundary_values, component_mapping); - std::map<unsigned int,double>::const_iterator boundary_value = + std::map<types::global_dof_index,double>::const_iterator boundary_value = boundary_values.begin(); for ( ; boundary_value !=boundary_values.end(); ++boundary_value) { @@ -2340,12 +2428,12 @@ namespace VectorTools template <int dim> struct VectorDoFTuple { - unsigned int dof_indices[dim]; + types::global_dof_index dof_indices[dim]; VectorDoFTuple () { for (unsigned int i=0; i<dim; ++i) - dof_indices[i] = numbers::invalid_unsigned_int; + dof_indices[i] = numbers::invalid_dof_index; } @@ -3353,7 +3441,7 @@ namespace VectorTools std::vector<bool> dofs_processed (dofs_per_face); std::vector<double> dof_values (dofs_per_face); - std::vector<unsigned int> face_dof_indices (dofs_per_face); + std::vector<types::global_dof_index> face_dof_indices (dofs_per_face); typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active (); switch (dim) @@ -3563,7 +3651,7 @@ namespace VectorTools update_values); std::vector<bool> dofs_processed; std::vector<double> dof_values; - std::vector<unsigned int> face_dof_indices; + std::vector<types::global_dof_index> face_dof_indices; typename hp::DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active (); switch (dim) @@ -3802,7 +3890,7 @@ namespace VectorTools * fe_values[vec].value (fe.face_to_cell_index (i, face), q_point)); } - std::vector<unsigned int> face_dof_indices (fe.dofs_per_face); + std::vector<types::global_dof_index> face_dof_indices (fe.dofs_per_face); cell->face (face)->get_dof_indices (face_dof_indices, cell->active_fe_index ()); @@ -3849,7 +3937,7 @@ namespace VectorTools const Function<3> &boundary_function, const std::vector<DerivativeForm<1,3,3> > &jacobians, std::vector<double> &dof_values, - std::vector<unsigned int> &projected_dofs) + std::vector<types::global_dof_index> &projected_dofs) { // Compute the intergral over // the product of the normal @@ -3906,7 +3994,7 @@ namespace VectorTools * fe_values[vec].value (fe.face_to_cell_index (i, face), q_point)); } - std::vector<unsigned int> face_dof_indices (fe.dofs_per_face); + std::vector<types::global_dof_index> face_dof_indices (fe.dofs_per_face); cell->face (face)->get_dof_indices (face_dof_indices, cell->active_fe_index ()); @@ -3930,7 +4018,7 @@ namespace VectorTools const Function<dim> &, const std::vector<DerivativeForm<1,dim,dim> > &, std::vector<double> &, - std::vector<unsigned int> &) + std::vector<types::global_dof_index> &) { Assert (false, ExcNotImplemented ()); } @@ -4045,7 +4133,7 @@ namespace VectorTools // compute a second one. const unsigned int &n_dofs = dof_handler.n_dofs (); std::vector<double> dof_values (n_dofs); - std::vector<unsigned int> projected_dofs (n_dofs); + std::vector<types::global_dof_index> projected_dofs (n_dofs); for (unsigned int dof = 0; dof < n_dofs; ++dof) projected_dofs[dof] = 0; @@ -4182,7 +4270,7 @@ namespace VectorTools { const unsigned int &n_dofs = dof_handler.n_dofs (); std::vector<double> dof_values (n_dofs); - std::vector<unsigned int> projected_dofs (n_dofs); + std::vector<types::global_dof_index> projected_dofs (n_dofs); for (unsigned int dof = 0; dof < n_dofs; ++dof) projected_dofs[dof] = 0; @@ -4254,7 +4342,7 @@ namespace VectorTools "to imposing Dirichlet values on the vector-valued " "quantity.")); - std::vector<unsigned int> face_dofs; + std::vector<types::global_dof_index> face_dofs; // create FE and mapping collections for all elements in use by this // DoFHandler @@ -5424,7 +5512,7 @@ namespace VectorTools subtract_mean_value(VECTOR &v, const std::vector<bool> &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 +5522,12 @@ namespace VectorTools // This function is not implemented for distributed vectors, so // if v is not a boring Vector or BlockVector: Assert( dynamic_cast<Vector<double> *>(& v) - || dynamic_cast<Vector<float> *>(& v) - || dynamic_cast<Vector<long double> *>(& v) - || dynamic_cast<BlockVector<double> *>(& v) - || dynamic_cast<BlockVector<float> *>(& v) - || dynamic_cast<BlockVector<long double> *>(& v), - ExcNotImplemented()); + || dynamic_cast<Vector<float> *>(& v) + || dynamic_cast<Vector<long double> *>(& v) + || dynamic_cast<BlockVector<double> *>(& v) + || dynamic_cast<BlockVector<float> *>(& v) + || dynamic_cast<BlockVector<long double> *>(& v), + ExcNotImplemented()); const unsigned int n = v.size(); diff --git a/deal.II/source/CMakeLists.txt b/deal.II/source/CMakeLists.txt index 3118888674..96c55ff3db 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. ## -## <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> -## -##### +## --------------------------------------------------------------------- # # 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) @@ -63,6 +67,8 @@ FOREACH(build ${DEAL_II_BUILD_TYPES}) ${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,7 +78,7 @@ 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}" diff --git a/deal.II/source/algorithms/CMakeLists.txt b/deal.II/source/algorithms/CMakeLists.txt index 3a382d7c8f..c77a4e71cf 100644 --- a/deal.II/source/algorithms/CMakeLists.txt +++ b/deal.II/source/algorithms/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/base/parameter_handler.h> #include <deal.II/base/logstream.h> 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 <deal.II/algorithms/timestep_control.h> #include <deal.II/base/parameter_handler.h> diff --git a/deal.II/source/base/CMakeLists.txt b/deal.II/source/base/CMakeLists.txt index 5269d6c64e..d60e54902c 100644 --- a/deal.II/source/base/CMakeLists.txt +++ b/deal.II/source/base/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. ## -## <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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/base/point.h> #include <deal.II/base/auto_derivative_function.h> 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 <deal.II/base/conditional_ostream.h> 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 <deal.II/base/config.h> #include <cmath> 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 <deal.II/base/convergence_table.h> #include <cmath> @@ -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<n; ++i) { - if(i == 0) + if (i == 0) { // no value available for the first row add_value(rate_key, std::string("-")); @@ -85,7 +87,7 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column // Calculate all missing rate values: for (unsigned int i = no_rate_entries; i<n; ++i) { - if(i == 0) + if (i == 0) { // no value available for the first row add_value(rate_key, std::string("-")); @@ -113,7 +115,7 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column } // only add rate_key to the supercolumn once - if(no_rate_entries == 0) + if (no_rate_entries == 0) { add_column_to_supercolumn(rate_key, superkey); } @@ -154,7 +156,7 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key, // Calculate all missing rate values: for (unsigned int i = no_rate_entries; i<n; ++i) { - if(i == 0) + if (i == 0) { // no value available for the first row add_value(rate_key, std::string("-")); @@ -172,7 +174,7 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key, // Calculate all missing rate values: for (unsigned int i = no_rate_entries; i<n; ++i) { - if(i == 0) + if (i == 0) { // no value available for the first row add_value(rate_key, std::string("-")); @@ -203,7 +205,7 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key, } // only add rate_key to the supercolumn once - if(no_rate_entries == 0) + if (no_rate_entries == 0) { add_column_to_supercolumn(rate_key, superkey); } diff --git a/deal.II/source/base/data_out_base.cc b/deal.II/source/base/data_out_base.cc index 6e414d7e1f..1638903344 100644 --- a/deal.II/source/base/data_out_base.cc +++ b/deal.II/source/base/data_out_base.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. +// +// --------------------------------------------------------------------- + //TODO: Do neighbors for dx and povray smooth triangles @@ -300,9 +304,13 @@ namespace }; #endif - static unsigned int vtk_cell_type[4] = + // NOTE: (UK) The dimension of the array is choosen to 5 to allow the choice + // DataOutBase<deal_II_dimension,deal_II_dimension+1> 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<unsigned int>(-1) }; //----------------------------------------------------------------------// @@ -2214,17 +2222,17 @@ 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) + height_vector(height_vector), + azimuth_angle(azimuth_angle), + polar_angle(polar_angle), + line_thickness(line_thickness), + margin(margin), + draw_colorbar(draw_colorbar) {} @@ -2537,17 +2545,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 +2578,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 +2634,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 +2690,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 +2744,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]; @@ -5325,7 +5333,7 @@ void DataOutBase::write_vtu_main (const std::vector<Patch<dim,spacedim> > &patch if (n_metadata > 0) out << "</FieldData>\n"; -} + } VtuStream vtu_out(out, flags); @@ -5598,7 +5606,7 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &patches, // 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 +5627,8 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &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 +5642,55 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &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) - { - 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)); - } + 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 +5770,7 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &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 +5782,8 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &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 +5801,69 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &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<spacedim> 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<spacedim> 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 +5872,360 @@ void DataOutBase::write_svg (const std::vector<Patch<dim,spacedim> > &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<spacedim> 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<spacedim> 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<unsigned int>(.5 + height * (x_dimension_perspective / y_dimension_perspective)); unsigned int additional_width = 0; - if(flags.draw_colorbar) additional_width = static_cast<unsigned int>(.5 + height * .3); // additional width for colorbar - + if (flags.draw_colorbar) additional_width = static_cast<unsigned int>(.5 + height * .3); // additional width for colorbar + // basic svg header and background rectangle - out << "<svg width=\"" << width + additional_width << "\" height=\"" << height << "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" << '\n' + out << "<svg width=\"" << width + additional_width << "\" height=\"" << height << "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" << '\n' << " <rect width=\"" << width + additional_width << "\" height=\"" << height << "\" style=\"fill:white\"/>" << '\n' << '\n'; unsigned int triangle_counter = 0; - + // write the cells in the correct order for (typename std::multiset<SvgCell>::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]; - Point<6> gradient_param = svg_get_gradient_parameters(points3d_triangle); + 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; + } - double start_h = .667 - ((gradient_param[4] - z_min) / z_dimension) * .667; - double stop_h = .667 - ((gradient_param[5] - z_min) / z_dimension) * .667; + Point<6> gradient_param = svg_get_gradient_parameters(points3d_triangle); - unsigned int start_r = 0; - unsigned int start_g = 0; - unsigned int start_b = 0; + 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 stop_r = 0; - unsigned int stop_g = 0; - unsigned int stop_b = 0; + unsigned int start_r = 0; + unsigned int start_g = 0; + unsigned int start_b = 0; - unsigned int start_i = static_cast<unsigned int>(start_h * 6.); - unsigned int stop_i = static_cast<unsigned int>(stop_h * 6.); + unsigned int stop_r = 0; + unsigned int stop_g = 0; + unsigned int stop_b = 0; - double start_f = start_h * 6. - start_i; - double start_q = 1. - start_f; + unsigned int start_i = static_cast<unsigned int>(start_h * 6.); + unsigned int stop_i = static_cast<unsigned int>(stop_h * 6.); - double stop_f = stop_h * 6. - stop_i; - double stop_q = 1. - stop_f; + double start_f = start_h * 6. - start_i; + double start_q = 1. - start_f; - switch (start_i % 6) - { - case 0: start_r = 255, start_g = static_cast<unsigned int>(.5 + 255. * start_f); break; - case 1: start_r = static_cast<unsigned int>(.5 + 255. * start_q), start_g = 255; break; - case 2: start_g = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_f); break; - case 3: start_g = static_cast<unsigned int>(.5 + 255. * start_q), start_b = 255; break; - case 4: start_r = static_cast<unsigned int>(.5 + 255. * start_f), start_b = 255; break; - case 5: start_r = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_q); break; - default: break; - } + double stop_f = stop_h * 6. - stop_i; + double stop_q = 1. - stop_f; - switch (stop_i % 6) - { - case 0: stop_r = 255, stop_g = static_cast<unsigned int>(.5 + 255. * stop_f); break; - case 1: stop_r = static_cast<unsigned int>(.5 + 255. * stop_q), stop_g = 255; break; - case 2: stop_g = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_f); break; - case 3: stop_g = static_cast<unsigned int>(.5 + 255. * stop_q), stop_b = 255; break; - case 4: stop_r = static_cast<unsigned int>(.5 + 255. * stop_f), stop_b = 255; break; - case 5: stop_r = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_q); break; - default: break; - } + switch (start_i % 6) + { + case 0: + start_r = 255, start_g = static_cast<unsigned int>(.5 + 255. * start_f); + break; + case 1: + start_r = static_cast<unsigned int>(.5 + 255. * start_q), start_g = 255; + break; + case 2: + start_g = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_f); + break; + case 3: + start_g = static_cast<unsigned int>(.5 + 255. * start_q), start_b = 255; + break; + case 4: + start_r = static_cast<unsigned int>(.5 + 255. * start_f), start_b = 255; + break; + case 5: + start_r = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_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 << " <linearGradient id=\"" << triangle_counter << "\" gradientUnits=\"userSpaceOnUse\" " - << "x1=\"" - << static_cast<unsigned int>(.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<unsigned int>(.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<unsigned int>(.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<unsigned int>(.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' - << " <stop offset=\"0\" style=\"stop-color:rgb(" << start_r << "," << start_g << "," << start_b << ")\"/>" << '\n' - << " <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r << "," << stop_g << "," << stop_b << ")\"/>" << '\n' - << " </linearGradient>" << '\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; - } + switch (stop_i % 6) + { + case 0: + stop_r = 255, stop_g = static_cast<unsigned int>(.5 + 255. * stop_f); + break; + case 1: + stop_r = static_cast<unsigned int>(.5 + 255. * stop_q), stop_g = 255; + break; + case 2: + stop_g = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_f); + break; + case 3: + stop_g = static_cast<unsigned int>(.5 + 255. * stop_q), stop_b = 255; + break; + case 4: + stop_r = static_cast<unsigned int>(.5 + 255. * stop_f), stop_b = 255; + break; + case 5: + stop_r = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_q); + break; + default: + break; + } - out << " <path d=\"M " - << static_cast<unsigned int>(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast<unsigned int>(.5 + ((x2 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((y2 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast<unsigned int>(.5 + ((x3 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((y3 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast<unsigned int>(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast<unsigned int>(.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++; + 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 << " <linearGradient id=\"" << triangle_counter << "\" gradientUnits=\"userSpaceOnUse\" " + << "x1=\"" + << static_cast<unsigned int>(.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<unsigned int>(.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<unsigned int>(.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<unsigned int>(.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' + << " <stop offset=\"0\" style=\"stop-color:rgb(" << start_r << "," << start_g << "," << start_b << ")\"/>" << '\n' + << " <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r << "," << stop_g << "," << stop_b << ")\"/>" << '\n' + << " </linearGradient>" << '\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 << " <path d=\"M " + << static_cast<unsigned int>(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast<unsigned int>(.5 + ((x2 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((y2 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast<unsigned int>(.5 + ((x3 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((y3 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast<unsigned int>(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast<unsigned int>(.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' << " <!-- colorbar -->" << '\n'; + { + out << '\n' << " <!-- colorbar -->" << '\n'; - unsigned int element_height = static_cast<unsigned int>(((height/100.) * (71. - 2.*margin_in_percent)) / 4); - unsigned int element_width = static_cast<unsigned int>(.5 + (height/100.) * 2.5); + unsigned int element_height = static_cast<unsigned int>(((height/100.) * (71. - 2.*margin_in_percent)) / 4); + unsigned int element_width = static_cast<unsigned int>(.5 + (height/100.) * 2.5); - additional_width = 0; - if (!flags.margin) additional_width = static_cast<unsigned int>(.5 + (height/100.) * 2.5); + additional_width = 0; + if (!flags.margin) additional_width = static_cast<unsigned int>(.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<unsigned int>(start_h * 6.); - unsigned int stop_i = static_cast<unsigned int>(stop_h * 6.); + unsigned int start_i = static_cast<unsigned int>(start_h * 6.); + unsigned int stop_i = static_cast<unsigned int>(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<unsigned int>(.5 + 255. * start_f); break; - case 1: start_r = static_cast<unsigned int>(.5 + 255. * start_q), start_g = 255; break; - case 2: start_g = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_f); break; - case 3: start_g = static_cast<unsigned int>(.5 + 255. * start_q), start_b = 255; break; - case 4: start_r = static_cast<unsigned int>(.5 + 255. * start_f), start_b = 255; break; - case 5: start_r = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_q); break; - default: break; - } + switch (start_i % 6) + { + case 0: + start_r = 255, start_g = static_cast<unsigned int>(.5 + 255. * start_f); + break; + case 1: + start_r = static_cast<unsigned int>(.5 + 255. * start_q), start_g = 255; + break; + case 2: + start_g = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_f); + break; + case 3: + start_g = static_cast<unsigned int>(.5 + 255. * start_q), start_b = 255; + break; + case 4: + start_r = static_cast<unsigned int>(.5 + 255. * start_f), start_b = 255; + break; + case 5: + start_r = 255, start_b = static_cast<unsigned int>(.5 + 255. * start_q); + break; + default: + break; + } - switch (stop_i % 6) - { - case 0: stop_r = 255, stop_g = static_cast<unsigned int>(.5 + 255. * stop_f); break; - case 1: stop_r = static_cast<unsigned int>(.5 + 255. * stop_q), stop_g = 255; break; - case 2: stop_g = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_f); break; - case 3: stop_g = static_cast<unsigned int>(.5 + 255. * stop_q), stop_b = 255; break; - case 4: stop_r = static_cast<unsigned int>(.5 + 255. * stop_f), stop_b = 255; break; - case 5: stop_r = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_q); break; - default: break; - } + switch (stop_i % 6) + { + case 0: + stop_r = 255, stop_g = static_cast<unsigned int>(.5 + 255. * stop_f); + break; + case 1: + stop_r = static_cast<unsigned int>(.5 + 255. * stop_q), stop_g = 255; + break; + case 2: + stop_g = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_f); + break; + case 3: + stop_g = static_cast<unsigned int>(.5 + 255. * stop_q), stop_b = 255; + break; + case 4: + stop_r = static_cast<unsigned int>(.5 + 255. * stop_f), stop_b = 255; + break; + case 5: + stop_r = 255, stop_b = static_cast<unsigned int>(.5 + 255. * stop_q); + break; + default: + break; + } - // define gradient - out << " <linearGradient id=\"colorbar_" << index << "\" gradientUnits=\"userSpaceOnUse\" " - << "x1=\"" << width + additional_width << "\" " - << "y1=\"" << static_cast<unsigned int>(.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height << "\" " - << "x2=\"" << width + additional_width << "\" " - << "y2=\"" << static_cast<unsigned int>(.5 + (height/100.) * (margin_in_percent + 29)) + (4-index) * element_height << "\"" - << ">" << '\n' - << " <stop offset=\"0\" style=\"stop-color:rgb(" << start_r << "," << start_g << "," << start_b << ")\"/>" << '\n' - << " <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r << "," << stop_g << "," << stop_b << ")\"/>" << '\n' - << " </linearGradient>" << '\n'; - - // draw box corresponding to the gradient above - out << " <rect" - << " x=\"" << width + additional_width - << "\" y=\"" << static_cast<unsigned int>(.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 << " <text x=\"" << width + additional_width + static_cast<unsigned int>(1.5 * element_width) - << "\" y=\"" << static_cast<unsigned int>(.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 << " <linearGradient id=\"colorbar_" << index << "\" gradientUnits=\"userSpaceOnUse\" " + << "x1=\"" << width + additional_width << "\" " + << "y1=\"" << static_cast<unsigned int>(.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height << "\" " + << "x2=\"" << width + additional_width << "\" " + << "y2=\"" << static_cast<unsigned int>(.5 + (height/100.) * (margin_in_percent + 29)) + (4-index) * element_height << "\"" + << ">" << '\n' + << " <stop offset=\"0\" style=\"stop-color:rgb(" << start_r << "," << start_g << "," << start_b << ")\"/>" << '\n' + << " <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r << "," << stop_g << "," << stop_b << ")\"/>" << '\n' + << " </linearGradient>" << '\n'; + + // draw box corresponding to the gradient above + out << " <rect" + << " x=\"" << width + additional_width + << "\" y=\"" << static_cast<unsigned int>(.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 << " <text x=\"" << width + additional_width + static_cast<unsigned int>(1.5 * element_width) + << "\" y=\"" << static_cast<unsigned int>(.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 << "</text>" << '\n'; + out << "</text>" << '\n'; + } } - } // finalize the svg file out << '\n' << "</svg>"; diff --git a/deal.II/source/base/dummy.cc b/deal.II/source/base/dummy.cc index aa82ba52fe..f7cb351468 100644 --- a/deal.II/source/base/dummy.cc +++ b/deal.II/source/base/dummy.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. +// +// --------------------------------------------------------------------- + /* * Workaround for a bug in the Xcode generator. * 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 <deal.II/base/event.h> 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 <deal.II/base/exceptions.h> #include <deal.II/base/logstream.h> 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 <deal.II/base/tensor.h> #include <deal.II/base/point.h> 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 <deal.II/base/function.h> #include <deal.II/base/tensor_function.h> @@ -591,7 +593,7 @@ vector_value (const Point<dim> &p, * to be size <tt>n_components</tt>. */ template <int dim> -VectorFunctionFromTensorFunction<dim>::VectorFunctionFromTensorFunction (const TensorFunction<1,dim>& tensor_function, +VectorFunctionFromTensorFunction<dim>::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 <deal.II/base/point.h> #include <deal.II/base/function_derivative.h> 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 <deal.II/base/tensor.h> #include <deal.II/base/point.h> 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 <deal.II/base/tensor.h> #include <deal.II/base/point.h> 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 <deal.II/base/function_parser.h> #include <deal.II/base/utilities.h> 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 <deal.II/base/function_time.h> diff --git a/deal.II/source/base/geometry_info.cc b/deal.II/source/base/geometry_info.cc index 60c190ee1e..b8223630f0 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 <deal.II/base/geometry_info.h> #include <deal.II/base/tensor.h> diff --git a/deal.II/source/base/index_set.cc b/deal.II/source/base/index_set.cc index 0767f106f9..bf373ddd5f 100644 --- a/deal.II/source/base/index_set.cc +++ b/deal.II/source/base/index_set.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/index_set.h> @@ -42,8 +44,8 @@ IndexSet::do_compress () const next = i; ++next; - unsigned int first_index = i->begin; - unsigned int last_index = i->end; + types::global_dof_index first_index = i->begin; + types::global_dof_index last_index = i->end; // see if we can merge any of // the following ranges @@ -72,7 +74,7 @@ IndexSet::do_compress () const // now compute indices within set and the // range with most elements - unsigned int next_index = 0, largest_range_size = 0; + types::global_dof_index next_index = 0, largest_range_size = 0; for (std::vector<Range>::iterator i = ranges.begin(); i != ranges.end(); @@ -174,8 +176,8 @@ IndexSet::n_intervals () const IndexSet -IndexSet::get_view (const unsigned int begin, - const unsigned int end) const +IndexSet::get_view (const types::global_dof_index begin, + const types::global_dof_index end) const { Assert (begin <= end, ExcMessage ("End index needs to be larger or equal to begin index!")); @@ -225,12 +227,15 @@ IndexSet::write(std::ostream &out) const void IndexSet::read(std::istream &in) { - unsigned int s, numranges, b, e; + types::global_dof_index s; + unsigned int numranges; + in >> s >> numranges; ranges.clear(); set_size(s); for (unsigned int i=0; i<numranges; ++i) { + types::global_dof_index b, e; in >> b >> e; add_range(b,e); } @@ -255,7 +260,7 @@ IndexSet::block_write(std::ostream &out) const void IndexSet::block_read(std::istream &in) { - unsigned int size; + types::global_dof_index size; size_t n_ranges; in.read(reinterpret_cast<char *>(&size), sizeof(size)); in.read(reinterpret_cast<char *>(&n_ranges), sizeof(n_ranges)); @@ -351,7 +356,7 @@ IndexSet::subtract_set (const IndexSet &other) } -void IndexSet::fill_index_vector(std::vector<unsigned int> &indices) const +void IndexSet::fill_index_vector(std::vector<types::global_dof_index> &indices) const { compress(); @@ -361,7 +366,7 @@ void IndexSet::fill_index_vector(std::vector<unsigned int> &indices) const for (std::vector<Range>::iterator it = ranges.begin(); it != ranges.end(); ++it) - for (unsigned int i=it->begin; i<it->end; ++i) + for (types::global_dof_index i=it->begin; i<it->end; ++i) indices.push_back (i); Assert (indices.size() == n_elements(), ExcInternalError()); @@ -380,8 +385,8 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator, compress (); if ((is_contiguous() == true) && (!overlapping)) - return Epetra_Map (static_cast<int>(size()), - static_cast<int>(n_elements()), + return Epetra_Map (TrilinosWrappers::types::int_type(size()), + TrilinosWrappers::types::int_type(n_elements()), 0, #ifdef DEAL_II_WITH_MPI Epetra_MpiComm(communicator)); @@ -390,14 +395,14 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator, #endif else { - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; fill_index_vector(indices); - return Epetra_Map (-1, - static_cast<int>(n_elements()), + return Epetra_Map (TrilinosWrappers::types::int_type(-1), + TrilinosWrappers::types::int_type(n_elements()), (n_elements() > 0 ? - reinterpret_cast<int *>(&indices[0]) + reinterpret_cast<TrilinosWrappers::types::int_type *>(&indices[0]) : 0), 0, @@ -417,9 +422,9 @@ IndexSet::make_trilinos_map (const MPI_Comm &communicator, std::size_t IndexSet::memory_consumption () const { - return MemoryConsumption::memory_consumption (ranges) + - MemoryConsumption::memory_consumption (is_compressed) + - MemoryConsumption::memory_consumption (index_space_size); + return (MemoryConsumption::memory_consumption (ranges) + + MemoryConsumption::memory_consumption (is_compressed) + + MemoryConsumption::memory_consumption (index_space_size)); } 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 <deal.II/base/job_identifier.h> #include <ctime> diff --git a/deal.II/source/base/logstream.cc b/deal.II/source/base/logstream.cc index e0fc350cf5..ba7f8773f3 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 <deal.II/base/logstream.h> #include <deal.II/base/job_identifier.h> @@ -147,10 +149,10 @@ LogStream::operator<< (std::ostream& (*p) (std::ostream &)) if (at_newline) print_line_head(); - if(p == p_flush) + if (p == p_flush) at_newline = false; - if(p == p_endl) + if (p == p_endl) at_newline = true; if (get_prefixes().size() <= std_depth) @@ -226,14 +228,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 +252,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 +352,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<std::stack<std::string> > &impl = prefixes.get_implementation(); @@ -436,7 +446,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 +464,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 <deal.II/base/memory_consumption.h> diff --git a/deal.II/source/base/mpi.cc b/deal.II/source/base/mpi.cc index 4a1c99c7bb..663d647dad 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 <deal.II/base/mpi.h> #include <deal.II/base/utilities.h> @@ -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,8 +334,8 @@ 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, @@ -418,8 +422,8 @@ 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 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 <deal.II/base/multithread_info.h> #include <deal.II/base/utilities.h> @@ -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 <deal.II/base/parallel.h> diff --git a/deal.II/source/base/parameter_handler.cc b/deal.II/source/base/parameter_handler.cc index 6268cca617..6a8c426d4e 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 <deal.II/base/parameter_handler.h> #include <deal.II/base/logstream.h> @@ -1081,20 +1085,20 @@ ParameterHandler::mangle (const std::string &s) for (unsigned int i=0; i<s.size(); ++i) { static const std::string allowed_characters - ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); if ((! mangle_whole_string) - && - (allowed_characters.find (s[i]) != std::string::npos)) - u.push_back (s[i]); + && + (allowed_characters.find (s[i]) != std::string::npos)) + u.push_back (s[i]); else - { - 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<unsigned char>(s[i])/16]); - u.push_back (hex[static_cast<unsigned char>(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<unsigned char>(s[i])/16]); + u.push_back (hex[static_cast<unsigned char>(s[i])%16]); + } } return u; 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 <deal.II/base/parsed_function.h> #include <deal.II/base/utilities.h> diff --git a/deal.II/source/base/partitioner.cc b/deal.II/source/base/partitioner.cc index 40cb4ebd1a..bd9748bc5b 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 <deal.II/base/partitioner.h> @@ -208,8 +210,8 @@ namespace Utilities unsigned int current_index = expanded_ghost_indices[0]; while (current_index >= first_index[current_proc+1]) current_proc++; - std::vector<std::pair<unsigned int,unsigned int> > ghost_targets_temp - (1, std::pair<unsigned int, unsigned int>(current_proc, 0)); + std::vector<std::pair<unsigned int,types::global_dof_index> > ghost_targets_temp + (1, std::pair<unsigned int, types::global_dof_index>(current_proc, 0)); n_ghost_targets++; for (unsigned int iterator=1; iterator<n_ghost_indices_data; ++iterator) @@ -223,7 +225,7 @@ namespace Utilities ghost_targets_temp[n_ghost_targets-1].second = iterator - ghost_targets_temp[n_ghost_targets-1].second; ghost_targets_temp.push_back(std::pair<unsigned int, - unsigned int>(current_proc,iterator)); + types::global_dof_index>(current_proc,iterator)); n_ghost_targets++; } } @@ -243,14 +245,14 @@ namespace Utilities MPI_INT, communicator); // allocate memory for import data - std::vector<std::pair<unsigned int,unsigned int> > import_targets_temp; + std::vector<std::pair<unsigned int,types::global_dof_index> > import_targets_temp; n_import_indices_data = 0; for (unsigned int i=0; i<n_procs; i++) if (receive_buffer[i] > 0) { n_import_indices_data += receive_buffer[i]; import_targets_temp.push_back(std::pair<unsigned int, - unsigned int> (i, receive_buffer[i])); + types::global_dof_index> (i, receive_buffer[i])); } import_targets_data = import_targets_temp; } @@ -292,22 +294,22 @@ namespace Utilities // space and compress contiguous indices in // form of ranges { - unsigned int last_index = numbers::invalid_unsigned_int-1; - std::vector<std::pair<unsigned int,unsigned int> > compressed_import_indices; + types::global_dof_index last_index = numbers::invalid_dof_index-1; + std::vector<std::pair<types::global_dof_index,types::global_dof_index> > compressed_import_indices; for (unsigned int i=0; i<n_import_indices_data; i++) { Assert (expanded_import_indices[i] >= local_range_data.first && expanded_import_indices[i] < local_range_data.second, ExcIndexRange(expanded_import_indices[i], local_range_data.first, local_range_data.second)); - unsigned int new_index = (expanded_import_indices[i] - - local_range_data.first); + types::global_dof_index new_index = (expanded_import_indices[i] - + local_range_data.first); if (new_index == last_index+1) compressed_import_indices.back().second++; else { compressed_import_indices.push_back - (std::pair<unsigned int,unsigned int>(new_index,new_index+1)); + (std::pair<types::global_dof_index,types::global_dof_index>(new_index,new_index+1)); } last_index = new_index; } @@ -315,7 +317,7 @@ namespace Utilities // sanity check #ifdef DEBUG - const unsigned int n_local_dofs = local_range_data.second-local_range_data.first; + const types::global_dof_index n_local_dofs = local_range_data.second-local_range_data.first; for (unsigned int i=0; i<import_indices_data.size(); ++i) { AssertIndexRange (import_indices_data[i].first, n_local_dofs); 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 <deal.II/base/path_search.h> #include <deal.II/base/logstream.h> 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 <deal.II/base/polynomial.h> #include <deal.II/base/point.h> 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 <deal.II/base/polynomial_space.h> #include <deal.II/base/exceptions.h> 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 <deal.II/base/polynomials_abf.h> #include <deal.II/base/quadrature_lib.h> 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 <deal.II/base/polynomials_adini.h> 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 <deal.II/base/polynomials_bdm.h> #include <deal.II/base/quadrature_lib.h> 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 <deal.II/base/geometry_info.h> #include <deal.II/base/quadrature_lib.h> #include <deal.II/base/polynomial.h> 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 <deal.II/base/polynomials_p.h> 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 <deal.II/base/polynomials_piecewise.h> @@ -72,7 +74,7 @@ namespace Polynomials } } else - { + { const double offset = step * interval; if (x<offset || x>offset+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 <deal.II/base/polynomials_raviart_thomas.h> #include <deal.II/base/quadrature_lib.h> 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 <deal.II/base/geometry_info.h> #include <deal.II/base/quadrature.h> 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/geometry_info.h> 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 <deal.II/base/quadrature_selector.h> #include <deal.II/base/quadrature_lib.h> 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 <deal.II/base/thread_management.h> #include <deal.II/base/subscriptor.h> @@ -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 = "<none>"; + 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 <deal.II/base/symmetric_tensor.h> diff --git a/deal.II/source/base/table_handler.cc b/deal.II/source/base/table_handler.cc index d9b500718c..aed67bee63 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 <deal.II/base/table_handler.h> #include <deal.II/base/table.h> diff --git a/deal.II/source/base/tensor_function.cc b/deal.II/source/base/tensor_function.cc index ec2d4a1a37..93c80d0eb2 100644 --- a/deal.II/source/base/tensor_function.cc +++ b/deal.II/source/base/tensor_function.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 <deal.II/base/tensor_function.h> #include <vector> @@ -21,6 +23,7 @@ DEAL_II_NAMESPACE_OPEN + ////////////////////////////////////////////////////////////////////// // TensorFunction ////////////////////////////////////////////////////////////////////// @@ -82,6 +85,90 @@ TensorFunction<rank, dim>::gradient_list (const std::vector<Point<dim> > &poin } + +////////////////////////////////////////////////////////////////////// +// ConstantTensorFunction +////////////////////////////////////////////////////////////////////// + + +template <int rank, int dim> +ConstantTensorFunction<rank, dim>::ConstantTensorFunction (const Tensor<rank, dim> &value, + const double initial_time) + : + TensorFunction<rank, dim> (initial_time), + _value(value) +{} + + +template <int rank, int dim> +ConstantTensorFunction<rank, dim>::~ConstantTensorFunction () +{} + + +template <int rank, int dim> +typename TensorFunction<rank, dim>::value_type +ConstantTensorFunction<rank, dim>::value (const Point<dim> &/*point*/) const +{ + return _value; +} + + +template <int rank, int dim> +void +ConstantTensorFunction<rank, dim>::value_list (const std::vector<Point<dim> > &points, + std::vector<typename TensorFunction<rank, dim>::value_type> &values) const +{ + Assert (values.size() == points.size(), + ExcDimensionMismatch(values.size(), points.size())); + + for (unsigned int i=0; i<values.size(); ++i) + values[i] = _value; +} + + +template <int rank, int dim> +typename TensorFunction<rank, dim>::gradient_type +ConstantTensorFunction<rank, dim>::gradient (const Point<dim> &) const +{ + static const Tensor<rank+1,dim> zero; + + return zero; +} + + +template <int rank, int dim> +void +ConstantTensorFunction<rank, dim>::gradient_list (const std::vector<Point<dim> > &points, + std::vector<typename TensorFunction<rank, dim>::gradient_type> &gradients) const +{ + Assert (gradients.size() == points.size(), + ExcDimensionMismatch(gradients.size(), points.size())); + + static const Tensor<rank+1,dim> zero; + + for (unsigned int i=0; i<gradients.size(); ++i) + gradients[i] = zero; +} + + + +////////////////////////////////////////////////////////////////////// +// ZeroTensorFunction +////////////////////////////////////////////////////////////////////// + + +template <int rank, int dim> +ZeroTensorFunction<rank, dim>::ZeroTensorFunction (const double initial_time) + : + ConstantTensorFunction<rank, dim> (dealii::Tensor<rank, dim>(), 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 <deal.II/base/tensor_product_polynomials.h> #include <deal.II/base/polynomials_piecewise.h> @@ -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 <deal.II/base/tensor_product_polynomials_const.h> #include <deal.II/base/exceptions.h> 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 <deal.II/base/thread_management.h> 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 <deal.II/base/timer.h> #include <deal.II/base/exceptions.h> @@ -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 47db7dd009..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 <deal.II/base/utilities.h> #include <deal.II/base/exceptions.h> @@ -464,6 +468,82 @@ namespace Utilities return out; } + std::vector<unsigned long long int> + reverse_permutation (const std::vector<unsigned long long int> &permutation) + { + const unsigned long long int n = permutation.size(); + + std::vector<unsigned long long int> out (n); + for (unsigned long long int i=0; i<n; ++i) + out[i] = n - 1 - permutation[i]; + + return out; + } + + + + std::vector<unsigned long long int> + invert_permutation (const std::vector<unsigned long long int> &permutation) + { + const unsigned long long int n = permutation.size(); + + std::vector<unsigned long long int> out (n, numbers::invalid_unsigned_int); + + for (unsigned long long int i=0; i<n; ++i) + { + Assert (permutation[i] < n, ExcIndexRange (permutation[i], 0, n)); + out[permutation[i]] = i; + } + + // check that we have actually reached + // all indices + for (unsigned long long int i=0; i<n; ++i) + Assert (out[i] != numbers::invalid_unsigned_int, + ExcMessage ("The given input permutation had duplicate entries!")); + + return out; + } + + + template <typename Integer> + std::vector<Integer> + reverse_permutation (const std::vector<Integer> &permutation) + { + const unsigned int n = permutation.size(); + + std::vector<Integer> out (n); + for (unsigned int i=0; i<n; ++i) + out[i] = n - 1 - permutation[i]; + + return out; + } + + + + template <typename Integer> + std::vector<Integer> + invert_permutation (const std::vector<Integer> &permutation) + { + const unsigned int n = permutation.size(); + + std::vector<Integer> out (n, numbers::invalid_unsigned_int); + + for (unsigned int i=0; i<n; ++i) + { + Assert (permutation[i] < n, ExcIndexRange (permutation[i], 0, n)); + out[permutation[i]] = i; + } + + // check that we have actually reached + // all indices + for (unsigned int i=0; i<n; ++i) + Assert (out[i] != numbers::invalid_unsigned_int, + ExcMessage ("The given input permutation had duplicate entries!")); + + return out; + } + + namespace System diff --git a/deal.II/source/distributed/CMakeLists.txt b/deal.II/source/distributed/CMakeLists.txt index 3334e88d9a..9648b6ae59 100644 --- a/deal.II/source/distributed/CMakeLists.txt +++ b/deal.II/source/distributed/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/base/utilities.h> 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 <deal.II/base/config.h> 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 b9c7d52c33..3613f5b7ca 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 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 <deal.II/base/utilities.h> #include <deal.II/base/memory_consumption.h> @@ -732,7 +736,7 @@ namespace const std::vector<std::list< std::pair<typename Triangulation<dim,spacedim>::active_cell_iterator,unsigned int> > > & vertex_to_cell, - const std::vector<unsigned int> &coarse_cell_to_p4est_tree_permutation, + const std::vector<types::global_dof_index> &coarse_cell_to_p4est_tree_permutation, const bool set_vertex_info, typename internal::p4est::types<dim>::connectivity *connectivity) { @@ -1077,7 +1081,8 @@ namespace { // yes, cell found in local part of p4est delete_all_children<dim,spacedim> (dealii_cell); - dealii_cell->set_subdomain_id(my_subdomain); + if (!dealii_cell->has_children()) + dealii_cell->set_subdomain_id(my_subdomain); } else { @@ -1171,12 +1176,14 @@ namespace if (internal::p4est::functions<dim>::quadrant_is_equal(&this_quadrant, &ghost_quadrant)) { // this is the ghostcell - dealii_cell->set_subdomain_id(ghost_owner); if (dealii_cell->has_children()) delete_all_children<dim,spacedim> (dealii_cell); else - dealii_cell->clear_coarsen_flag(); + { + dealii_cell->clear_coarsen_flag(); + dealii_cell->set_subdomain_id(ghost_owner); + } return; } @@ -1455,7 +1462,7 @@ namespace void *ptr = static_cast<char *>(q->p.user_data) + offset; typename parallel::distributed::Triangulation<dim,spacedim>::CellStatus status = * static_cast< - typename parallel::distributed::Triangulation<dim,spacedim>::CellStatus* + typename parallel::distributed::Triangulation<dim,spacedim>::CellStatus * >(q->p.user_data); switch (status) { @@ -1497,7 +1504,7 @@ namespace { public: RefineAndCoarsenList (const Triangulation<dim,spacedim> &triangulation, - const std::vector<unsigned int> &p4est_tree_to_coarse_cell_permutation, + const std::vector<types::global_dof_index> &p4est_tree_to_coarse_cell_permutation, const types::subdomain_id my_subdomain, typename internal::p4est::types<dim>::forest &forest); @@ -1571,7 +1578,7 @@ namespace template <int dim, int spacedim> RefineAndCoarsenList<dim,spacedim>:: RefineAndCoarsenList (const Triangulation<dim,spacedim> &triangulation, - const std::vector<unsigned int> &p4est_tree_to_coarse_cell_permutation, + const std::vector<types::global_dof_index> &p4est_tree_to_coarse_cell_permutation, const types::subdomain_id my_subdomain, typename internal::p4est::types<dim>::forest &forest) : @@ -1897,6 +1904,16 @@ namespace parallel /* ---------------------- class Triangulation<dim,spacedim> ------------------------------ */ + + template <int dim, int spacedim> + Triangulation<dim,spacedim>::NumberCache::NumberCache() + : + n_global_active_cells(0), + n_global_levels(0) + {} + + + template <int dim, int spacedim> Triangulation<dim,spacedim>:: Triangulation (MPI_Comm mpi_communicator, @@ -2553,7 +2570,8 @@ namespace parallel Assert (ghostlayer, ExcInternalError()); - //set all cells to artificial + // set all cells to artificial. we will later set it to the correct + // subdomain in match_tree_recursively for (typename Triangulation<dim,spacedim>::cell_iterator cell = this->begin(0); cell != this->end(0); @@ -2580,7 +2598,8 @@ namespace parallel == false) { delete_all_children<dim,spacedim> (cell); - cell->set_subdomain_id (numbers::artificial_subdomain_id); + if (!cell->has_children()) + cell->set_subdomain_id (numbers::artificial_subdomain_id); } else @@ -2607,7 +2626,7 @@ namespace parallel } // check mesh for ghostcells, - // refine as neccessary. + // refine as necessary. // iterate over every ghostquadrant, // find corresponding deal coarsecell // and recurse. @@ -2760,21 +2779,19 @@ namespace parallel --lvl; for (typename Triangulation<dim,spacedim>::cell_iterator cell = this->begin(lvl); cell!=this->end(lvl); ++cell) { - if (cell->has_children() && cell->subdomain_id()!=this->locally_owned_subdomain()) - { - //not our cell - for (unsigned int c=0; c<GeometryInfo<dim>::max_children_per_cell; ++c) - { - if (cell->child(c)->level_subdomain_id()==this->locally_owned_subdomain()) - { - 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) - cell->set_level_subdomain_id(mark); - break; - } - } - } + if (cell->has_children()) + for (unsigned int c=0; c<GeometryInfo<dim>::max_children_per_cell; ++c) + { + 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 + 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) + cell->set_level_subdomain_id(mark); + break; + } + } } } @@ -2846,12 +2863,12 @@ namespace parallel // do not allow anisotropic refinement #ifdef DEBUG for (typename Triangulation<dim,spacedim>::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<dim>::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<dim>::isotropic_refinement, + ExcMessage ("This class does not support anisotropic refinement")); #endif @@ -2859,11 +2876,11 @@ namespace parallel if (this->n_levels()==dealii::internal::p4est::functions<dim>::max_level) { for (typename Triangulation<dim,spacedim>::active_cell_iterator - cell = this->begin_active(dealii::internal::p4est::functions<dim>::max_level-1); - cell != this->end(dealii::internal::p4est::functions<dim>::max_level-1); ++cell) + cell = this->begin_active(dealii::internal::p4est::functions<dim>::max_level-1); + cell != this->end(dealii::internal::p4est::functions<dim>::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.")); } } @@ -3020,7 +3037,11 @@ 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(), - 0); + /* ensure sum is + computed with + correct data + type:*/ + static_cast<types::global_dof_index>(0)); number_cache.n_global_levels = Utilities::MPI::max(this->n_levels(), mpi_communicator); } @@ -3046,7 +3067,7 @@ namespace parallel template <int dim, int spacedim> - unsigned int + types::global_dof_index Triangulation<dim,spacedim>::n_global_active_cells () const { return number_cache.n_global_active_cells; @@ -3164,7 +3185,7 @@ namespace parallel template <int dim, int spacedim> - const std::vector<unsigned int> & + const std::vector<types::global_dof_index> & Triangulation<dim, spacedim>::get_p4est_tree_to_coarse_cell_permutation() const { return p4est_tree_to_coarse_cell_permutation; @@ -3221,9 +3242,70 @@ namespace parallel template <int dim, int spacedim> void Triangulation<dim,spacedim>:: - copy_triangulation (const dealii::Triangulation<dim, spacedim> &) + copy_triangulation (const dealii::Triangulation<dim, spacedim> &old_tria) { - Assert (false, ExcNotImplemented()); + try + { + dealii::Triangulation<dim,spacedim>:: + copy_triangulation (old_tria); + } + catch (const typename dealii::Triangulation<dim,spacedim>::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<dim,spacedim> * + old_tria_x = dynamic_cast<const dealii::parallel::distributed::Triangulation<dim,spacedim> *>(&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<dim>()); + + try + { + copy_local_forest_to_triangulation (); + } + catch (const typename Triangulation<dim>::DistortedCellList &) + { + // the underlying + // triangulation should not + // be checking for + // distorted cells + AssertThrow (false, ExcInternalError()); + } + + update_number_cache (); } @@ -3307,7 +3389,7 @@ namespace parallel template <> - unsigned int + types::global_dof_index Triangulation<1,1>::n_global_active_cells () const { Assert (false, ExcNotImplemented()); @@ -3365,7 +3447,7 @@ namespace parallel template <> - unsigned int + types::global_dof_index Triangulation<1,2>::n_global_active_cells () const { Assert (false, ExcNotImplemented()); @@ -3415,7 +3497,7 @@ namespace parallel template <> - unsigned int + types::global_dof_index Triangulation<1,3>::n_global_active_cells () const { Assert (false, ExcNotImplemented()); 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..f791bd398e 100644 --- a/deal.II/source/dofs/CMakeLists.txt +++ b/deal.II/source/dofs/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/deal.II/source/dofs/block_info.cc b/deal.II/source/dofs/block_info.cc index a81c86c252..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 <deal.II/dofs/block_info.h> #include <deal.II/dofs/dof_handler.h> @@ -30,14 +32,14 @@ BlockInfo::initialize(const DoFHandler<dim, spacedim> &dof, bool levels_only, bo if (!levels_only && dof.has_active_dofs()) { const FiniteElement<dim, spacedim> &fe = dof.get_fe(); - std::vector<unsigned int> sizes(fe.n_blocks()); + std::vector<types::global_dof_index> sizes(fe.n_blocks()); DoFTools::count_dofs_per_block(dof, sizes); bi_global.reinit(sizes); } if (!active_only && dof.has_level_dofs()) { - std::vector<std::vector<unsigned int> > sizes (dof.get_tria ().n_levels ()); + std::vector<std::vector<types::global_dof_index> > sizes (dof.get_tria ().n_levels ()); for (unsigned int i = 0; i < sizes.size (); ++i) sizes[i].resize (dof.get_fe ().n_blocks ()); @@ -56,7 +58,7 @@ void BlockInfo::initialize_local(const DoFHandler<dim, spacedim> &dof) { const FiniteElement<dim, spacedim> &fe = dof.get_fe(); - std::vector<unsigned int> sizes(fe.n_blocks()); + std::vector<types::global_dof_index> sizes(fe.n_blocks()); base_elements.resize(fe.n_blocks()); 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 e5282b7d63..59b8c48334 100644 --- a/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/source/dofs/dof_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, 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 <deal.II/lac/vector.h> #include <deal.II/lac/block_vector.h> @@ -68,7 +70,7 @@ DoFCellAccessor<DH,lda>::update_cell_dof_indices_cache () const template <class DH, bool lda> void -DoFCellAccessor<DH,lda>::set_dof_indices (const std::vector<unsigned int> &local_dof_indices) +DoFCellAccessor<DH,lda>::set_dof_indices (const std::vector<types::global_dof_index> &local_dof_indices) { Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); diff --git a/deal.II/source/dofs/dof_accessor.inst.in b/deal.II/source/dofs/dof_accessor.inst.in index e433bbb599..103290a711 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! 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 <deal.II/base/exceptions.h> #include <deal.II/base/memory_consumption.h> diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index 8d575a0ceb..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 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 <deal.II/base/memory_consumption.h> #include <deal.II/dofs/dof_handler.h> @@ -42,7 +44,7 @@ template<int dim, int spacedim> const unsigned int DoFHandler<dim,spacedim>::space_dimension; template <int dim, int spacedim> -const unsigned int DoFHandler<dim,spacedim>::invalid_dof_index; +const types::global_dof_index DoFHandler<dim,spacedim>::invalid_dof_index; template <int dim, int spacedim> const unsigned int DoFHandler<dim,spacedim>::default_fe_index; @@ -53,7 +55,7 @@ const unsigned int DoFHandler<dim,spacedim>::default_fe_index; namespace internal { template <int dim, int spacedim> - const unsigned int *dummy () + const types::global_dof_index *dummy () { return &dealii::DoFHandler<dim,spacedim>::invalid_dof_index; } @@ -86,8 +88,8 @@ namespace internal unsigned int max_couplings_between_dofs (const DoFHandler<1,spacedim> &dof_handler) { - return std::min(3*dof_handler.selected_fe->dofs_per_vertex + - 2*dof_handler.selected_fe->dofs_per_line, + return std::min(static_cast<types::global_dof_index>(3*dof_handler.selected_fe->dofs_per_vertex + + 2*dof_handler.selected_fe->dofs_per_line), dof_handler.n_dofs()); } @@ -120,7 +122,7 @@ namespace internal // nodes) // count lines -> 28 (don't forget to count // mother and children separately!) - unsigned int max_couplings; + types::global_dof_index max_couplings; switch (dof_handler.tria->max_adjacent_cells()) { case 4: @@ -223,7 +225,7 @@ namespace internal const unsigned int max_adjacent_cells = dof_handler.tria->max_adjacent_cells(); - unsigned int max_couplings; + types::global_dof_index max_couplings; if (max_adjacent_cells <= 8) max_couplings=7*7*7*dof_handler.selected_fe->dofs_per_vertex + 7*6*7*3*dof_handler.selected_fe->dofs_per_line + @@ -364,7 +366,7 @@ namespace internal for (unsigned int i = 0; i < n_levels; ++i) { dof_handler.mg_levels.push_back (new internal::DoFHandler::DoFLevel<1>); - dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<unsigned int> (tria.n_raw_lines (i) * dofs_per_line, DoFHandler<1>::invalid_dof_index); + dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<types::global_dof_index> (tria.n_raw_lines (i) * dofs_per_line, DoFHandler<1>::invalid_dof_index); } const unsigned int &n_vertices = tria.n_vertices (); @@ -420,11 +422,11 @@ namespace internal for (unsigned int i = 0; i < n_levels; ++i) { dof_handler.mg_levels.push_back (new internal::DoFHandler::DoFLevel<2>); - dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<unsigned int> (tria.n_raw_quads (i) * fe.dofs_per_quad, DoFHandler<2>::invalid_dof_index); + dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<types::global_dof_index> (tria.n_raw_quads (i) * fe.dofs_per_quad, DoFHandler<2>::invalid_dof_index); } dof_handler.mg_faces = new internal::DoFHandler::DoFFaces<2>; - dof_handler.mg_faces->lines.dofs = std::vector<unsigned int> (tria.n_raw_lines () * fe.dofs_per_line, DoFHandler<2>::invalid_dof_index); + dof_handler.mg_faces->lines.dofs = std::vector<types::global_dof_index> (tria.n_raw_lines () * fe.dofs_per_line, DoFHandler<2>::invalid_dof_index); const unsigned int &n_vertices = tria.n_vertices (); @@ -479,12 +481,12 @@ namespace internal for (unsigned int i = 0; i < n_levels; ++i) { dof_handler.mg_levels.push_back (new internal::DoFHandler::DoFLevel<3>); - dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<unsigned int> (tria.n_raw_hexs (i) * fe.dofs_per_hex, DoFHandler<3>::invalid_dof_index); + dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<types::global_dof_index> (tria.n_raw_hexs (i) * fe.dofs_per_hex, DoFHandler<3>::invalid_dof_index); } dof_handler.mg_faces = new internal::DoFHandler::DoFFaces<3>; - dof_handler.mg_faces->lines.dofs = std::vector<unsigned int> (tria.n_raw_lines () * fe.dofs_per_line, DoFHandler<3>::invalid_dof_index); - dof_handler.mg_faces->quads.dofs = std::vector<unsigned int> (tria.n_raw_quads () * fe.dofs_per_quad, DoFHandler<3>::invalid_dof_index); + dof_handler.mg_faces->lines.dofs = std::vector<types::global_dof_index> (tria.n_raw_lines () * fe.dofs_per_line, DoFHandler<3>::invalid_dof_index); + dof_handler.mg_faces->quads.dofs = std::vector<types::global_dof_index> (tria.n_raw_quads () * fe.dofs_per_quad, DoFHandler<3>::invalid_dof_index); const unsigned int &n_vertices = tria.n_vertices (); @@ -527,7 +529,7 @@ namespace internal template<int spacedim> static - unsigned int distribute_dofs_on_cell (typename DoFHandler<1, spacedim>::cell_iterator &cell, unsigned int next_free_dof) + types::global_dof_index distribute_dofs_on_cell (typename DoFHandler<1, spacedim>::cell_iterator &cell, types::global_dof_index next_free_dof) { const FiniteElement<1, spacedim> &fe = cell->get_fe (); @@ -564,7 +566,7 @@ namespace internal template<int spacedim> static - unsigned int distribute_dofs_on_cell (typename DoFHandler<2, spacedim>::cell_iterator &cell, unsigned int next_free_dof) + types::global_dof_index distribute_dofs_on_cell (typename DoFHandler<2, spacedim>::cell_iterator &cell, types::global_dof_index next_free_dof) { const FiniteElement<2, spacedim> &fe = cell->get_fe (); @@ -594,7 +596,7 @@ namespace internal template<int spacedim> static - unsigned int distribute_dofs_on_cell (typename DoFHandler<3, spacedim>::cell_iterator &cell, unsigned int next_free_dof) + types::global_dof_index distribute_dofs_on_cell (typename DoFHandler<3, spacedim>::cell_iterator &cell, types::global_dof_index next_free_dof) { const FiniteElement<3, spacedim> &fe = cell->get_fe (); @@ -634,7 +636,8 @@ namespace internal template<int spacedim> static - unsigned int get_dof_index ( + types::global_dof_index + get_dof_index ( const DoFHandler<1, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<1> &mg_level, internal::DoFHandler::DoFFaces<1> &, @@ -648,77 +651,82 @@ namespace internal template<int spacedim> static - unsigned int get_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &, internal::DoFHandler::DoFFaces<2> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) + types::global_dof_index + get_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &, internal::DoFHandler::DoFFaces<2> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) { return mg_faces.lines.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template<int spacedim> static - unsigned int get_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &mg_level, internal::DoFHandler::DoFFaces<2> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<2>) + types::global_dof_index + get_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &mg_level, internal::DoFHandler::DoFFaces<2> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<2>) { return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template<int spacedim> static - unsigned int get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) + types::global_dof_index + get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) { return mg_faces.lines.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template<int spacedim> static - unsigned int get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<2>) + types::global_dof_index + get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<2>) { return mg_faces.quads.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template<int spacedim> static - unsigned int get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &mg_level, internal::DoFHandler::DoFFaces<3> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<3>) + types::global_dof_index + get_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &mg_level, internal::DoFHandler::DoFFaces<3> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<3>) { return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index); } template<int spacedim> static - void set_dof_index (const DoFHandler<1, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<1> &mg_level, internal::DoFHandler::DoFFaces<1> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<1>) + void set_dof_index (const DoFHandler<1, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<1> &mg_level, internal::DoFHandler::DoFFaces<1> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const int2type<1>) { mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template<int spacedim> static - void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &, internal::DoFHandler::DoFFaces<2> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<1>) + void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &, internal::DoFHandler::DoFFaces<2> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const int2type<1>) { mg_faces.lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template<int spacedim> static - void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &mg_level, internal::DoFHandler::DoFFaces<2> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<2>) + void set_dof_index (const DoFHandler<2, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<2> &mg_level, internal::DoFHandler::DoFFaces<2> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const int2type<2>) { mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template<int spacedim> static - void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<1>) + void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const int2type<1>) { mg_faces.lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template<int spacedim> static - void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<2>) + void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &, internal::DoFHandler::DoFFaces<3> &mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const int2type<2>) { mg_faces.quads.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } template<int spacedim> static - void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &mg_level, internal::DoFHandler::DoFFaces<3> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<3>) + void set_dof_index (const DoFHandler<3, spacedim> &dof_handler, internal::DoFHandler::DoFLevel<3> &mg_level, internal::DoFHandler::DoFFaces<3> &, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index, const int2type<3>) { mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index); } @@ -797,8 +805,10 @@ template <int dim, int spacedim> typename DoFHandler<dim,spacedim>::cell_iterator DoFHandler<dim,spacedim>::begin (const unsigned int level) const { - return cell_iterator (*this->get_tria().begin(level), - this); + typename Triangulation<dim,spacedim>::cell_iterator cell = this->get_tria().begin(level); + if (cell == this->get_tria().end(level)) + return end(level); + return cell_iterator (*cell, this); } @@ -834,9 +844,10 @@ template <int dim, int spacedim> typename DoFHandler<dim,spacedim>::cell_iterator DoFHandler<dim,spacedim>::end (const unsigned int level) const { - return (level == this->get_tria().n_levels()-1 ? - end() : - begin (level+1)); + typename Triangulation<dim,spacedim>::cell_iterator cell = this->get_tria().end(level); + if (cell.state() != IteratorState::valid) + return end(); + return cell_iterator (*cell, this); } @@ -844,9 +855,10 @@ template <int dim, int spacedim> typename DoFHandler<dim, spacedim>::active_cell_iterator DoFHandler<dim, spacedim>::end_active (const unsigned int level) const { - return (level == this->get_tria().n_levels()-1 ? - active_cell_iterator(end()) : - begin_active (level+1)); + typename Triangulation<dim,spacedim>::cell_iterator cell = this->get_tria().end_active(level); + if (cell.state() != IteratorState::valid) + return active_cell_iterator(end()); + return active_cell_iterator (*cell, this); } @@ -857,8 +869,10 @@ DoFHandler<dim, spacedim>::begin_mg (const unsigned int level) const { // Assert(this->has_level_dofs(), ExcMessage("You can only iterate over mg " // "levels if mg dofs got distributed.")); - return level_cell_iterator (*this->get_tria().begin(level), - this); + typename Triangulation<dim,spacedim>::cell_iterator cell = this->get_tria().begin(level); + if (cell == this->get_tria().end(level)) + return end_mg(level); + return level_cell_iterator (*cell, this); } @@ -868,9 +882,10 @@ DoFHandler<dim, spacedim>::end_mg (const unsigned int level) const { // Assert(this->has_level_dofs(), ExcMessage("You can only iterate over mg " // "levels if mg dofs got distributed.")); - return (level == this->get_tria().n_levels()-1 ? - end() : - begin (level+1)); + typename Triangulation<dim,spacedim>::cell_iterator cell = this->get_tria().end(level); + if (cell.state() != IteratorState::valid) + return end(); + return level_cell_iterator (*cell, this); } @@ -888,7 +903,7 @@ DoFHandler<dim, spacedim>::end_mg () const template <> -unsigned int DoFHandler<1>::n_boundary_dofs () const +types::global_dof_index DoFHandler<1>::n_boundary_dofs () const { return 2*get_fe().dofs_per_vertex; } @@ -896,7 +911,7 @@ unsigned int DoFHandler<1>::n_boundary_dofs () const template <> -unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const +types::global_dof_index DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const { // check that only boundary // indicators 0 and 1 are allowed @@ -912,7 +927,7 @@ unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicat template <> -unsigned int DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const +types::global_dof_index DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const { // check that only boundary // indicators 0 and 1 are allowed @@ -927,7 +942,7 @@ unsigned int DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> template <> -unsigned int DoFHandler<1,2>::n_boundary_dofs () const +types::global_dof_index DoFHandler<1,2>::n_boundary_dofs () const { return 2*get_fe().dofs_per_vertex; } @@ -935,7 +950,7 @@ unsigned int DoFHandler<1,2>::n_boundary_dofs () const template <> -unsigned int DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &boundary_indicators) const +types::global_dof_index DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &boundary_indicators) const { // check that only boundary // indicators 0 and 1 are allowed @@ -951,7 +966,7 @@ unsigned int DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &boundary_indic template <> -unsigned int DoFHandler<1,2>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const +types::global_dof_index DoFHandler<1,2>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const { // check that only boundary // indicators 0 and 1 are allowed @@ -967,12 +982,12 @@ unsigned int DoFHandler<1,2>::n_boundary_dofs (const std::set<types::boundary_id template<int dim, int spacedim> -unsigned int DoFHandler<dim,spacedim>::n_boundary_dofs () const +types::global_dof_index DoFHandler<dim,spacedim>::n_boundary_dofs () const { std::set<int> boundary_dofs; const unsigned int dofs_per_face = get_fe().dofs_per_face; - std::vector<unsigned int> dofs_on_face(dofs_per_face); + std::vector<types::global_dof_index> dofs_on_face(dofs_per_face); // loop over all faces of all cells // and see whether they are at a @@ -1005,7 +1020,7 @@ unsigned int DoFHandler<dim,spacedim>::n_boundary_dofs () const template<int dim, int spacedim> -unsigned int +types::global_dof_index DoFHandler<dim,spacedim>::n_boundary_dofs (const FunctionMap &boundary_indicators) const { Assert (boundary_indicators.find(numbers::internal_face_boundary_id) == boundary_indicators.end(), @@ -1014,7 +1029,7 @@ DoFHandler<dim,spacedim>::n_boundary_dofs (const FunctionMap &boundary_indicator std::set<int> boundary_dofs; const unsigned int dofs_per_face = get_fe().dofs_per_face; - std::vector<unsigned int> dofs_on_face(dofs_per_face); + std::vector<types::global_dof_index> dofs_on_face(dofs_per_face); // same as in the previous // function, but with an additional @@ -1039,7 +1054,7 @@ DoFHandler<dim,spacedim>::n_boundary_dofs (const FunctionMap &boundary_indicator template<int dim, int spacedim> -unsigned int +types::global_dof_index DoFHandler<dim,spacedim>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const { Assert (boundary_indicators.find (numbers::internal_face_boundary_id) == boundary_indicators.end(), @@ -1048,7 +1063,7 @@ DoFHandler<dim,spacedim>::n_boundary_dofs (const std::set<types::boundary_id> &b std::set<int> boundary_dofs; const unsigned int dofs_per_face = get_fe().dofs_per_face; - std::vector<unsigned int> dofs_on_face(dofs_per_face); + std::vector<types::global_dof_index> dofs_on_face(dofs_per_face); // same as in the previous // function, but with a different @@ -1097,7 +1112,7 @@ DoFHandler<dim,spacedim>::memory_consumption () const mem += MemoryConsumption::memory_consumption (*mg_faces); for (unsigned int i = 0; i < mg_vertex_dofs.size (); ++i) - mem += sizeof (MGVertexDoFs) + (1 + mg_vertex_dofs[i].get_finest_level () - mg_vertex_dofs[i].get_coarsest_level ()) * sizeof (unsigned int); + mem += sizeof (MGVertexDoFs) + (1 + mg_vertex_dofs[i].get_finest_level () - mg_vertex_dofs[i].get_coarsest_level ()) * sizeof (types::global_dof_index); return mem; } @@ -1213,7 +1228,7 @@ void DoFHandler<dim,spacedim>::clear () template <int dim, int spacedim> void -DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<unsigned int> &new_numbers) +DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<types::global_dof_index> &new_numbers) { Assert (new_numbers.size() == n_locally_owned_dofs(), ExcRenumberingIncomplete()); @@ -1230,15 +1245,15 @@ DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<unsigned int> &new_nu // processor if (n_locally_owned_dofs() == n_dofs()) { - std::vector<unsigned int> tmp(new_numbers); + std::vector<types::global_dof_index> tmp(new_numbers); std::sort (tmp.begin(), tmp.end()); - std::vector<unsigned int>::const_iterator p = tmp.begin(); - unsigned int i = 0; + std::vector<types::global_dof_index>::const_iterator p = tmp.begin(); + types::global_dof_index i = 0; for (; p!=tmp.end(); ++p, ++i) Assert (*p == i, ExcNewNumbersNotConsecutive(i)); } else - for (unsigned int i=0; i<new_numbers.size(); ++i) + for (types::global_dof_index i=0; i<new_numbers.size(); ++i) Assert (new_numbers[i] < n_dofs(), ExcMessage ("New DoF index is not less than the total number of dofs.")); #endif @@ -1250,7 +1265,7 @@ DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<unsigned int> &new_nu template <int dim, int spacedim> void DoFHandler<dim,spacedim>::renumber_dofs (const unsigned int, - const std::vector<unsigned int> &) + const std::vector<types::global_dof_index> &) { Assert(false, ExcNotImplemented()); } @@ -1258,7 +1273,7 @@ DoFHandler<dim,spacedim>::renumber_dofs (const unsigned int, template<> void DoFHandler<1>::renumber_dofs (const unsigned int level, - const std::vector<unsigned int> &new_numbers) + const std::vector<types::global_dof_index> &new_numbers) { Assert (new_numbers.size() == n_dofs(level), DoFHandler<1>::ExcRenumberingIncomplete()); @@ -1277,7 +1292,7 @@ void DoFHandler<1>::renumber_dofs (const unsigned int level, for (unsigned int d=0; d<this->get_fe().dofs_per_vertex; ++d) i->set_index (level, d, new_numbers[i->get_index (level, d)]); - for (std::vector<unsigned int>::iterator i=mg_levels[level]->dof_object.dofs.begin(); + for (std::vector<types::global_dof_index>::iterator i=mg_levels[level]->dof_object.dofs.begin(); i!=mg_levels[level]->dof_object.dofs.end(); ++i) { if (*i != DoFHandler<1>::invalid_dof_index) @@ -1292,7 +1307,7 @@ void DoFHandler<1>::renumber_dofs (const unsigned int level, template<> void DoFHandler<2>::renumber_dofs (const unsigned int level, - const std::vector<unsigned int> &new_numbers) + const std::vector<types::global_dof_index> &new_numbers) { Assert (new_numbers.size() == n_dofs(level), DoFHandler<2>::ExcRenumberingIncomplete()); @@ -1336,7 +1351,7 @@ void DoFHandler<2>::renumber_dofs (const unsigned int level, const_cast<Triangulation<2> &>(this->get_tria()).load_user_flags (user_flags); } - for (std::vector<unsigned int>::iterator i=mg_levels[level]->dof_object.dofs.begin(); + for (std::vector<types::global_dof_index>::iterator i=mg_levels[level]->dof_object.dofs.begin(); i!=mg_levels[level]->dof_object.dofs.end(); ++i) { if (*i != DoFHandler<2>::invalid_dof_index) @@ -1351,7 +1366,7 @@ void DoFHandler<2>::renumber_dofs (const unsigned int level, template<> void DoFHandler<3>::renumber_dofs (const unsigned int level, - const std::vector<unsigned int> &new_numbers) + const std::vector<types::global_dof_index> &new_numbers) { Assert (new_numbers.size() == n_dofs(level), DoFHandler<3>::ExcRenumberingIncomplete()); @@ -1430,7 +1445,7 @@ void DoFHandler<3>::renumber_dofs (const unsigned int level, } //HEX DoFs - for (std::vector<unsigned int>::iterator i=mg_levels[level]->dof_object.dofs.begin(); + for (std::vector<types::global_dof_index>::iterator i=mg_levels[level]->dof_object.dofs.begin(); i!=mg_levels[level]->dof_object.dofs.end(); ++i) { if (*i != DoFHandler<3>::invalid_dof_index) @@ -1502,7 +1517,7 @@ void DoFHandler<dim,spacedim>::clear_space () delete faces; faces = 0; - std::vector<unsigned int> tmp; + std::vector<types::global_dof_index> tmp; std::swap (vertex_dofs, tmp); number_cache.clear (); @@ -1510,7 +1525,8 @@ void DoFHandler<dim,spacedim>::clear_space () template<int dim, int spacedim> template<int structdim> -unsigned int DoFHandler<dim, spacedim>::get_dof_index ( +types::global_dof_index +DoFHandler<dim, spacedim>::get_dof_index ( const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, @@ -1524,16 +1540,18 @@ unsigned int DoFHandler<dim, spacedim>::get_dof_index ( template<int dim, int spacedim> template<int structdim> -void DoFHandler<dim, spacedim>::set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index) const +void DoFHandler<dim, spacedim>::set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index) const { internal::DoFHandler::Implementation::set_dof_index (*this, *this->mg_levels[obj_level], *this->mg_faces, obj_index, fe_index, local_index, global_index, internal::int2type<structdim> ()); } + template<int dim, int spacedim> DoFHandler<dim, spacedim>::MGVertexDoFs::MGVertexDoFs (): coarsest_level (numbers::invalid_unsigned_int), finest_level (0), indices (0), indices_offset (0) { } + template<int dim, int spacedim> DoFHandler<dim, spacedim>::MGVertexDoFs::~MGVertexDoFs () { @@ -1565,13 +1583,13 @@ void DoFHandler<dim, spacedim>::MGVertexDoFs::init (const unsigned int cl, const const unsigned int n_levels = finest_level - coarsest_level + 1; const unsigned int n_indices = n_levels * dofs_per_vertex; - indices = new unsigned int[n_indices]; + indices = new types::global_dof_index[n_indices]; Assert (indices != 0, ExcNoMemory ()); for (unsigned int i = 0; i < n_indices; ++i) indices[i] = DoFHandler<dim, spacedim>::invalid_dof_index; - indices_offset = new unsigned int[n_levels]; + indices_offset = new types::global_dof_index[n_levels]; Assert (indices != 0, ExcNoMemory ()); for (unsigned int i = 0; i < n_levels; ++i) diff --git a/deal.II/source/dofs/dof_handler.inst.in b/deal.II/source/dofs/dof_handler.inst.in index 6a2e07d419..594bbd4c4a 100644 --- a/deal.II/source/dofs/dof_handler.inst.in +++ b/deal.II/source/dofs/dof_handler.inst.in @@ -1,24 +1,28 @@ -//--------------------------------------------------------------------------- -// $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) { namespace internal \{ - template const unsigned int * dummy<deal_II_dimension,deal_II_dimension> (); + template const types::global_dof_index * dummy<deal_II_dimension,deal_II_dimension> (); #if deal_II_dimension < 3 - template const unsigned int * dummy<deal_II_dimension,deal_II_dimension+1> (); + template const types::global_dof_index * dummy<deal_II_dimension,deal_II_dimension+1> (); #endif \} @@ -33,7 +37,7 @@ for (deal_II_dimension : DIMENSIONS) template class DoFHandler<1,deal_II_dimension>; template - unsigned int + types::global_dof_index DoFHandler<1,3>:: get_dof_index<1> (const unsigned int obj_level, const unsigned int obj_index, @@ -42,7 +46,7 @@ for (deal_II_dimension : DIMENSIONS) #endif template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension>:: get_dof_index<1> (const unsigned int obj_level, const unsigned int obj_index, @@ -51,7 +55,7 @@ get_dof_index<1> (const unsigned int obj_level, #if deal_II_dimension < 3 template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension+1>:: get_dof_index<1> (const unsigned int obj_level, const unsigned int obj_index, @@ -61,7 +65,7 @@ get_dof_index<1> (const unsigned int obj_level, #if deal_II_dimension >= 2 template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension>:: get_dof_index<2> (const unsigned int obj_level, const unsigned int obj_index, @@ -70,7 +74,7 @@ get_dof_index<2> (const unsigned int obj_level, #if deal_II_dimension < 3 template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension+1>:: get_dof_index<2> (const unsigned int obj_level, const unsigned int obj_index, @@ -80,7 +84,7 @@ get_dof_index<2> (const unsigned int obj_level, #if deal_II_dimension >= 3 template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension>:: get_dof_index<3> (const unsigned int obj_level, const unsigned int obj_index, @@ -93,20 +97,20 @@ template void DoFHandler<deal_II_dimension,deal_II_dimension>:: set_dof_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) const; + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) const; #if deal_II_dimension < 3 template void DoFHandler<deal_II_dimension,deal_II_dimension+1>:: set_dof_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) const; + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) const; #endif #if deal_II_dimension < 2 @@ -114,10 +118,10 @@ template void DoFHandler<deal_II_dimension,deal_II_dimension+2>:: set_dof_index<1> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) const; + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) const; #endif #if deal_II_dimension >= 2 @@ -125,20 +129,20 @@ template void DoFHandler<deal_II_dimension,deal_II_dimension>:: set_dof_index<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) const; + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) const; #if deal_II_dimension < 3 template void DoFHandler<deal_II_dimension,deal_II_dimension+1>:: set_dof_index<2> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) const; + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) const; #endif #if deal_II_dimension >= 3 @@ -146,10 +150,10 @@ template void DoFHandler<deal_II_dimension,deal_II_dimension>:: set_dof_index<3> (const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) const; + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) const; #endif #endif } diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index a45fd8c167..30a9c96ecb 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 @@ -59,10 +63,10 @@ namespace internal */ template <int spacedim> static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const DoFHandler<1,spacedim> &dof_handler, const typename DoFHandler<1,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { // distribute dofs of vertices @@ -103,10 +107,10 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const DoFHandler<2,spacedim> &dof_handler, const typename DoFHandler<2,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { if (dof_handler.get_fe().dofs_per_vertex > 0) // number dofs on vertices @@ -150,10 +154,10 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const DoFHandler<3,spacedim> &dof_handler, const typename DoFHandler<3,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { if (dof_handler.get_fe().dofs_per_vertex > 0) // number dofs on vertices @@ -216,12 +220,12 @@ namespace internal * Distribute degrees of freedom on all cells, or on cells with the * correct subdomain_id if the corresponding argument is not equal to * numbers::invalid_subdomain_id. Return the total number of dofs - * returned. + * distributed. */ template <int dim, int spacedim> static - unsigned int - distribute_dofs (const unsigned int offset, + types::global_dof_index + distribute_dofs (const types::global_dof_index offset, const types::subdomain_id subdomain_id, DoFHandler<dim,spacedim> &dof_handler) { @@ -237,7 +241,7 @@ namespace internal tria.save_user_flags(user_flags); const_cast<dealii::Triangulation<dim,spacedim> &>(tria).clear_user_flags (); - unsigned int next_free_dof = offset; + types::global_dof_index next_free_dof = offset; typename DoFHandler<dim,spacedim>::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -252,9 +256,8 @@ namespace internal next_free_dof); // update the cache used for cell dof indices - for (typename DoFHandler<dim,spacedim>::level_cell_iterator - cell = dof_handler.begin(); cell != dof_handler.end(); ++cell) - if (cell->subdomain_id() != numbers::artificial_subdomain_id) + for (cell = dof_handler.begin_active(); cell != endc; ++cell) + if (!cell->is_artificial()) cell->update_cell_dof_indices_cache (); // finally restore the user flags @@ -529,7 +532,7 @@ namespace internal template <int spacedim> static void - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, const IndexSet &, DoFHandler<1,spacedim> &dof_handler, const bool check_validity) @@ -544,7 +547,7 @@ namespace internal // numbers may be invalid_dof_index, // namely when the appropriate // vertex/line/etc is unused - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.vertex_dofs.begin(); i!=dof_handler.vertex_dofs.end(); ++i) if (*i != DoFHandler<1,spacedim>::invalid_dof_index) @@ -561,7 +564,7 @@ namespace internal ExcInternalError ()); for (unsigned int level=0; level<dof_handler.levels.size(); ++level) - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.levels[level]->dof_object.dofs.begin(); i!=dof_handler.levels[level]->dof_object.dofs.end(); ++i) if (*i != DoFHandler<1,spacedim>::invalid_dof_index) @@ -579,23 +582,23 @@ namespace internal template <int spacedim> static void - renumber_mg_dofs (const std::vector<unsigned int> &new_numbers, + renumber_mg_dofs (const std::vector<dealii::types::global_dof_index> &new_numbers, const IndexSet &indices, DoFHandler<1,spacedim> &dof_handler, const unsigned int level, const bool check_validity) { for (typename std::vector<typename DoFHandler<1,spacedim>::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; d<dof_handler.get_fe().dofs_per_vertex; ++d) { - unsigned int idx = i->get_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,10 +610,10 @@ namespace internal } - for (std::vector<unsigned int>::iterator - i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); + for (std::vector<types::global_dof_index>::iterator + 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) { @@ -626,9 +629,9 @@ namespace internal template <int spacedim> static void - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, const IndexSet &indices, - DoFHandler<2,spacedim> &dof_handler, + DoFHandler<2,spacedim> &dof_handler, const bool check_validity) { // note that we can not use cell @@ -641,7 +644,7 @@ namespace internal // numbers may be invalid_dof_index, // namely when the appropriate // vertex/line/etc is unused - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.vertex_dofs.begin(); i!=dof_handler.vertex_dofs.end(); ++i) if (*i != DoFHandler<2,spacedim>::invalid_dof_index) @@ -658,7 +661,7 @@ namespace internal == false, ExcInternalError ()); - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.faces->lines.dofs.begin(); i!=dof_handler.faces->lines.dofs.end(); ++i) if (*i != DoFHandler<2,spacedim>::invalid_dof_index) @@ -668,7 +671,7 @@ namespace internal for (unsigned int level=0; level<dof_handler.levels.size(); ++level) { - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.levels[level]->dof_object.dofs.begin(); i!=dof_handler.levels[level]->dof_object.dofs.end(); ++i) if (*i != DoFHandler<2,spacedim>::invalid_dof_index) @@ -689,7 +692,7 @@ namespace internal template <int spacedim> static void - renumber_mg_dofs (const std::vector<unsigned int> &new_numbers, + renumber_mg_dofs (const std::vector<dealii::types::global_dof_index> &new_numbers, const IndexSet &indices, DoFHandler<2,spacedim> &dof_handler, const unsigned int level, @@ -705,7 +708,7 @@ namespace internal (i->get_finest_level() >= level)) for (unsigned int d=0; d<dof_handler.get_fe().dofs_per_vertex; ++d) { - unsigned int idx =i->get_index (level, d/*, dof_handler.get_fe().dofs_per_vertex*/); + dealii::types::global_dof_index idx =i->get_index (level, d/*, dof_handler.get_fe().dofs_per_vertex*/); if (idx != DoFHandler<1>::invalid_dof_index) i->set_index (level, d/*, dof_handler.get_fe().dofs_per_vertex*/, ((indices.n_elements() == 0) ? @@ -740,7 +743,7 @@ namespace internal { for (unsigned int d=0; d<dof_handler.get_fe().dofs_per_line; ++d) { - unsigned int idx = cell->line(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] : @@ -754,7 +757,7 @@ namespace internal const_cast<dealii::Triangulation<2,spacedim> &>(dof_handler.get_tria()).load_user_flags (user_flags); } - for (std::vector<unsigned int>::iterator i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); + for (std::vector<types::global_dof_index>::iterator i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); i!=dof_handler.mg_levels[level]->dof_object.dofs.end(); ++i) { if (*i != DoFHandler<2>::invalid_dof_index) @@ -772,7 +775,7 @@ namespace internal template <int spacedim> static void - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, const IndexSet &indices, DoFHandler<3,spacedim> &dof_handler, const bool check_validity) @@ -787,7 +790,7 @@ namespace internal // numbers may be invalid_dof_index, // namely when the appropriate // vertex/line/etc is unused - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.vertex_dofs.begin(); i!=dof_handler.vertex_dofs.end(); ++i) if (*i != DoFHandler<3,spacedim>::invalid_dof_index) @@ -804,14 +807,14 @@ namespace internal == false, ExcInternalError ()); - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.faces->lines.dofs.begin(); i!=dof_handler.faces->lines.dofs.end(); ++i) if (*i != DoFHandler<3,spacedim>::invalid_dof_index) *i = ((indices.n_elements() == 0) ? new_numbers[*i] : new_numbers[indices.index_within_set(*i)]); - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.faces->quads.dofs.begin(); i!=dof_handler.faces->quads.dofs.end(); ++i) if (*i != DoFHandler<3,spacedim>::invalid_dof_index) @@ -821,7 +824,7 @@ namespace internal for (unsigned int level=0; level<dof_handler.levels.size(); ++level) { - for (std::vector<unsigned int>::iterator + for (std::vector<types::global_dof_index>::iterator i=dof_handler.levels[level]->dof_object.dofs.begin(); i!=dof_handler.levels[level]->dof_object.dofs.end(); ++i) if (*i != DoFHandler<3,spacedim>::invalid_dof_index) @@ -842,9 +845,9 @@ namespace internal template <int spacedim> static void - renumber_mg_dofs (const std::vector<unsigned int> &, - const IndexSet &, - DoFHandler<3,spacedim> &, + renumber_mg_dofs (const std::vector<dealii::types::global_dof_index> &, + const IndexSet &, + DoFHandler<3,spacedim> &, const unsigned int , const bool ) { @@ -872,7 +875,7 @@ namespace internal Sequential<dim,spacedim>:: distribute_dofs (DoFHandler<dim,spacedim> &dof_handler) const { - const unsigned int n_dofs = + const types::global_dof_index n_dofs = Implementation::distribute_dofs (0, numbers::invalid_subdomain_id, dof_handler); @@ -890,8 +893,8 @@ namespace internal number_cache.locally_owned_dofs.compress(); number_cache.n_locally_owned_dofs_per_processor - = std::vector<unsigned int> (1, - number_cache.n_global_dofs); + = std::vector<types::global_dof_index> (1, + number_cache.n_global_dofs); number_cache.locally_owned_dofs_per_processor = std::vector<IndexSet> (1, @@ -913,19 +916,23 @@ namespace internal for (unsigned int level = 0; level < dof_handler.get_tria().n_levels(); ++level) { - unsigned int next_free_dof = Implementation::distribute_dofs_on_level(0, numbers::invalid_subdomain_id, dof_handler, level); + types::global_dof_index next_free_dof = Implementation::distribute_dofs_on_level(0, numbers::invalid_subdomain_id, dof_handler, level); number_caches[level].n_global_dofs = next_free_dof; number_caches[level].n_locally_owned_dofs = next_free_dof; + number_caches[level].locally_owned_dofs = complete_index_set(next_free_dof); + number_caches[level].locally_owned_dofs_per_processor.resize(1); + number_caches[level].locally_owned_dofs_per_processor[0] = complete_index_set(next_free_dof); + number_caches[level].n_locally_owned_dofs_per_processor.resize(1); + number_caches[level].n_locally_owned_dofs_per_processor[0] = next_free_dof; } - const_cast<dealii::Triangulation<dim, spacedim>&>(dof_handler.get_tria()).load_user_flags (user_flags); } template <int dim, int spacedim> NumberCache Sequential<dim,spacedim>:: - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<types::global_dof_index> &new_numbers, dealii::DoFHandler<dim,spacedim> &dof_handler) const { Implementation::renumber_dofs (new_numbers, IndexSet(0), @@ -948,8 +955,8 @@ namespace internal number_cache.locally_owned_dofs.compress(); number_cache.n_locally_owned_dofs_per_processor - = std::vector<unsigned int> (1, - number_cache.n_global_dofs); + = std::vector<types::global_dof_index> (1, + number_cache.n_global_dofs); number_cache.locally_owned_dofs_per_processor = std::vector<IndexSet> (1, @@ -982,7 +989,7 @@ namespace internal { std::vector<unsigned int> tree_index; std::vector<typename dealii::internal::p4est::types<dim>::quadrant> quadrants; - std::vector<unsigned int> dofs; + std::vector<dealii::types::global_dof_index> dofs; unsigned int bytes_for_buffer () const { @@ -990,7 +997,7 @@ namespace internal tree_index.size() * sizeof(unsigned int) + quadrants.size() * sizeof(typename dealii::internal::p4est ::types<dim>::quadrant) + - dofs.size() * sizeof(unsigned int)); + dofs.size() * sizeof(dealii::types::global_dof_index)); } void pack_data (std::vector<char> &buffer) const @@ -1017,8 +1024,8 @@ namespace internal std::memcpy(ptr, &dofs[0], - dofs.size() * sizeof(unsigned int)); - ptr += dofs.size() * sizeof(unsigned int); + dofs.size() * sizeof(dealii::types::global_dof_index)); + ptr += dofs.size() * sizeof(dealii::types::global_dof_index); Assert (ptr == &buffer[0]+buffer.size(), ExcInternalError()); @@ -1092,7 +1099,7 @@ namespace internal // this cell's dof_indices // need to be sent to // someone - std::vector<unsigned int> + std::vector<dealii::types::global_dof_index> local_dof_indices (dealii_cell->get_fe().dofs_per_cell); dealii_cell->get_dof_indices (local_dof_indices); @@ -1210,7 +1217,7 @@ namespace internal // this cell's dof_indices // need to be sent to // someone - std::vector<unsigned int> + std::vector<dealii::types::global_dof_index> local_dof_indices (dealii_cell->get_fe().dofs_per_cell); dealii_cell->get_mg_dof_indices (local_dof_indices); @@ -1253,7 +1260,7 @@ namespace internal const typename dealii::internal::p4est::types<dim>::quadrant &p4est_cell, const typename DoFHandler<dim,spacedim>::level_cell_iterator &dealii_cell, const typename dealii::internal::p4est::types<dim>::quadrant &quadrant, - unsigned int *dofs) + dealii::types::global_dof_index *dofs) { if (internal::p4est::quadrant_is_equal<dim>(p4est_cell, quadrant)) { @@ -1261,7 +1268,7 @@ namespace internal Assert(dealii_cell->is_ghost(), ExcInternalError()); // update dof indices of cell - std::vector<unsigned int> + std::vector<dealii::types::global_dof_index> dof_indices (dealii_cell->get_fe().dofs_per_cell); dealii_cell->update_cell_dof_indices_cache(); dealii_cell->get_dof_indices(dof_indices); @@ -1320,7 +1327,7 @@ namespace internal const typename dealii::internal::p4est::types<dim>::quadrant &p4est_cell, const typename DoFHandler<dim,spacedim>::level_cell_iterator &dealii_cell, const typename dealii::internal::p4est::types<dim>::quadrant &quadrant, - unsigned int *dofs, + dealii::types::global_dof_index *dofs, unsigned int level) { if (internal::p4est::quadrant_is_equal<dim>(p4est_cell, quadrant)) @@ -1329,7 +1336,7 @@ namespace internal Assert(dealii_cell->level()==(int)level, ExcInternalError()); // update dof indices of cell - std::vector<unsigned int> + std::vector<dealii::types::global_dof_index> dof_indices (dealii_cell->get_fe().dofs_per_cell); dealii_cell->get_mg_dof_indices(dof_indices); @@ -1432,8 +1439,8 @@ namespace internal communicate_dof_indices_on_marked_cells (const DoFHandler<1,spacedim> &, const std::map<unsigned int, std::set<dealii::types::subdomain_id> > &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &) + const std::vector<dealii::types::global_dof_index> &, + const std::vector<dealii::types::global_dof_index> &) { Assert (false, ExcNotImplemented()); } @@ -1445,8 +1452,8 @@ namespace internal communicate_dof_indices_on_marked_cells (const DoFHandler<dim,spacedim> &dof_handler, const std::map<unsigned int, std::set<dealii::types::subdomain_id> > &vertices_with_ghost_neighbors, - const std::vector<unsigned int> &coarse_cell_to_p4est_tree_permutation, - const std::vector<unsigned int> &p4est_tree_to_coarse_cell_permutation) + const std::vector<dealii::types::global_dof_index> &coarse_cell_to_p4est_tree_permutation, + const std::vector<dealii::types::global_dof_index> &p4est_tree_to_coarse_cell_permutation) { #ifndef DEAL_II_WITH_P4EST (void)vertices_with_ghost_neighbors; @@ -1520,7 +1527,7 @@ namespace internal // that are going to send stuff to us std::set<dealii::types::subdomain_id> senders; { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::active_cell_iterator cell, endc = dof_handler.end(); @@ -1568,14 +1575,17 @@ namespace internal memcpy(&cells, ptr, sizeof(unsigned int)); ptr+=sizeof(unsigned int); - //reinterpret too evil? + //TODO: reinterpret too evil? unsigned int *treeindex=reinterpret_cast<unsigned int *>(ptr); ptr+=cells*sizeof(unsigned int); typename dealii::internal::p4est::types<dim>::quadrant *quadrant =reinterpret_cast<typename dealii::internal::p4est::types<dim>::quadrant *>(ptr); ptr+=cells*sizeof(typename dealii::internal::p4est::types<dim>::quadrant); - unsigned int *dofs=reinterpret_cast<unsigned int *>(ptr); + dealii::types::global_dof_index *dofs + = reinterpret_cast<dealii::types::global_dof_index *>(ptr); + // 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<cells; ++c, dofs+=1+dofs[0]) { typename DoFHandler<dim,spacedim>::level_cell_iterator @@ -1654,8 +1664,8 @@ namespace internal communicate_mg_dof_indices_on_marked_cells (const DoFHandler<1,spacedim> &, const std::map<unsigned int, std::set<dealii::types::subdomain_id> > &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<dealii::types::global_dof_index> &, + const std::vector<dealii::types::global_dof_index> &, const unsigned int) { Assert (false, ExcNotImplemented()); @@ -1668,8 +1678,8 @@ namespace internal communicate_mg_dof_indices_on_marked_cells (const DoFHandler<dim,spacedim> &dof_handler, const std::map<unsigned int, std::set<dealii::types::subdomain_id> > &vertices_with_ghost_neighbors, - const std::vector<unsigned int> &coarse_cell_to_p4est_tree_permutation, - const std::vector<unsigned int> &p4est_tree_to_coarse_cell_permutation, + const std::vector<dealii::types::global_dof_index> &coarse_cell_to_p4est_tree_permutation, + const std::vector<dealii::types::global_dof_index> &p4est_tree_to_coarse_cell_permutation, const unsigned int level) { #ifndef DEAL_II_WITH_P4EST @@ -1751,7 +1761,7 @@ namespace internal std::set<dealii::types::subdomain_id> senders; if (level < tr->n_levels()) { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::level_cell_iterator cell, endc = dof_handler.end(level); @@ -1810,8 +1820,11 @@ namespace internal typename dealii::internal::p4est::types<dim>::quadrant *quadrant =reinterpret_cast<typename dealii::internal::p4est::types<dim>::quadrant *>(ptr); ptr+=cells*sizeof(typename dealii::internal::p4est::types<dim>::quadrant); - unsigned int *dofs=reinterpret_cast<unsigned int *>(ptr); + dealii::types::global_dof_index *dofs + = reinterpret_cast<dealii::types::global_dof_index *>(ptr); + // 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<cells; ++c, dofs+=1+dofs[0]) { typename DoFHandler<dim,spacedim>::level_cell_iterator @@ -1907,19 +1920,19 @@ namespace internal //* 1. distribute on own //* subdomain - const unsigned int n_initial_local_dofs = + const dealii::types::global_dof_index n_initial_local_dofs = Implementation::distribute_dofs (0, tr->locally_owned_subdomain(), dof_handler); //* 2. iterate over ghostcells and //kill dofs that are not owned //by us - std::vector<unsigned int> renumbering(n_initial_local_dofs); + std::vector<dealii::types::global_dof_index> renumbering(n_initial_local_dofs); for (unsigned int i=0; i<renumbering.size(); ++i) renumbering[i] = i; { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -1953,7 +1966,7 @@ namespace internal // make indices consecutive number_cache.n_locally_owned_dofs = 0; - for (std::vector<unsigned int>::iterator it=renumbering.begin(); + for (std::vector<dealii::types::global_dof_index>::iterator it=renumbering.begin(); it!=renumbering.end(); ++it) if (*it != DoFHandler<dim,spacedim>::invalid_dof_index) *it = number_cache.n_locally_owned_dofs++; @@ -1963,19 +1976,19 @@ namespace internal number_cache.n_locally_owned_dofs_per_processor.resize(n_cpus); MPI_Allgather ( &number_cache.n_locally_owned_dofs, - 1, MPI_UNSIGNED, + 1, DEAL_II_DOF_INDEX_MPI_TYPE, &number_cache.n_locally_owned_dofs_per_processor[0], - 1, MPI_UNSIGNED, + 1, DEAL_II_DOF_INDEX_MPI_TYPE, tr->get_communicator()); - const unsigned int + const dealii::types::global_dof_index shift = std::accumulate (number_cache .n_locally_owned_dofs_per_processor.begin(), number_cache .n_locally_owned_dofs_per_processor.begin() + tr->locally_owned_subdomain(), - 0); - for (std::vector<unsigned int>::iterator it=renumbering.begin(); + static_cast<dealii::types::global_dof_index>(0)); + for (std::vector<dealii::types::global_dof_index>::iterator it=renumbering.begin(); it!=renumbering.end(); ++it) if (*it != DoFHandler<dim,spacedim>::invalid_dof_index) (*it) += shift; @@ -1995,7 +2008,7 @@ namespace internal .n_locally_owned_dofs_per_processor.begin(), number_cache .n_locally_owned_dofs_per_processor.end(), - 0); + static_cast<dealii::types::global_dof_index>(0)); number_cache.locally_owned_dofs = IndexSet(number_cache.n_global_dofs); number_cache.locally_owned_dofs @@ -2006,7 +2019,7 @@ namespace internal // fill global_dof_indexsets number_cache.locally_owned_dofs_per_processor.resize(n_cpus); { - unsigned int lshift = 0; + dealii::types::global_dof_index lshift = 0; for (unsigned int i=0; i<n_cpus; ++i) { number_cache.locally_owned_dofs_per_processor[i] @@ -2086,7 +2099,7 @@ namespace internal #ifdef DEBUG //check that we are really done { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::active_cell_iterator cell, endc = dof_handler.end(); @@ -2158,13 +2171,13 @@ namespace internal //* 2. iterate over ghostcells and //kill dofs that are not owned //by us - std::vector<unsigned int> renumbering(n_initial_local_dofs); - for (unsigned int i=0; i<renumbering.size(); ++i) + std::vector<dealii::types::global_dof_index> renumbering(n_initial_local_dofs); + for (dealii::types::global_dof_index i=0; i<renumbering.size(); ++i) renumbering[i] = i; if (level<tr->n_levels()) { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::level_cell_iterator cell = dof_handler.begin(level), @@ -2198,7 +2211,7 @@ namespace internal // make indices consecutive number_cache.n_locally_owned_dofs = 0; - for (std::vector<unsigned int>::iterator it=renumbering.begin(); + for (std::vector<dealii::types::global_dof_index>::iterator it=renumbering.begin(); it!=renumbering.end(); ++it) if (*it != DoFHandler<dim,spacedim>::invalid_dof_index) *it = number_cache.n_locally_owned_dofs++; @@ -2208,19 +2221,19 @@ namespace internal number_cache.n_locally_owned_dofs_per_processor.resize(n_cpus); MPI_Allgather ( &number_cache.n_locally_owned_dofs, - 1, MPI_UNSIGNED, + 1, DEAL_II_DOF_INDEX_MPI_TYPE, &number_cache.n_locally_owned_dofs_per_processor[0], - 1, MPI_UNSIGNED, + 1, DEAL_II_DOF_INDEX_MPI_TYPE, tr->get_communicator()); - const unsigned int + const dealii::types::global_dof_index shift = std::accumulate (number_cache .n_locally_owned_dofs_per_processor.begin(), number_cache .n_locally_owned_dofs_per_processor.begin() + tr->locally_owned_subdomain(), 0); - for (std::vector<unsigned int>::iterator it=renumbering.begin(); + for (std::vector<dealii::types::global_dof_index>::iterator it=renumbering.begin(); it!=renumbering.end(); ++it) if (*it != DoFHandler<dim,spacedim>::invalid_dof_index) (*it) += shift; @@ -2251,7 +2264,7 @@ namespace internal // fill global_dof_indexsets number_cache.locally_owned_dofs_per_processor.resize(n_cpus); { - unsigned int lshift = 0; + dealii::types::global_dof_index lshift = 0; for (unsigned int i=0; i<n_cpus; ++i) { number_cache.locally_owned_dofs_per_processor[i] @@ -2337,7 +2350,7 @@ namespace internal //check that we are really done if (level < tr->n_levels()) { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::level_cell_iterator cell, endc = dof_handler.end(level); @@ -2366,7 +2379,7 @@ namespace internal template <int dim, int spacedim> NumberCache ParallelDistributed<dim, spacedim>:: - renumber_dofs (const std::vector<unsigned int> &new_numbers, + renumber_dofs (const std::vector<dealii::types::global_dof_index> &new_numbers, dealii::DoFHandler<dim,spacedim> &dof_handler) const { Assert (new_numbers.size() == dof_handler.locally_owned_dofs().n_elements(), @@ -2391,9 +2404,9 @@ namespace internal number_cache.locally_owned_dofs = IndexSet (dof_handler.n_dofs()); if (dof_handler.locally_owned_dofs().n_elements()>0) { - std::vector<unsigned int>::const_iterator it = new_numbers.begin(); + std::vector<dealii::types::global_dof_index>::const_iterator it = new_numbers.begin(); const unsigned int n_blocks = dof_handler.get_fe().n_blocks(); - std::vector<std::pair<unsigned int,unsigned int> > block_indices(n_blocks); + std::vector<std::pair<dealii::types::global_dof_index,unsigned int> > block_indices(n_blocks); block_indices[0].first = *it++; block_indices[0].second = 1; unsigned int current_block = 0, n_filled_blocks = 1; @@ -2442,7 +2455,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; i<n_filled_blocks; ++i) sum += block_indices[i].second; @@ -2452,8 +2465,7 @@ namespace internal block_indices[i].first+ block_indices[i].second); else - for (it=new_numbers.begin() ; it != new_numbers.end(); ++it) - number_cache.locally_owned_dofs.add_index (*it); + number_cache.locally_owned_dofs.add_indices(new_numbers.begin(), new_numbers.end()); } @@ -2476,7 +2488,7 @@ namespace internal // mark not locally active DoFs as // invalid { - std::vector<unsigned int> local_dof_indices; + std::vector<dealii::types::global_dof_index> local_dof_indices; typename DoFHandler<dim,spacedim>::active_cell_iterator cell = dof_handler.begin_active(), @@ -2621,7 +2633,7 @@ namespace internal .n_locally_owned_dofs_per_processor.begin(), number_cache .n_locally_owned_dofs_per_processor.end(), - 0); + static_cast<dealii::types::global_dof_index>(0)); tr->load_user_flags(user_flags); } 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 f5709f1313..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 <deal.II/base/exceptions.h> #include <deal.II/base/memory_consumption.h> @@ -41,7 +43,7 @@ namespace internal const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index) + const types::global_dof_index global_index) { Assert ((fe_index == dealii::DoFHandler<dh_dim, spacedim>::default_fe_index), ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); diff --git a/deal.II/source/dofs/dof_objects.inst.in b/deal.II/source/dofs/dof_objects.inst.in index b2563c8dbe..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 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) @@ -21,7 +25,7 @@ for (deal_II_dimension : DIMENSIONS) for (deal_II_dimension, structdim : DIMENSIONS) { template - unsigned int + types::global_dof_index DoFObjects<structdim>:: get_dof_index (const dealii::DoFHandler<deal_II_dimension> &dof_handler, const unsigned int obj_index, @@ -35,12 +39,12 @@ for (deal_II_dimension, structdim : DIMENSIONS) const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index); + const types::global_dof_index global_index); #if (deal_II_dimension < 3) && (structdim < 3) template - unsigned int + types::global_dof_index DoFObjects<structdim>:: get_dof_index (const dealii::DoFHandler<deal_II_dimension,deal_II_dimension+1> &dof_handler, const unsigned int obj_index, @@ -54,14 +58,14 @@ for (deal_II_dimension, structdim : DIMENSIONS) const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index); + const types::global_dof_index global_index); #endif #if (deal_II_dimension == 3) && (structdim < 3) template - unsigned int + types::global_dof_index DoFObjects<structdim>:: get_dof_index (const dealii::DoFHandler<1,3> &dof_handler, const unsigned int obj_index, @@ -75,7 +79,7 @@ for (deal_II_dimension, structdim : DIMENSIONS) const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, - const unsigned int global_index); + const types::global_dof_index global_index); #endif } diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index 8295743bfa..52646d1be3 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -1,20 +1,23 @@ -//--------------------------------------------------------------------------- -// $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 <deal.II/base/thread_management.h> #include <deal.II/base/utilities.h> #include <deal.II/base/quadrature_lib.h> +#include <deal.II/base/types.h> #include <deal.II/base/template_constraints.h> #include <deal.II/lac/sparsity_pattern.h> @@ -68,7 +71,7 @@ namespace DoFRenumbering { namespace boost { - namespace types + namespace boosttypes { using namespace ::boost; using namespace std; @@ -88,8 +91,8 @@ namespace DoFRenumbering template <class DH> void create_graph (const DH &dof_handler, const bool use_constraints, - types::Graph &graph, - types::property_map<types::Graph,types::vertex_degree_t>::type &graph_degree) + boosttypes::Graph &graph, + boosttypes::property_map<boosttypes::Graph,boosttypes::vertex_degree_t>::type &graph_degree) { { // create intermediate sparsity pattern @@ -109,7 +112,7 @@ namespace DoFRenumbering add_edge (row, csp.column_number (row, col), graph); } - types::graph_traits<types::Graph>::vertex_iterator ui, ui_end; + boosttypes::graph_traits<boosttypes::Graph>::vertex_iterator ui, ui_end; graph_degree = get(::boost::vertex_degree, graph); for (::boost::tie(ui, ui_end) = vertices(graph); ui != ui_end; ++ui) @@ -124,8 +127,8 @@ namespace DoFRenumbering const bool reversed_numbering, const bool use_constraints) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_Cuthill_McKee(renumbering, dof_handler, reversed_numbering, use_constraints); @@ -138,23 +141,23 @@ namespace DoFRenumbering template <class DH> void - compute_Cuthill_McKee (std::vector<unsigned int> &new_dof_indices, + compute_Cuthill_McKee (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler, const bool reversed_numbering, const bool use_constraints) { - types::Graph + boosttypes::Graph graph(dof_handler.n_dofs()); - types::property_map<types::Graph,types::vertex_degree_t>::type + boosttypes::property_map<boosttypes::Graph,boosttypes::vertex_degree_t>::type graph_degree; internal::create_graph (dof_handler, use_constraints, graph, graph_degree); - types::property_map<types::Graph, types::vertex_index_t>::type + boosttypes::property_map<boosttypes::Graph, boosttypes::vertex_index_t>::type index_map = get(::boost::vertex_index, graph); - std::vector<types::Vertex> inv_perm(num_vertices(graph)); + std::vector<boosttypes::Vertex> inv_perm(num_vertices(graph)); if (reversed_numbering == false) ::boost::cuthill_mckee_ordering(graph, inv_perm.rbegin(), @@ -165,7 +168,7 @@ namespace DoFRenumbering get(::boost::vertex_color, graph), make_degree_map(graph)); - for (types::size_type c = 0; c != inv_perm.size(); ++c) + for (boosttypes::size_type c = 0; c != inv_perm.size(); ++c) new_dof_indices[index_map[inv_perm[c]]] = c; Assert (std::find (new_dof_indices.begin(), new_dof_indices.end(), @@ -181,8 +184,8 @@ namespace DoFRenumbering const bool reversed_numbering, const bool use_constraints) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_king_ordering(renumbering, dof_handler, reversed_numbering, use_constraints); @@ -195,30 +198,30 @@ namespace DoFRenumbering template <class DH> void - compute_king_ordering (std::vector<unsigned int> &new_dof_indices, + compute_king_ordering (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler, const bool reversed_numbering, const bool use_constraints) { - types::Graph + boosttypes::Graph graph(dof_handler.n_dofs()); - types::property_map<types::Graph,types::vertex_degree_t>::type + boosttypes::property_map<boosttypes::Graph,boosttypes::vertex_degree_t>::type graph_degree; internal::create_graph (dof_handler, use_constraints, graph, graph_degree); - types::property_map<types::Graph, types::vertex_index_t>::type + boosttypes::property_map<boosttypes::Graph, boosttypes::vertex_index_t>::type index_map = get(::boost::vertex_index, graph); - std::vector<types::Vertex> inv_perm(num_vertices(graph)); + std::vector<boosttypes::Vertex> inv_perm(num_vertices(graph)); if (reversed_numbering == false) ::boost::king_ordering(graph, inv_perm.rbegin()); else ::boost::king_ordering(graph, inv_perm.begin()); - for (types::size_type c = 0; c != inv_perm.size(); ++c) + for (boosttypes::size_type c = 0; c != inv_perm.size(); ++c) new_dof_indices[index_map[inv_perm[c]]] = c; Assert (std::find (new_dof_indices.begin(), new_dof_indices.end(), @@ -234,8 +237,8 @@ namespace DoFRenumbering const bool reversed_numbering, const bool use_constraints) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_minimum_degree(renumbering, dof_handler, reversed_numbering, use_constraints); @@ -248,7 +251,7 @@ namespace DoFRenumbering template <class DH> void - compute_minimum_degree (std::vector<unsigned int> &new_dof_indices, + compute_minimum_degree (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler, const bool reversed_numbering, const bool use_constraints) @@ -275,7 +278,7 @@ namespace DoFRenumbering Graph G(n); - std::vector<unsigned int> dofs_on_this_cell; + std::vector<dealii::types::global_dof_index> dofs_on_this_cell; typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -353,10 +356,10 @@ namespace DoFRenumbering Cuthill_McKee (DH &dof_handler, const bool reversed_numbering, const bool use_constraints, - const std::vector<unsigned int> &starting_indices) + const std::vector<types::global_dof_index> &starting_indices) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_Cuthill_McKee(renumbering, dof_handler, reversed_numbering, use_constraints, starting_indices); @@ -370,11 +373,11 @@ namespace DoFRenumbering template <class DH> void - compute_Cuthill_McKee (std::vector<unsigned int> &new_indices, + compute_Cuthill_McKee (std::vector<types::global_dof_index> &new_indices, const DH &dof_handler, const bool reversed_numbering, const bool use_constraints, - const std::vector<unsigned int> &starting_indices) + const std::vector<types::global_dof_index> &starting_indices) { // make the connection graph. in // more than 2d use an intermediate @@ -432,18 +435,30 @@ namespace DoFRenumbering void Cuthill_McKee (DH &dof_handler, const unsigned int level, const bool reversed_numbering, - const std::vector<unsigned int> &starting_indices) + const std::vector<types::global_dof_index> &starting_indices) { - Assert(dof_handler.n_dofs(level) != numbers::invalid_unsigned_int, + 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<unsigned int> new_indices(sparsity.n_rows()); + std::vector<types::global_dof_index> new_indices(sparsity.n_rows()); SparsityTools::reorder_Cuthill_McKee (sparsity, new_indices, starting_indices); @@ -463,19 +478,19 @@ namespace DoFRenumbering component_wise (DoFHandler<dim,spacedim> &dof_handler, const std::vector<unsigned int> &component_order_arg) { - std::vector<unsigned int> renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler<dim>::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_locally_owned_dofs(), + DoFHandler<dim>::invalid_dof_index); typename DoFHandler<dim,spacedim>::active_cell_iterator start = dof_handler.begin_active(); const typename DoFHandler<dim,spacedim>::level_cell_iterator end = dof_handler.end(); - const unsigned int result = + const types::global_dof_index result = compute_component_wise<dim,spacedim, typename DoFHandler<dim,spacedim>::active_cell_iterator, typename DoFHandler<dim,spacedim>::level_cell_iterator> - (renumbering, start, end, component_order_arg); + (renumbering, start, end, component_order_arg, false); if (result == 0) return; @@ -496,7 +511,7 @@ namespace DoFRenumbering dof_handler.renumber_dofs (renumbering); // for (unsigned int level=0;level<dof_handler.get_tria().n_levels();++level) - // if (dof_handler.n_dofs(level) != numbers::invalid_unsigned_int) + // if (dof_handler.n_dofs(level) != numbers::invalid_dof_index) // component_wise(dof_handler, level, component_order_arg); } @@ -519,19 +534,19 @@ namespace DoFRenumbering const std::vector<unsigned int> &component_order_arg) { //TODO: Merge with previous function - std::vector<unsigned int> renumbering (dof_handler.n_dofs(), - hp::DoFHandler<dim>::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_dofs(), + hp::DoFHandler<dim>::invalid_dof_index); typename hp::DoFHandler<dim>::active_cell_iterator start = dof_handler.begin_active(); const typename hp::DoFHandler<dim>::level_cell_iterator end = dof_handler.end(); - const unsigned int result = + const types::global_dof_index result = compute_component_wise<hp::DoFHandler<dim>::dimension,hp::DoFHandler<dim>::space_dimension, typename hp::DoFHandler<dim>::active_cell_iterator, typename hp::DoFHandler<dim>::level_cell_iterator> - (renumbering, start, end, component_order_arg); + (renumbering, start, end, component_order_arg, false); if (result == 0) return; @@ -549,19 +564,19 @@ namespace DoFRenumbering const unsigned int level, const std::vector<unsigned int> &component_order_arg) { - Assert(dof_handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); - std::vector<unsigned int> renumbering (dof_handler.n_dofs(level), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_dofs(level), + DH::invalid_dof_index); typename DH::level_cell_iterator start =dof_handler.begin(level); typename DH::level_cell_iterator end = dof_handler.end(level); - const unsigned int result = + const types::global_dof_index result = compute_component_wise<DH::dimension, DH::space_dimension, typename DH::level_cell_iterator, typename DH::level_cell_iterator> - (renumbering, start, end, component_order_arg); + (renumbering, start, end, component_order_arg, true); if (result == 0) return; @@ -575,11 +590,12 @@ namespace DoFRenumbering template <int dim, int spacedim, class ITERATOR, class ENDITERATOR> - unsigned int - compute_component_wise (std::vector<unsigned int> &new_indices, + types::global_dof_index + compute_component_wise (std::vector<types::global_dof_index> &new_indices, const ITERATOR &start, const ENDITERATOR &end, - const std::vector<unsigned int> &component_order_arg) + const std::vector<unsigned int> &component_order_arg, + bool is_level_operation) { const hp::FECollection<dim,spacedim> fe_collection (start->get_dof_handler().get_fe ()); @@ -612,7 +628,7 @@ namespace DoFRenumbering // vector to hold the dof indices on // the cell we visit at a time - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; // prebuilt list to which component // a given dof on a cell @@ -657,23 +673,37 @@ namespace DoFRenumbering // dof indices are entered // multiply, so we will have to // take care of that - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > component_to_dof_map (fe_collection.n_components()); for (ITERATOR cell=start; cell!=end; ++cell) - if (cell->is_locally_owned()) - { - // on each cell: get dof indices - // and insert them into the global - // list using their component - const unsigned int fe_index = cell->active_fe_index(); - const unsigned int dofs_per_cell = fe_collection[fe_index].dofs_per_cell; - local_dof_indices.resize (dofs_per_cell); - cell->get_active_or_mg_dof_indices (local_dof_indices); - for (unsigned int i=0; i<dofs_per_cell; ++i) - if (start->get_dof_handler().locally_owned_dofs().is_element(local_dof_indices[i])) - component_to_dof_map[component_list[fe_index][i]]. - push_back (local_dof_indices[i]); - } + { + if (is_level_operation) + { + //we are dealing with mg dofs, skip foreign level cells: + if ((start->get_dof_handler().get_tria().locally_owned_subdomain() != numbers::invalid_subdomain_id) + && + (cell->level_subdomain_id()!=start->get_dof_handler().get_tria().locally_owned_subdomain())) + continue; + } + else + { + //we are dealing with active dofs, skip the loop if not locally + // owned: + if (!cell->active() || !cell->is_locally_owned()) + continue; + } + // on each cell: get dof indices + // and insert them into the global + // list using their component + const unsigned int fe_index = cell->active_fe_index(); + const unsigned int dofs_per_cell = fe_collection[fe_index].dofs_per_cell; + local_dof_indices.resize (dofs_per_cell); + cell->get_active_or_mg_dof_indices (local_dof_indices); + for (unsigned int i=0; i<dofs_per_cell; ++i) + if (start->get_dof_handler().locally_owned_dofs().is_element(local_dof_indices[i])) + component_to_dof_map[component_list[fe_index][i]]. + push_back (local_dof_indices[i]); + } // now we've got all indices sorted // into buckets labeled by their @@ -712,26 +742,29 @@ namespace DoFRenumbering // calculate the number of locally owned // DoFs per bucket const unsigned int n_buckets = fe_collection.n_components(); - std::vector<unsigned int> shifts(n_buckets); + std::vector<types::global_dof_index> shifts(n_buckets); if (const parallel::distributed::Triangulation<dim,spacedim> *tria = (dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*> (&start->get_dof_handler().get_tria()))) { #ifdef DEAL_II_WITH_P4EST - std::vector<unsigned int> local_dof_count(n_buckets); + std::vector<types::global_dof_index> local_dof_count(n_buckets); for (unsigned int c=0; c<n_buckets; ++c) local_dof_count[c] = component_to_dof_map[c].size(); // gather information from all CPUs - std::vector<unsigned int> + std::vector<types::global_dof_index> all_dof_counts(fe_collection.n_components() * Utilities::MPI::n_mpi_processes (tria->get_communicator())); - MPI_Allgather ( &local_dof_count[0], n_buckets, MPI_UNSIGNED, &all_dof_counts[0], - n_buckets, MPI_UNSIGNED, 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()); for (unsigned int i=0; i<n_buckets; ++i) Assert (all_dof_counts[n_buckets*tria->locally_owned_subdomain()+i] @@ -767,16 +800,16 @@ namespace DoFRenumbering // now concatenate all the // components in the order the user // desired to see - unsigned int next_free_index = 0; + types::global_dof_index next_free_index = 0; for (unsigned int component=0; component<fe_collection.n_components(); ++component) { - const typename std::vector<unsigned int>::const_iterator + const typename std::vector<types::global_dof_index>::const_iterator begin_of_component = component_to_dof_map[component].begin(), end_of_component = component_to_dof_map[component].end(); next_free_index = shifts[component]; - for (typename std::vector<unsigned int>::const_iterator + for (typename std::vector<types::global_dof_index>::const_iterator dof_index = begin_of_component; dof_index != end_of_component; ++dof_index) { @@ -800,15 +833,15 @@ namespace DoFRenumbering void block_wise (DoFHandler<dim,spacedim> &dof_handler) { - std::vector<unsigned int> renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler<dim>::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_locally_owned_dofs(), + DoFHandler<dim>::invalid_dof_index); typename DoFHandler<dim,spacedim>::active_cell_iterator start = dof_handler.begin_active(); const typename DoFHandler<dim,spacedim>::level_cell_iterator end = dof_handler.end(); - const unsigned int result = + const types::global_dof_index result = compute_block_wise<dim, spacedim, typename DoFHandler<dim,spacedim>::active_cell_iterator, typename DoFHandler<dim,spacedim>::level_cell_iterator> (renumbering, start, end); @@ -838,15 +871,15 @@ namespace DoFRenumbering void block_wise (hp::DoFHandler<dim> &dof_handler) { - std::vector<unsigned int> renumbering (dof_handler.n_dofs(), - hp::DoFHandler<dim>::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_dofs(), + hp::DoFHandler<dim>::invalid_dof_index); typename hp::DoFHandler<dim>::active_cell_iterator start = dof_handler.begin_active(); const typename hp::DoFHandler<dim>::level_cell_iterator end = dof_handler.end(); - const unsigned int result = + const types::global_dof_index result = compute_block_wise<dim, dim, typename hp::DoFHandler<dim>::active_cell_iterator, typename hp::DoFHandler<dim>::level_cell_iterator>(renumbering, start, end); @@ -866,18 +899,18 @@ namespace DoFRenumbering void block_wise (DoFHandler<dim> &dof_handler, const unsigned int level) { - Assert(dof_handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); - std::vector<unsigned int> renumbering (dof_handler.n_dofs(level), - DoFHandler<dim>::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_dofs(level), + DoFHandler<dim>::invalid_dof_index); typename DoFHandler<dim>::level_cell_iterator start =dof_handler.begin(level); typename DoFHandler<dim>::level_cell_iterator end = dof_handler.end(level); - const unsigned int result = + const types::global_dof_index result = compute_block_wise<dim, dim, typename DoFHandler<dim>::level_cell_iterator, typename DoFHandler<dim>::level_cell_iterator>( renumbering, start, end); @@ -919,8 +952,8 @@ namespace DoFRenumbering template <int dim, int spacedim, class ITERATOR, class ENDITERATOR> - unsigned int - compute_block_wise (std::vector<unsigned int> &new_indices, + types::global_dof_index + compute_block_wise (std::vector<types::global_dof_index> &new_indices, const ITERATOR &start, const ENDITERATOR &end) { @@ -937,12 +970,12 @@ namespace DoFRenumbering // vector to hold the dof indices on // the cell we visit at a time - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; // prebuilt list to which block // a given dof on a cell // should go. - std::vector<std::vector<unsigned int> > block_list (fe_collection.size()); + std::vector<std::vector<types::global_dof_index> > block_list (fe_collection.size()); for (unsigned int f=0; f<fe_collection.size(); ++f) { const FiniteElement<dim,spacedim> &fe = fe_collection[f]; @@ -963,7 +996,7 @@ namespace DoFRenumbering // dof indices are entered // multiply, so we will have to // take care of that - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > block_to_dof_map (fe_collection.n_blocks()); for (ITERATOR cell=start; cell!=end; ++cell) if (cell->is_locally_owned()) @@ -1007,26 +1040,31 @@ namespace DoFRenumbering // calculate the number of locally owned // DoFs per bucket const unsigned int n_buckets = fe_collection.n_blocks(); - std::vector<unsigned int> shifts(n_buckets); + std::vector<types::global_dof_index> shifts(n_buckets); if (const parallel::distributed::Triangulation<dim,spacedim> *tria = (dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*> (&start->get_dof_handler().get_tria()))) { #ifdef DEAL_II_WITH_P4EST - std::vector<unsigned int> local_dof_count(n_buckets); + std::vector<types::global_dof_index> local_dof_count(n_buckets); for (unsigned int c=0; c<n_buckets; ++c) local_dof_count[c] = block_to_dof_map[c].size(); // gather information from all CPUs - std::vector<unsigned int> + std::vector<types::global_dof_index> all_dof_counts(fe_collection.n_components() * Utilities::MPI::n_mpi_processes (tria->get_communicator())); - MPI_Allgather ( &local_dof_count[0], n_buckets, MPI_UNSIGNED, &all_dof_counts[0], - n_buckets, MPI_UNSIGNED, tria->get_communicator()); + 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()); for (unsigned int i=0; i<n_buckets; ++i) Assert (all_dof_counts[n_buckets*tria->locally_owned_subdomain()+i] @@ -1062,16 +1100,16 @@ namespace DoFRenumbering // now concatenate all the // components in the order the user // desired to see - unsigned int next_free_index = 0; + types::global_dof_index next_free_index = 0; for (unsigned int block=0; block<fe_collection.n_blocks(); ++block) { - const typename std::vector<unsigned int>::const_iterator + const typename std::vector<types::global_dof_index>::const_iterator begin_of_component = block_to_dof_map[block].begin(), end_of_component = block_to_dof_map[block].end(); next_free_index = shifts[block]; - for (typename std::vector<unsigned int>::const_iterator + for (typename std::vector<types::global_dof_index>::const_iterator dof_index = begin_of_component; dof_index != end_of_component; ++dof_index) { @@ -1097,10 +1135,10 @@ namespace DoFRenumbering // Note that this function only works for active dofs. template <int dim, class iterator> - unsigned int + types::global_dof_index compute_hierarchical_recursive ( - unsigned int next_free, - std::vector<unsigned int> &new_indices, + types::global_dof_index next_free, + std::vector<types::global_dof_index> &new_indices, const iterator &cell, const IndexSet &locally_owned) { @@ -1119,7 +1157,7 @@ namespace DoFRenumbering if (cell->is_locally_owned()) { const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); cell->get_dof_indices (local_dof_indices); for (unsigned int i = 0; i < dofs_per_cell; ++i) @@ -1147,12 +1185,12 @@ namespace DoFRenumbering void hierarchical (DoFHandler<dim> &dof_handler) { - std::vector<unsigned int> renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler<dim>::invalid_dof_index); + std::vector<types::global_dof_index> renumbering (dof_handler.n_locally_owned_dofs(), + DoFHandler<dim>::invalid_dof_index); typename DoFHandler<dim>::level_cell_iterator cell; - unsigned int next_free = 0; + types::global_dof_index next_free = 0; const IndexSet locally_owned = dof_handler.locally_owned_dofs(); const parallel::distributed::Triangulation<dim> *tria @@ -1208,7 +1246,7 @@ namespace DoFRenumbering // make sure that all local DoFs got new numbers assigned Assert (std::find (renumbering.begin(), renumbering.end(), - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) == renumbering.end(), ExcInternalError()); @@ -1222,8 +1260,8 @@ namespace DoFRenumbering sort_selected_dofs_back (DH &dof_handler, const std::vector<bool> &selected_dofs) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_sort_selected_dofs_back(renumbering, dof_handler, selected_dofs); dof_handler.renumber_dofs(renumbering); @@ -1237,11 +1275,11 @@ namespace DoFRenumbering const std::vector<bool> &selected_dofs, const unsigned int level) { - Assert(dof_handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); - std::vector<unsigned int> renumbering(dof_handler.n_dofs(level), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(level), + DH::invalid_dof_index); compute_sort_selected_dofs_back(renumbering, dof_handler, selected_dofs, level); dof_handler.renumber_dofs(level, renumbering); @@ -1251,11 +1289,11 @@ namespace DoFRenumbering template <class DH> void - compute_sort_selected_dofs_back (std::vector<unsigned int> &new_indices, + compute_sort_selected_dofs_back (std::vector<types::global_dof_index> &new_indices, const DH &dof_handler, const std::vector<bool> &selected_dofs) { - const unsigned int n_dofs = dof_handler.n_dofs(); + const types::global_dof_index n_dofs = dof_handler.n_dofs(); Assert (selected_dofs.size() == n_dofs, ExcDimensionMismatch (selected_dofs.size(), n_dofs)); @@ -1264,13 +1302,13 @@ namespace DoFRenumbering Assert (new_indices.size() == n_dofs, ExcDimensionMismatch(new_indices.size(), n_dofs)); - const unsigned int n_selected_dofs = std::count (selected_dofs.begin(), - selected_dofs.end(), - false); + const types::global_dof_index n_selected_dofs = std::count (selected_dofs.begin(), + selected_dofs.end(), + false); - unsigned int next_unselected = 0; - unsigned int next_selected = n_selected_dofs; - for (unsigned int i=0; i<n_dofs; ++i) + types::global_dof_index next_unselected = 0; + types::global_dof_index next_selected = n_selected_dofs; + for (types::global_dof_index i=0; i<n_dofs; ++i) if (selected_dofs[i] == false) { new_indices[i] = next_unselected; @@ -1289,12 +1327,12 @@ namespace DoFRenumbering template <class DH> void - compute_sort_selected_dofs_back (std::vector<unsigned int> &new_indices, + compute_sort_selected_dofs_back (std::vector<types::global_dof_index> &new_indices, const DH &dof_handler, const std::vector<bool> &selected_dofs, const unsigned int level) { - Assert(dof_handler.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); const unsigned int n_dofs = dof_handler.n_dofs(level); @@ -1333,8 +1371,8 @@ namespace DoFRenumbering void cell_wise (DH &dof, const std::vector<typename DH::active_cell_iterator> &cells) { - std::vector<unsigned int> renumbering(dof.n_dofs()); - std::vector<unsigned int> reverse(dof.n_dofs()); + std::vector<types::global_dof_index> renumbering(dof.n_dofs()); + std::vector<types::global_dof_index> reverse(dof.n_dofs()); compute_cell_wise(renumbering, reverse, dof, cells); dof.renumber_dofs(renumbering); @@ -1344,8 +1382,8 @@ namespace DoFRenumbering template <class DH> void compute_cell_wise ( - std::vector<unsigned int> &new_indices, - std::vector<unsigned int> &reverse, + std::vector<types::global_dof_index> &new_indices, + std::vector<types::global_dof_index> &reverse, const DH &dof, const typename std::vector<typename DH::active_cell_iterator> &cells) { @@ -1353,7 +1391,7 @@ namespace DoFRenumbering ExcDimensionMismatch(cells.size(), dof.get_tria().n_active_cells())); - unsigned int n_global_dofs = dof.n_dofs(); + types::global_dof_index n_global_dofs = dof.n_dofs(); // Actually, we compute the // inverse of the reordering @@ -1371,7 +1409,7 @@ namespace DoFRenumbering // make sure, that each dof is // reordered only once. std::vector<bool> already_sorted(n_global_dofs, false); - std::vector<unsigned int> cell_dofs; + std::vector<types::global_dof_index> cell_dofs; unsigned int global_index = 0; @@ -1405,7 +1443,7 @@ namespace DoFRenumbering } Assert(global_index == n_global_dofs, ExcRenumberingIncomplete()); - for (unsigned int i=0; i<reverse.size(); ++i) + for (types::global_dof_index i=0; i<reverse.size(); ++i) new_indices[reverse[i]] = i; } @@ -1417,11 +1455,11 @@ namespace DoFRenumbering const unsigned int level, const typename std::vector<typename DH::level_cell_iterator> &cells) { - Assert(dof.n_dofs(level) != numbers::invalid_unsigned_int, + Assert(dof.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); - std::vector<unsigned int> renumbering(dof.n_dofs(level)); - std::vector<unsigned int> reverse(dof.n_dofs(level)); + std::vector<types::global_dof_index> renumbering(dof.n_dofs(level)); + std::vector<types::global_dof_index> reverse(dof.n_dofs(level)); compute_cell_wise(renumbering, reverse, dof, level, cells); dof.renumber_dofs(level, renumbering); @@ -1431,8 +1469,8 @@ namespace DoFRenumbering template <class DH> void compute_cell_wise ( - std::vector<unsigned int> &new_order, - std::vector<unsigned int> &reverse, + std::vector<types::global_dof_index> &new_order, + std::vector<types::global_dof_index> &reverse, const DH &dof, const unsigned int level, const typename std::vector<typename DH::level_cell_iterator> &cells) @@ -1449,7 +1487,7 @@ namespace DoFRenumbering unsigned int n_cell_dofs = dof.get_fe().n_dofs_per_cell(); std::vector<bool> already_sorted(n_global_dofs, false); - std::vector<unsigned int> cell_dofs(n_cell_dofs); + std::vector<types::global_dof_index> cell_dofs(n_cell_dofs); unsigned int global_index = 0; @@ -1473,7 +1511,7 @@ namespace DoFRenumbering } Assert(global_index == n_global_dofs, ExcRenumberingIncomplete()); - for (unsigned int i=0; i<new_order.size(); ++i) + for (types::global_dof_index i=0; i<new_order.size(); ++i) new_order[reverse[i]] = i; } @@ -1485,8 +1523,8 @@ namespace DoFRenumbering const Point<DH::space_dimension> &direction, const bool dof_wise_renumbering) { - std::vector<unsigned int> renumbering(dof.n_dofs()); - std::vector<unsigned int> reverse(dof.n_dofs()); + std::vector<types::global_dof_index> renumbering(dof.n_dofs()); + std::vector<types::global_dof_index> reverse(dof.n_dofs()); compute_downstream(renumbering, reverse, dof, direction, dof_wise_renumbering); @@ -1508,22 +1546,26 @@ namespace DoFRenumbering template <class DH> void compute_downstream ( - std::vector<unsigned int> &new_indices, - std::vector<unsigned int> &reverse, + std::vector<types::global_dof_index> &new_indices, + std::vector<types::global_dof_index> &reverse, const DH &dof, const Point<DH::space_dimension> &direction, const bool dof_wise_renumbering) { if (dof_wise_renumbering == false) { - std::vector<typename DH::active_cell_iterator> - ordered_cells(dof.get_tria().n_active_cells()); + std::vector<typename DH::active_cell_iterator> ordered_cells; + ordered_cells.reserve(dof.get_tria().n_active_cells()); const CompareDownstream<typename DH::active_cell_iterator, DH::space_dimension> 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); @@ -1558,7 +1600,7 @@ namespace DoFRenumbering std::vector<bool> already_touched (n_dofs, false); - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; typename DH::active_cell_iterator begin = dof.begin_active(); typename DH::active_cell_iterator end = dof.end(); for ( ; begin != end; ++begin) @@ -1584,7 +1626,7 @@ namespace DoFRenumbering ComparePointwiseDownstream<DH::space_dimension> comparator (direction); std::sort (support_point_list.begin(), support_point_list.end(), comparator); - for (unsigned int i=0; i<n_dofs; ++i) + for (types::global_dof_index i=0; i<n_dofs; ++i) new_indices[support_point_list[i].second] = i; } } @@ -1597,8 +1639,8 @@ namespace DoFRenumbering const Point<DH::space_dimension> &direction, const bool dof_wise_renumbering) { - std::vector<unsigned int> renumbering(dof.n_dofs(level)); - std::vector<unsigned int> reverse(dof.n_dofs(level)); + std::vector<types::global_dof_index> renumbering(dof.n_dofs(level)); + std::vector<types::global_dof_index> reverse(dof.n_dofs(level)); compute_downstream(renumbering, reverse, dof, level, direction, dof_wise_renumbering); @@ -1610,8 +1652,8 @@ namespace DoFRenumbering template <class DH> void compute_downstream ( - std::vector<unsigned int> &new_indices, - std::vector<unsigned int> &reverse, + std::vector<types::global_dof_index> &new_indices, + std::vector<types::global_dof_index> &reverse, const DH &dof, const unsigned int level, const Point<DH::space_dimension> &direction, @@ -1619,14 +1661,18 @@ namespace DoFRenumbering { if (dof_wise_renumbering == false) { - std::vector<typename DH::level_cell_iterator> - ordered_cells(dof.get_tria().n_cells(level)); + std::vector<typename DH::level_cell_iterator> ordered_cells; + ordered_cells.reserve (dof.get_tria().n_cells(level)); const CompareDownstream<typename DH::level_cell_iterator, DH::space_dimension> 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); @@ -1646,7 +1692,7 @@ namespace DoFRenumbering std::vector<bool> already_touched (dof.n_dofs(), false); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DH::level_cell_iterator begin = dof.begin(level); typename DH::level_cell_iterator end = dof.end(level); for ( ; begin != end; ++begin) @@ -1669,7 +1715,7 @@ namespace DoFRenumbering ComparePointwiseDownstream<DH::space_dimension> comparator (direction); std::sort (support_point_list.begin(), support_point_list.end(), comparator); - for (unsigned int i=0; i<n_dofs; ++i) + for (types::global_dof_index i=0; i<n_dofs; ++i) new_indices[support_point_list[i].second] = i; } } @@ -1756,7 +1802,7 @@ namespace DoFRenumbering const Point<DH::space_dimension> &center, const bool counter) { - std::vector<unsigned int> renumbering(dof.n_dofs()); + std::vector<types::global_dof_index> renumbering(dof.n_dofs()); compute_clockwise_dg(renumbering, dof, center, counter); dof.renumber_dofs(renumbering); @@ -1767,22 +1813,26 @@ namespace DoFRenumbering template <class DH> void compute_clockwise_dg ( - std::vector<unsigned int> &new_indices, + std::vector<types::global_dof_index> &new_indices, const DH &dof, const Point<DH::space_dimension> &center, const bool counter) { - std::vector<typename DH::active_cell_iterator> - ordered_cells(dof.get_tria().n_active_cells()); + std::vector<typename DH::active_cell_iterator> ordered_cells; + ordered_cells.reserve (dof.get_tria().n_active_cells()); internal::ClockCells<DH::space_dimension> 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<unsigned int> reverse(new_indices.size()); + std::vector<types::global_dof_index> reverse(new_indices.size()); compute_cell_wise(new_indices, reverse, dof, ordered_cells); } @@ -1794,14 +1844,18 @@ namespace DoFRenumbering const Point<DH::space_dimension> &center, const bool counter) { - std::vector<typename DH::level_cell_iterator> - ordered_cells(dof.get_tria().n_cells(level)); + std::vector<typename DH::level_cell_iterator> ordered_cells; + ordered_cells.reserve(dof.get_tria().n_active_cells()); internal::ClockCells<DH::space_dimension> 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); @@ -1813,8 +1867,8 @@ namespace DoFRenumbering void random (DH &dof_handler) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_random(renumbering, dof_handler); dof_handler.renumber_dofs(renumbering); @@ -1825,10 +1879,10 @@ namespace DoFRenumbering template <class DH> void compute_random ( - std::vector<unsigned int> &new_indices, + std::vector<types::global_dof_index> &new_indices, const DH &dof_handler) { - const unsigned int n_dofs = dof_handler.n_dofs(); + const types::global_dof_index n_dofs = dof_handler.n_dofs(); Assert(new_indices.size() == n_dofs, ExcDimensionMismatch(new_indices.size(), n_dofs)); @@ -1844,8 +1898,8 @@ namespace DoFRenumbering void subdomain_wise (DH &dof_handler) { - std::vector<unsigned int> renumbering(dof_handler.n_dofs(), - DH::invalid_dof_index); + std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(), + DH::invalid_dof_index); compute_subdomain_wise(renumbering, dof_handler); dof_handler.renumber_dofs(renumbering); @@ -1855,10 +1909,10 @@ namespace DoFRenumbering template <class DH> void - compute_subdomain_wise (std::vector<unsigned int> &new_dof_indices, + compute_subdomain_wise (std::vector<types::global_dof_index> &new_dof_indices, const DH &dof_handler) { - const unsigned int n_dofs = dof_handler.n_dofs(); + const types::global_dof_index n_dofs = dof_handler.n_dofs(); Assert (new_dof_indices.size() == n_dofs, ExcDimensionMismatch (new_dof_indices.size(), n_dofs)); @@ -1880,13 +1934,13 @@ namespace DoFRenumbering // same subdomain, then they will be in // this order also after reordering std::fill (new_dof_indices.begin(), new_dof_indices.end(), - numbers::invalid_unsigned_int); - unsigned int next_free_index = 0; + numbers::invalid_dof_index); + types::global_dof_index next_free_index = 0; for (types::subdomain_id subdomain=0; subdomain<n_subdomains; ++subdomain) - for (unsigned int i=0; i<n_dofs; ++i) + for (types::global_dof_index i=0; i<n_dofs; ++i) if (subdomain_association[i] == subdomain) { - Assert (new_dof_indices[i] == numbers::invalid_unsigned_int, + Assert (new_dof_indices[i] == numbers::invalid_dof_index, ExcInternalError()); new_dof_indices[i] = next_free_index; ++next_free_index; @@ -1895,7 +1949,7 @@ namespace DoFRenumbering // we should have numbered all dofs Assert (next_free_index == n_dofs, ExcInternalError()); Assert (std::find (new_dof_indices.begin(), new_dof_indices.end(), - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) == new_dof_indices.end(), ExcInternalError()); } diff --git a/deal.II/source/dofs/dof_renumbering.inst.in b/deal.II/source/dofs/dof_renumbering.inst.in index fcfc82d843..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) { @@ -28,16 +32,16 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS (DoFHandler<deal_II_dimension,deal_II_space_dimension>&, const bool, const bool, - const std::vector<unsigned int>&); + const std::vector<types::global_dof_index>&); template void compute_Cuthill_McKee<DoFHandler<deal_II_dimension,deal_II_space_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension,deal_II_space_dimension>&, const bool, const bool, - const std::vector<unsigned int>&); + const std::vector<types::global_dof_index>&); template void component_wise<deal_II_dimension,deal_II_space_dimension> @@ -72,7 +76,7 @@ namespace DoFRenumbering template void - compute_Cuthill_McKee (std::vector<unsigned int> &, + compute_Cuthill_McKee (std::vector<dealii::types::global_dof_index> &, const DoFHandler<deal_II_dimension> &, bool, bool); template @@ -81,7 +85,7 @@ namespace DoFRenumbering template void - compute_king_ordering (std::vector<unsigned int> &, + compute_king_ordering (std::vector<dealii::types::global_dof_index> &, const DoFHandler<deal_II_dimension> &, bool, bool); template @@ -90,7 +94,7 @@ namespace DoFRenumbering template void - compute_minimum_degree (std::vector<unsigned int> &, + compute_minimum_degree (std::vector<dealii::types::global_dof_index> &, const DoFHandler<deal_II_dimension> &, bool, bool); @@ -100,7 +104,7 @@ namespace DoFRenumbering template void - compute_Cuthill_McKee (std::vector<unsigned int> &, + compute_Cuthill_McKee (std::vector<dealii::types::global_dof_index> &, const hp::DoFHandler<deal_II_dimension> &, bool, bool); template @@ -109,7 +113,7 @@ namespace DoFRenumbering template void - compute_king_ordering (std::vector<unsigned int> &, + compute_king_ordering (std::vector<dealii::types::global_dof_index> &, const hp::DoFHandler<deal_II_dimension> &, bool, bool); template @@ -118,7 +122,7 @@ namespace DoFRenumbering template void - compute_minimum_degree (std::vector<unsigned int> &, + compute_minimum_degree (std::vector<dealii::types::global_dof_index> &, const hp::DoFHandler<deal_II_dimension> &, bool, bool); \} @@ -130,16 +134,16 @@ namespace DoFRenumbering (hp::DoFHandler<deal_II_dimension>&, const bool, const bool, - const std::vector<unsigned int>&); + const std::vector<types::global_dof_index>&); template void compute_Cuthill_McKee<hp::DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const hp::DoFHandler<deal_II_dimension>&, const bool, const bool, - const std::vector<unsigned int>&); + const std::vector<types::global_dof_index>&); template void component_wise @@ -183,7 +187,7 @@ namespace DoFRenumbering template void compute_cell_wise<DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension>&, const std::vector<DoFHandler<deal_II_dimension>::active_cell_iterator>&); @@ -194,7 +198,7 @@ namespace DoFRenumbering template void compute_cell_wise<DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension>&, unsigned int, const std::vector<DoFHandler<deal_II_dimension>::level_cell_iterator>&); @@ -205,7 +209,7 @@ namespace DoFRenumbering template void compute_downstream<DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&,std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&,std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&, const bool); @@ -217,7 +221,7 @@ namespace DoFRenumbering template void compute_clockwise_dg<DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, const DoFHandler<deal_II_dimension>&, + (std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&, const bool); // Renumbering for hp::DoFHandler @@ -229,7 +233,7 @@ namespace DoFRenumbering template void compute_cell_wise<hp::DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, std::vector<types::global_dof_index>&, const hp::DoFHandler<deal_II_dimension>&, const std::vector<hp::DoFHandler<deal_II_dimension>::active_cell_iterator>&); @@ -254,7 +258,7 @@ namespace DoFRenumbering template void compute_downstream<hp::DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&,std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&,std::vector<types::global_dof_index>&, const hp::DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&, const bool); @@ -268,7 +272,7 @@ namespace DoFRenumbering template void compute_clockwise_dg<hp::DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const hp::DoFHandler<deal_II_dimension>&, const Point<deal_II_dimension>&, const bool); @@ -296,7 +300,7 @@ namespace DoFRenumbering template void compute_random<DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension> &); template @@ -313,14 +317,14 @@ namespace DoFRenumbering template void compute_sort_selected_dofs_back<DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const DoFHandler<deal_II_dimension> &, const std::vector<bool> &); template void compute_sort_selected_dofs_back<MGDoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const MGDoFHandler<deal_II_dimension> &, const std::vector<bool> &, const unsigned int); @@ -332,7 +336,7 @@ namespace DoFRenumbering template void compute_random<hp::DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const hp::DoFHandler<deal_II_dimension> &); template @@ -343,7 +347,7 @@ namespace DoFRenumbering template void compute_sort_selected_dofs_back<hp::DoFHandler<deal_II_dimension> > - (std::vector<unsigned int>&, + (std::vector<types::global_dof_index>&, const hp::DoFHandler<deal_II_dimension> &, const std::vector<bool> &); @@ -357,14 +361,14 @@ namespace DoFRenumbering (DoFHandler<deal_II_dimension>&, const unsigned int, const bool, - const std::vector<unsigned int>&); + const std::vector<types::global_dof_index>&); template void Cuthill_McKee<MGDoFHandler<deal_II_dimension> > (MGDoFHandler<deal_II_dimension>&, const unsigned int, const bool, - const std::vector<unsigned int>&); + const std::vector<types::global_dof_index>&); \} // namespace DoFRenumbering #endif diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index 4772293030..10bf20eae2 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_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 <deal.II/base/multithread_info.h> #include <deal.II/base/thread_management.h> @@ -61,7 +63,7 @@ namespace DoFTools const bool keep_constrained_dofs, const types::subdomain_id subdomain_id) { - const unsigned int n_dofs = dof.n_dofs(); + const types::global_dof_index n_dofs = dof.n_dofs(); Assert (sparsity.n_rows() == n_dofs, ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); @@ -81,7 +83,7 @@ namespace DoFTools "associated DoF handler objects, asking for any subdomain other " "than the locally owned one does not make sense.")); - std::vector<unsigned int> dofs_on_this_cell; + std::vector<types::global_dof_index> 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(); @@ -120,7 +122,7 @@ namespace DoFTools const bool keep_constrained_dofs, const types::subdomain_id subdomain_id) { - const unsigned int n_dofs = dof.n_dofs(); + const types::global_dof_index n_dofs = dof.n_dofs(); Assert (sparsity.n_rows() == n_dofs, ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); @@ -192,7 +194,7 @@ namespace DoFTools } - std::vector<unsigned int> dofs_on_this_cell(fe_collection.max_dofs_per_cell()); + std::vector<types::global_dof_index> dofs_on_this_cell(fe_collection.max_dofs_per_cell()); typename DH::active_cell_iterator cell = dof.begin_active(), endc = dof.end(); @@ -232,8 +234,8 @@ namespace DoFTools const DH &dof_col, SparsityPattern &sparsity) { - const unsigned int n_dofs_row = dof_row.n_dofs(); - const unsigned int n_dofs_col = dof_col.n_dofs(); + 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)); @@ -263,9 +265,9 @@ namespace DoFTools cell_row->get_fe().dofs_per_cell; const unsigned int dofs_per_cell_col = cell_col->get_fe().dofs_per_cell; - std::vector<unsigned int> + std::vector<types::global_dof_index> local_dof_indices_row(dofs_per_cell_row); - std::vector<unsigned int> + std::vector<types::global_dof_index> 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); @@ -286,9 +288,9 @@ namespace DoFTools cell_row_child->get_fe().dofs_per_cell; const unsigned int dofs_per_cell_col = cell_col->get_fe().dofs_per_cell; - std::vector<unsigned int> + std::vector<types::global_dof_index> local_dof_indices_row(dofs_per_cell_row); - std::vector<unsigned int> + std::vector<types::global_dof_index> 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); @@ -310,9 +312,9 @@ namespace DoFTools cell_row->get_fe().dofs_per_cell; const unsigned int dofs_per_cell_col = cell_col_child->get_fe().dofs_per_cell; - std::vector<unsigned int> + std::vector<types::global_dof_index> local_dof_indices_row(dofs_per_cell_row); - std::vector<unsigned int> + std::vector<types::global_dof_index> 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); @@ -331,7 +333,7 @@ namespace DoFTools void make_boundary_sparsity_pattern ( const DH &dof, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SparsityPattern &sparsity) { if (DH::dimension == 1) @@ -348,7 +350,7 @@ namespace DoFTools return; } - const unsigned int n_dofs = dof.n_dofs(); + 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()); @@ -356,8 +358,8 @@ namespace DoFTools #ifdef DEBUG if (sparsity.n_rows() != 0) { - unsigned int max_element = 0; - for (std::vector<unsigned int>::const_iterator i=dof_to_boundary_mapping.begin(); + types::global_dof_index max_element = 0; + for (std::vector<types::global_dof_index>::const_iterator i=dof_to_boundary_mapping.begin(); i!=dof_to_boundary_mapping.end(); ++i) if ((*i != DH::invalid_dof_index) && (*i > max_element)) @@ -366,7 +368,7 @@ namespace DoFTools }; #endif - std::vector<unsigned int> dofs_on_this_face; + std::vector<types::global_dof_index> 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 @@ -399,7 +401,7 @@ namespace DoFTools void make_boundary_sparsity_pattern ( const DH &dof, const typename FunctionMap<DH::space_dimension>::type &boundary_indicators, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SparsityPattern &sparsity) { if (DH::dimension == 1) @@ -421,7 +423,7 @@ namespace DoFTools cell = cell->child(direction); const unsigned int dofs_per_vertex = cell->get_fe().dofs_per_vertex; - std::vector<unsigned int> boundary_dof_boundary_indices (dofs_per_vertex); + std::vector<types::global_dof_index> boundary_dof_boundary_indices (dofs_per_vertex); // next get boundary mapped dof indices of boundary dofs for (unsigned int i=0; i<dofs_per_vertex; ++i) @@ -436,7 +438,7 @@ namespace DoFTools return; } - const unsigned int n_dofs = dof.n_dofs(); + const types::global_dof_index n_dofs = dof.n_dofs(); AssertDimension (dof_to_boundary_mapping.size(), n_dofs); Assert (boundary_indicators.find(numbers::internal_face_boundary_id) == boundary_indicators.end(), @@ -448,8 +450,8 @@ namespace DoFTools #ifdef DEBUG if (sparsity.n_rows() != 0) { - unsigned int max_element = 0; - for (std::vector<unsigned int>::const_iterator i=dof_to_boundary_mapping.begin(); + types::global_dof_index max_element = 0; + for (std::vector<types::global_dof_index>::const_iterator i=dof_to_boundary_mapping.begin(); i!=dof_to_boundary_mapping.end(); ++i) if ((*i != DH::invalid_dof_index) && (*i > max_element)) @@ -458,7 +460,7 @@ namespace DoFTools }; #endif - std::vector<unsigned int> dofs_on_this_face; + std::vector<types::global_dof_index> 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(); @@ -493,7 +495,7 @@ namespace DoFTools // TODO: QA: reduce the indentation level of this method..., Maier 2012 { - const unsigned int n_dofs = dof.n_dofs(); + const types::global_dof_index n_dofs = dof.n_dofs(); AssertDimension (sparsity.n_rows(), n_dofs); AssertDimension (sparsity.n_cols(), n_dofs); @@ -511,8 +513,8 @@ namespace DoFTools "associated DoF handler objects, asking for any subdomain other " "than the locally owned one does not make sense.")); - std::vector<unsigned int> dofs_on_this_cell; - std::vector<unsigned int> dofs_on_other_cell; + std::vector<types::global_dof_index> dofs_on_this_cell; + std::vector<types::global_dof_index> 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(), @@ -609,8 +611,10 @@ namespace DoFTools // is not locally owned - otherwise, we touch each // face twice and hence put the indices the other way // around - if (cell->neighbor(face)->subdomain_id() != - cell->subdomain_id()) + 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); @@ -709,8 +713,8 @@ namespace DoFTools { const FiniteElement<DH::dimension,DH::space_dimension> &fe = dof.get_fe(); - std::vector<unsigned int> dofs_on_this_cell(fe.dofs_per_cell); - std::vector<unsigned int> dofs_on_other_cell(fe.dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_this_cell(fe.dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_other_cell(fe.dofs_per_cell); const Table<2,Coupling> int_dof_mask = dof_couplings_from_component_couplings(fe, int_mask), @@ -949,8 +953,8 @@ namespace DoFTools const dealii::hp::FECollection<dim,spacedim> &fe = dof.get_fe(); - std::vector<unsigned int> dofs_on_this_cell(DoFTools::max_dofs_per_cell(dof)); - std::vector<unsigned int> dofs_on_other_cell(DoFTools::max_dofs_per_cell(dof)); + std::vector<types::global_dof_index> dofs_on_this_cell(DoFTools::max_dofs_per_cell(dof)); + std::vector<types::global_dof_index> dofs_on_other_cell(DoFTools::max_dofs_per_cell(dof)); const std::vector<Table<2,Coupling> > int_dof_mask @@ -1133,7 +1137,7 @@ namespace DoFTools { // do the error checking and frame code here, and then pass on to more // specialized functions in the internal namespace - const unsigned int n_dofs = dof.n_dofs(); + 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, @@ -1173,7 +1177,7 @@ namespace DoFTools { inline bool check_master_dof_list (const FullMatrix<double> &face_interpolation_matrix, - const std::vector<unsigned int> &master_dof_list) + const std::vector<types::global_dof_index> &master_dof_list) { const unsigned int N = master_dof_list.size(); @@ -1322,7 +1326,7 @@ namespace DoFTools // 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<unsigned int> master_dof_list; + std::vector<types::global_dof_index> master_dof_list; unsigned int index = 0; for (int v=0; v<static_cast<signed int>(GeometryInfo<dim>::vertices_per_face); @@ -1412,7 +1416,7 @@ namespace DoFTools // finally copy the list into the mask std::fill (master_dof_mask.begin(), master_dof_mask.end(), false); - for (std::vector<unsigned int>::const_iterator i=master_dof_list.begin(); + for (std::vector<types::global_dof_index>::const_iterator i=master_dof_list.begin(); i!=master_dof_list.end(); ++i) master_dof_mask[*i] = true; } @@ -1670,8 +1674,8 @@ namespace DoFTools * avoid making the sparsity pattern fuller than necessary. */ void - filter_constraints (const std::vector<unsigned int> &master_dofs, - const std::vector<unsigned int> &slave_dofs, + filter_constraints (const std::vector<types::global_dof_index> &master_dofs, + const std::vector<types::global_dof_index> &slave_dofs, const FullMatrix<double> &face_constraints, ConstraintMatrix &constraints) { @@ -1688,10 +1692,10 @@ namespace DoFTools // 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_unsigned_int, + 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_unsigned_int, + Assert (master_dofs[col] != numbers::invalid_dof_index, ExcInternalError()); @@ -1885,8 +1889,8 @@ namespace DoFTools const unsigned int spacedim = DH::space_dimension; - std::vector<unsigned int> dofs_on_mother; - std::vector<unsigned int> dofs_on_children; + std::vector<types::global_dof_index> dofs_on_mother; + std::vector<types::global_dof_index> 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 @@ -2009,8 +2013,8 @@ namespace DoFTools { const unsigned int dim = 3; - std::vector<unsigned int> dofs_on_mother; - std::vector<unsigned int> dofs_on_children; + std::vector<types::global_dof_index> dofs_on_mother; + std::vector<types::global_dof_index> 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 @@ -2227,9 +2231,9 @@ namespace DoFTools // 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<unsigned int> master_dofs; - std::vector<unsigned int> slave_dofs; - std::vector<unsigned int> scratch_dofs; + std::vector<types::global_dof_index> master_dofs; + std::vector<types::global_dof_index> slave_dofs; + std::vector<types::global_dof_index> scratch_dofs; // caches for the face and subface interpolation matrices between // different (or the same) finite elements. we compute them only @@ -2335,21 +2339,10 @@ namespace DoFTools // 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. also ignore the - // interface if the neighboring cell is a ghost cell in - // 2d: what we would compute here are the constraints - // on the ghost cell's DoFs, but we are not interested - // in those: we only want constraints on *locally - // active* DoFs, not on *locally relevant* DoFs. - // However, in 3d we must still compute those - // constraints because it might happen that a - // constraint is related to an edge where the hanging - // node is only detected if we also look between ghosts + // the current cell is a ghost cell for (unsigned int c=0; c<cell->face(face)->n_children(); ++c) { - if (cell->neighbor_child_on_subface (face, c)->is_artificial() - || - (dim == 2 && cell->neighbor_child_on_subface (face, c)->is_ghost())) + if (cell->neighbor_child_on_subface (face, c)->is_artificial()) continue; const typename DH::active_face_iterator @@ -2383,7 +2376,7 @@ namespace DoFTools subface->get_dof_indices (slave_dofs, subface_fe_index); for (unsigned int i=0; i<slave_dofs.size(); ++i) - Assert (slave_dofs[i] != numbers::invalid_unsigned_int, + Assert (slave_dofs[i] != numbers::invalid_dof_index, ExcInternalError()); // Now create the element constraint for this @@ -2862,8 +2855,8 @@ namespace DoFTools const unsigned int dofs_per_face = fe.dofs_per_face; - std::vector<unsigned int> dofs_1(dofs_per_face); - std::vector<unsigned int> dofs_2(dofs_per_face); + std::vector<types::global_dof_index> dofs_1(dofs_per_face); + std::vector<types::global_dof_index> 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); @@ -2900,9 +2893,9 @@ namespace DoFTools for (unsigned int i=0; i<dofs_per_face; ++i) if (!constraint_matrix.is_constrained(dofs_2[i])) if ((component_mask.n_selected_components(fe.n_components()) - == fe.n_components()) - || - component_mask[fe.face_system_to_component_index(i).first]) + == fe.n_components()) + || + component_mask[fe.face_system_to_component_index(i).first]) { constraint_matrix.add_line(dofs_2[i]); for (unsigned int jj=0; jj<dofs_per_face; ++jj) @@ -2916,9 +2909,9 @@ namespace DoFTools face_orientation, face_flip, face_rotation)]; // And finally constrain the two DoFs respecting component_mask: - if (transformation(i,j) != 0) + if (transformation(i,jj) != 0) constraint_matrix.add_entry(dofs_2[i], dofs_1[j], - transformation(i,j)); + transformation(i,jj)); } } } @@ -3340,7 +3333,7 @@ namespace DoFTools } // then loop over all cells and do the work - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; for (typename DH::active_cell_iterator c=dof.begin_active(); c!=dof.end(); ++ c) if (c->is_locally_owned()) @@ -3404,7 +3397,7 @@ namespace DoFTools } // then loop over all cells and do the work - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; for (typename DH::active_cell_iterator c=dof.begin_active(); c!=dof.end(); ++ c) if (c->is_locally_owned()) @@ -3466,7 +3459,7 @@ namespace DoFTools typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); - std::vector<unsigned int> dof_indices; + std::vector<types::global_dof_index> dof_indices; dof_indices.reserve (max_dofs_per_cell(dof_handler)); for (unsigned int present_cell = 0; cell!=endc; ++cell, ++present_cell) @@ -3491,7 +3484,7 @@ namespace DoFTools // compute the mean value on all the dofs by dividing with the number // of summands. - for (unsigned int i=0; i<dof_handler.n_dofs(); ++i) + for (types::global_dof_index i=0; i<dof_handler.n_dofs(); ++i) { // assert that each dof was used at least once. this needs not be // the case if the vector has more than one component @@ -3541,7 +3534,7 @@ namespace DoFTools internal::get_component_association (dof, component_mask, dofs_by_component); - for (unsigned int i=0; i<dof.n_locally_owned_dofs(); ++i) + for (types::global_dof_index i=0; i<dof.n_locally_owned_dofs(); ++i) if (component_mask[dofs_by_component[i]] == true) selected_dofs[i] = true; } @@ -3586,7 +3579,7 @@ namespace DoFTools internal::get_component_association (dof, component_mask, dofs_by_component); - for (unsigned int i=0; i<dof.n_dofs(); ++i) + for (types::global_dof_index i=0; i<dof.n_dofs(); ++i) if (component_mask[dofs_by_component[i]] == true) selected_dofs[i] = true; } @@ -3659,7 +3652,7 @@ namespace DoFTools local_selected_dofs[i] = component_mask[local_component_asssociation[i]]; // then loop over all cells and do work - std::vector<unsigned int> indices(fe.dofs_per_cell); + std::vector<types::global_dof_index> indices(fe.dofs_per_cell); typename DH::level_cell_iterator c; for (c = dof.begin(level) ; c != dof.end(level) ; ++ c) { @@ -3740,7 +3733,7 @@ namespace DoFTools (component_mask.n_selected_components(n_components(dof_handler)) != n_components(dof_handler))); - std::vector<unsigned int> face_dof_indices; + std::vector<types::global_dof_index> face_dof_indices; face_dof_indices.reserve (max_dofs_per_face(dof_handler)); // now loop over all cells and check whether their faces are at the @@ -3842,7 +3835,7 @@ namespace DoFTools // clear and reset array by default values selected_dofs.clear (); selected_dofs.resize (dof_handler.n_dofs(), false); - std::vector<unsigned int> cell_dof_indices; + std::vector<types::global_dof_index> cell_dof_indices; cell_dof_indices.reserve (max_dofs_per_cell(dof_handler)); // now loop over all cells and check whether their faces are at the @@ -4039,7 +4032,7 @@ namespace DoFTools // preset all values by false std::fill_n (selected_dofs.begin(), dof_handler.n_dofs(), false); - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; local_dof_indices.reserve (max_dofs_per_cell(dof_handler)); // this function is similar to the make_sparsity_pattern function, see @@ -4083,8 +4076,8 @@ namespace DoFTools // add the DoF on the adjacent ghost cells to the IndexSet, cache them // in a set. need to check each dof manually because we can't be sure // that the dof range of locally_owned_dofs is really contiguous. - std::vector<unsigned int> dof_indices; - std::set<unsigned int> global_dof_indices; + std::vector<types::global_dof_index> dof_indices; + std::set<types::global_dof_index> global_dof_indices; typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -4094,7 +4087,7 @@ namespace DoFTools dof_indices.resize(cell->get_fe().dofs_per_cell); cell->get_dof_indices(dof_indices); - for (std::vector<unsigned int>::iterator it=dof_indices.begin(); + for (std::vector<types::global_dof_index>::iterator it=dof_indices.begin(); it!=dof_indices.end(); ++it) if (!dof_set.is_element(*it)) @@ -4119,8 +4112,8 @@ namespace DoFTools // add the DoF on the adjacent ghost cells to the IndexSet, cache them // in a set. need to check each dof manually because we can't be sure // that the dof range of locally_owned_dofs is really contiguous. - std::vector<unsigned int> dof_indices; - std::set<unsigned int> global_dof_indices; + std::vector<types::global_dof_index> dof_indices; + std::set<types::global_dof_index> global_dof_indices; typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -4130,7 +4123,7 @@ namespace DoFTools dof_indices.resize(cell->get_fe().dofs_per_cell); cell->get_dof_indices(dof_indices); - for (std::vector<unsigned int>::iterator it=dof_indices.begin(); + for (std::vector<types::global_dof_index>::iterator it=dof_indices.begin(); it!=dof_indices.end(); ++it) if (!dof_set.is_element(*it)) @@ -4226,7 +4219,7 @@ namespace DoFTools std::fill_n (subdomain_association.begin(), dof_handler.n_dofs(), numbers::invalid_subdomain_id); - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; local_dof_indices.reserve (max_dofs_per_cell(dof_handler)); // pseudo-randomly assign variables which lie on the interface between @@ -4307,7 +4300,7 @@ namespace DoFTools IndexSet index_set (dof_handler.n_dofs()); - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; local_dof_indices.reserve (max_dofs_per_cell(dof_handler)); // first generate an unsorted list of all indices which we fill from @@ -4315,7 +4308,7 @@ namespace DoFTools // that inserts indices in the middle, which is an O(n^2) algorithm and // hence too expensive. Could also use std::set, but that is in general // more expensive than a vector - std::vector<unsigned int> subdomain_indices; + std::vector<types::global_dof_index> subdomain_indices; typename DH::active_cell_iterator cell = dof_handler.begin_active(), @@ -4385,7 +4378,7 @@ namespace DoFTools for (unsigned int c=0; c<dof_handler.get_fe().n_components(); ++c) { - for (unsigned int i=0; i<dof_handler.n_dofs(); ++i) + for (types::global_dof_index i=0; i<dof_handler.n_dofs(); ++i) if ((subdomain_association[i] == subdomain) && (component_association[i] == static_cast<unsigned char>(c))) ++n_dofs_on_subdomain[c]; @@ -4406,7 +4399,7 @@ namespace DoFTools const std::vector<unsigned char> &dofs_by_component, const std::vector<unsigned int> &target_component, const bool only_once, - std::vector<unsigned int> &dofs_per_component, + std::vector<types::global_dof_index> &dofs_per_component, unsigned int &component) { for (unsigned int b=0; b<fe.n_base_elements(); ++b) @@ -4447,7 +4440,7 @@ namespace DoFTools const std::vector<unsigned char> &dofs_by_component, const std::vector<unsigned int> &target_component, const bool only_once, - std::vector<unsigned int> &dofs_per_component, + std::vector<types::global_dof_index> &dofs_per_component, unsigned int &component) { // assert that all elements in the collection have the same structure @@ -4509,13 +4502,14 @@ namespace DoFTools void count_dofs_per_component ( const DH &dof_handler, - std::vector<unsigned int> &dofs_per_component, + std::vector<types::global_dof_index> &dofs_per_component, bool only_once, std::vector<unsigned int> target_component) { const unsigned int n_components = dof_handler.get_fe().n_components(); - std::fill (dofs_per_component.begin(), dofs_per_component.end(), 0U); + std::fill (dofs_per_component.begin(), dofs_per_component.end(), + types::global_dof_index(0)); // If the empty vector was given as default argument, set up this // vector as identity. @@ -4565,7 +4559,8 @@ namespace DoFTools Assert ((internal::all_elements_are_primitive(dof_handler.get_fe()) == false) || (std::accumulate (dofs_per_component.begin(), - dofs_per_component.end(), 0U) + dofs_per_component.end(), + types::global_dof_index(0)) == dof_handler.n_locally_owned_dofs()), ExcInternalError()); @@ -4578,10 +4573,11 @@ namespace DoFTools = (dynamic_cast<const parallel::distributed::Triangulation<dim,spacedim>*> (&dof_handler.get_tria()))) { - std::vector<unsigned int> local_dof_count = dofs_per_component; + std::vector<types::global_dof_index> local_dof_count = dofs_per_component; MPI_Allreduce ( &local_dof_count[0], &dofs_per_component[0], n_target_components, - MPI_UNSIGNED, MPI_SUM, tria->get_communicator()); + DEAL_II_DOF_INDEX_MPI_TYPE, + MPI_SUM, tria->get_communicator()); } #endif } @@ -4591,7 +4587,7 @@ namespace DoFTools template <class DH> void count_dofs_per_block (const DH &dof_handler, - std::vector<unsigned int> &dofs_per_block, + std::vector<types::global_dof_index> &dofs_per_block, const std::vector<unsigned int> &target_block_) { std::vector<unsigned int> target_block = target_block_; @@ -4603,7 +4599,8 @@ namespace DoFTools for (unsigned int this_fe=0; this_fe<fe_collection.size(); ++this_fe) { const FiniteElement<DH::dimension,DH::space_dimension> &fe = fe_collection[this_fe]; - std::fill (dofs_per_block.begin(), dofs_per_block.end(), 0U); + std::fill (dofs_per_block.begin(), dofs_per_block.end(), + types::global_dof_index(0)); // If the empty vector was given as default argument, set up this // vector as identity. @@ -4653,9 +4650,11 @@ namespace DoFTools = (dynamic_cast<const parallel::distributed::Triangulation<DH::dimension,DH::space_dimension>*> (&dof_handler.get_tria()))) { - std::vector<unsigned int> local_dof_count = dofs_per_block; - MPI_Allreduce ( &local_dof_count[0], &dofs_per_block[0], n_target_blocks, - MPI_UNSIGNED, MPI_SUM, tria->get_communicator()); + std::vector<types::global_dof_index> local_dof_count = dofs_per_block; + MPI_Allreduce ( &local_dof_count[0], &dofs_per_block[0], + n_target_blocks, + DEAL_II_DOF_INDEX_MPI_TYPE, + MPI_SUM, tria->get_communicator()); } #endif #endif @@ -4667,7 +4666,7 @@ namespace DoFTools template <int dim, int spacedim> void count_dofs_per_component (const DoFHandler<dim,spacedim> &dof_handler, - std::vector<unsigned int> &dofs_per_component, + std::vector<types::global_dof_index> &dofs_per_component, std::vector<unsigned int> target_component) { count_dofs_per_component (dof_handler, dofs_per_component, @@ -4694,8 +4693,8 @@ namespace DoFTools const unsigned int coarse_component, const InterGridMap<dealii::DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map, const std::vector<dealii::Vector<double> > &parameter_dofs, - const std::vector<int> &weight_mapping, - std::vector<std::map<unsigned int, float> > &weights, + const std::vector<types::global_dof_index> &weight_mapping, + std::vector<std::map<types::global_dof_index, float> > &weights, const typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator &begin, const typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator &end) { @@ -4748,11 +4747,11 @@ namespace DoFTools // vector to hold the representation of a single degree of freedom // on the coarse grid (for the selected fe) on the fine grid - const unsigned int n_fine_dofs = weight_mapping.size(); + const types::global_dof_index n_fine_dofs = weight_mapping.size(); dealii::Vector<double> global_parameter_representation (n_fine_dofs); typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator cell; - std::vector<unsigned int> parameter_dof_indices (coarse_fe.dofs_per_cell); + std::vector<types::global_dof_index> parameter_dof_indices (coarse_fe.dofs_per_cell); for (cell=begin; cell!=end; ++cell) { @@ -4806,15 +4805,15 @@ namespace DoFTools // weights, have only one mutex for all of them static Threads::Mutex mutex; Threads::Mutex::ScopedLock lock (mutex); - for (unsigned int i=0; i<global_parameter_representation.size(); ++i) + for (types::global_dof_index i=0; i<global_parameter_representation.size(); ++i) // set this weight if it belongs to a parameter dof. - if (weight_mapping[i] != -1) + if (weight_mapping[i] != numbers::invalid_dof_index) { // only overwrite old value if not by zero if (global_parameter_representation(i) != 0) { - const unsigned int wi = parameter_dof_indices[local_dof], - wj = weight_mapping[i]; + const types::global_dof_index wi = parameter_dof_indices[local_dof], + wj = weight_mapping[i]; weights[wi][wj] = global_parameter_representation(i); }; } @@ -4838,8 +4837,8 @@ namespace DoFTools const unsigned int coarse_component, const InterGridMap<dealii::DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map, const std::vector<dealii::Vector<double> > &parameter_dofs, - const std::vector<int> &weight_mapping, - std::vector<std::map<unsigned int,float> > &weights) + const std::vector<types::global_dof_index> &weight_mapping, + std::vector<std::map<types::global_dof_index,float> > &weights) { // simply distribute the range of cells to different threads typedef typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator active_cell_iterator; @@ -4855,8 +4854,8 @@ namespace DoFTools const unsigned int , const InterGridMap<dealii::DoFHandler<dim,spacedim> > &, const std::vector<dealii::Vector<double> > &, - const std::vector<int> &, - std::vector<std::map<unsigned int, float> > &, + const std::vector<types::global_dof_index> &, + std::vector<std::map<types::global_dof_index, float> > &, const typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator &, const typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator &) = &compute_intergrid_weights_3<dim>; @@ -4887,16 +4886,16 @@ namespace DoFTools const dealii::DoFHandler<dim,spacedim> &fine_grid, const unsigned int fine_component, const InterGridMap<dealii::DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map, - std::vector<std::map<unsigned int, float> > &weights, - std::vector<int> &weight_mapping) + std::vector<std::map<types::global_dof_index, float> > &weights, + std::vector<types::global_dof_index> &weight_mapping) { // aliases to the finite elements used by the dof handlers: const FiniteElement<dim,spacedim> &coarse_fe = coarse_grid.get_fe(), &fine_fe = fine_grid.get_fe(); // global numbers of dofs - const unsigned int n_coarse_dofs = coarse_grid.n_dofs(), - n_fine_dofs = fine_grid.n_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; @@ -4991,7 +4990,7 @@ namespace DoFTools // if this is an interesting dof. finally count how many true's // there std::vector<bool> dof_is_interesting (fine_grid.n_dofs(), false); - std::vector<unsigned int> local_dof_indices (fine_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (fine_fe.dofs_per_cell); for (typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator cell=fine_grid.begin_active(); @@ -5014,11 +5013,11 @@ namespace DoFTools weights.resize (n_coarse_dofs); weight_mapping.clear (); - weight_mapping.resize (n_fine_dofs, -1); + weight_mapping.resize (n_fine_dofs, numbers::invalid_dof_index); if (true) { - std::vector<unsigned int> local_dof_indices(fine_fe.dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices(fine_fe.dofs_per_cell); unsigned int next_free_index=0; for (typename dealii::DoFHandler<dim,spacedim>::active_cell_iterator cell=fine_grid.begin_active(); @@ -5029,7 +5028,7 @@ namespace DoFTools // if this DoF is a parameter dof and has not yet been // numbered, then do so if ((fine_fe.system_to_component_index(i).first == fine_component) && - (weight_mapping[local_dof_indices[i]] == -1)) + (weight_mapping[local_dof_indices[i]] == numbers::invalid_dof_index)) { weight_mapping[local_dof_indices[i]] = next_free_index; ++next_free_index; @@ -5070,7 +5069,7 @@ namespace DoFTools for (unsigned int col=0; col<n_parameters_on_fine_grid; ++col) { double sum=0; - for (unsigned int row=0; row<n_coarse_dofs; ++row) + for (types::global_dof_index row=0; row<n_coarse_dofs; ++row) if (weights[row].find(col) != weights[row].end()) sum += weights[row][col]; Assert ((std::fabs(sum-1) < 1.e-12) || @@ -5119,13 +5118,13 @@ namespace DoFTools // 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<std::map<unsigned int, float> > weights; + std::vector<std::map<types::global_dof_index, float> > 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<int> weight_mapping; + std::vector<types::global_dof_index> weight_mapping; const unsigned int n_parameters_on_fine_grid = internal::compute_intergrid_weights_1 (coarse_grid, coarse_component, @@ -5134,8 +5133,8 @@ namespace DoFTools weights, weight_mapping); // global numbers of dofs - const unsigned int n_coarse_dofs = coarse_grid.n_dofs(), - n_fine_dofs = fine_grid.n_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 @@ -5158,8 +5157,8 @@ namespace DoFTools // 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<int> representants(n_coarse_dofs, -1); - for (unsigned int parameter_dof=0; parameter_dof<n_coarse_dofs; + std::vector<types::global_dof_index> representants(n_coarse_dofs, numbers::invalid_dof_index); + for (types::global_dof_index parameter_dof=0; parameter_dof<n_coarse_dofs; ++parameter_dof) if (coarse_dof_is_parameter[parameter_dof] == true) { @@ -5169,19 +5168,19 @@ namespace DoFTools Assert (weights[parameter_dof].size() > 0, ExcInternalError()); // find the column where the representant is mentioned - std::map<unsigned int,float>::const_iterator i = weights[parameter_dof].begin(); + std::map<types::global_dof_index,float>::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 unsigned int column = i->first; + 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 - unsigned int global_dof=0; + types::global_dof_index global_dof=0; for (; global_dof<weight_mapping.size(); ++global_dof) - if (weight_mapping[global_dof] == static_cast<int>(column)) + if (weight_mapping[global_dof] == static_cast<types::global_dof_index>(column)) break; Assert (global_dof < weight_mapping.size(), ExcInternalError()); @@ -5202,9 +5201,9 @@ namespace DoFTools // 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<std::pair<unsigned int,double> > constraint_line; - for (unsigned int global_dof=0; global_dof<n_fine_dofs; ++global_dof) - if (weight_mapping[global_dof] != -1) + std::vector<std::pair<types::global_dof_index,double> > constraint_line; + for (types::global_dof_index global_dof=0; global_dof<n_fine_dofs; ++global_dof) + if (weight_mapping[global_dof] != numbers::invalid_dof_index) // this global dof is a parameter dof, so it may carry a constraint // note that for each global dof, the sum of weights shall be one, // so we can find out whether this dof is constrained in the @@ -5213,14 +5212,14 @@ namespace DoFTools // is is the present dof, then we consider this dof to be // unconstrained. otherwise, all other dofs are constrained { - const unsigned int col = weight_mapping[global_dof]; + const types::global_dof_index col = weight_mapping[global_dof]; Assert (col < n_parameters_on_fine_grid, ExcInternalError()); - unsigned int first_used_row=0; + types::global_dof_index first_used_row=0; { Assert (weights.size() > 0, ExcInternalError()); - std::map<unsigned int,float>::const_iterator + std::map<types::global_dof_index,float>::const_iterator col_entry = weights[0].end(); for (; first_used_row<n_coarse_dofs; ++first_used_row) { @@ -5232,7 +5231,7 @@ namespace DoFTools Assert (col_entry != weights[first_used_row].end(), ExcInternalError()); if ((col_entry->second == 1) && - (representants[first_used_row] == static_cast<int>(global_dof))) + (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) @@ -5244,13 +5243,13 @@ namespace DoFTools constraints.add_line (global_dof); constraint_line.clear (); - for (unsigned int row=first_used_row; row<n_coarse_dofs; ++row) + for (types::global_dof_index row=first_used_row; row<n_coarse_dofs; ++row) { - const std::map<unsigned int,float>::const_iterator + const std::map<types::global_dof_index,float>::const_iterator j = weights[row].find(col); if ((j != weights[row].end()) && (j->second != 0)) - constraint_line.push_back (std::pair<unsigned int,double>(representants[row], - j->second)); + constraint_line.push_back (std::pair<types::global_dof_index,double>(representants[row], + j->second)); }; constraints.add_entries (global_dof, constraint_line); @@ -5267,7 +5266,7 @@ namespace DoFTools const DoFHandler<dim,spacedim> &fine_grid, const unsigned int fine_component, const InterGridMap<DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map, - std::vector<std::map<unsigned int, float> > &transfer_representation) + std::vector<std::map<types::global_dof_index, float> > &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 @@ -5290,13 +5289,13 @@ namespace DoFTools // 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<std::map<unsigned int, float> > weights; + std::vector<std::map<types::global_dof_index, float> > 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<int> weight_mapping; + std::vector<types::global_dof_index> weight_mapping; internal::compute_intergrid_weights_1 (coarse_grid, coarse_component, fine_grid, fine_component, @@ -5304,18 +5303,18 @@ namespace DoFTools weights, weight_mapping); // now compute the requested representation - const unsigned int n_global_parm_dofs + const types::global_dof_index n_global_parm_dofs = std::count_if (weight_mapping.begin(), weight_mapping.end(), - std::bind2nd (std::not_equal_to<int> (), -1)); + std::bind2nd (std::not_equal_to<types::global_dof_index> (), numbers::invalid_dof_index)); // first construct the inverse mapping of weight_mapping - std::vector<unsigned int> inverse_weight_mapping (n_global_parm_dofs, - DoFHandler<dim,spacedim>::invalid_dof_index); - for (unsigned int i=0; i<weight_mapping.size(); ++i) + std::vector<types::global_dof_index> inverse_weight_mapping (n_global_parm_dofs, + DoFHandler<dim,spacedim>::invalid_dof_index); + for (types::global_dof_index i=0; i<weight_mapping.size(); ++i) { - const unsigned int parameter_dof = weight_mapping[i]; + const types::global_dof_index parameter_dof = weight_mapping[i]; // if this global dof is a parameter - if (parameter_dof != numbers::invalid_unsigned_int) + if (parameter_dof != numbers::invalid_dof_index) { Assert (parameter_dof < n_global_parm_dofs, ExcInternalError()); Assert ((inverse_weight_mapping[parameter_dof] == DoFHandler<dim,spacedim>::invalid_dof_index), @@ -5326,18 +5325,18 @@ namespace DoFTools }; // next copy over weights array and replace respective numbers - const unsigned int n_rows = weight_mapping.size(); + const types::global_dof_index n_rows = weight_mapping.size(); transfer_representation.clear (); transfer_representation.resize (n_rows); - const unsigned int n_coarse_dofs = coarse_grid.n_dofs(); - for (unsigned int i=0; i<n_coarse_dofs; ++i) + const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(); + for (types::global_dof_index i=0; i<n_coarse_dofs; ++i) { - std::map<unsigned int, float>::const_iterator j = weights[i].begin(); + std::map<types::global_dof_index, float>::const_iterator j = weights[i].begin(); for (; j!=weights[i].end(); ++j) { - const unsigned int p = inverse_weight_mapping[j->first]; + const types::global_dof_index p = inverse_weight_mapping[j->first]; Assert (p<n_rows, ExcInternalError()); transfer_representation[p][i] = j->second; @@ -5350,7 +5349,7 @@ namespace DoFTools template <class DH> void map_dof_to_boundary_indices (const DH &dof_handler, - std::vector<unsigned int> &mapping) + std::vector<types::global_dof_index> &mapping) { Assert (&dof_handler.get_fe() != 0, ExcNoFESelected()); @@ -5358,9 +5357,9 @@ namespace DoFTools mapping.insert (mapping.end(), dof_handler.n_dofs(), DH::invalid_dof_index); - std::vector<unsigned int> dofs_on_face; + std::vector<types::global_dof_index> dofs_on_face; dofs_on_face.reserve (max_dofs_per_face(dof_handler)); - unsigned int next_boundary_index = 0; + types::global_dof_index next_boundary_index = 0; // now loop over all cells and check whether their faces are at the // boundary. note that we need not take special care of single lines @@ -5392,7 +5391,7 @@ namespace DoFTools void map_dof_to_boundary_indices ( const DH &dof_handler, const std::set<types::boundary_id> &boundary_indicators, - std::vector<unsigned int> &mapping) + std::vector<types::global_dof_index> &mapping) { Assert (&dof_handler.get_fe() != 0, ExcNoFESelected()); Assert (boundary_indicators.find (numbers::internal_face_boundary_id) == boundary_indicators.end(), @@ -5406,9 +5405,9 @@ namespace DoFTools if (boundary_indicators.size() == 0) return; - std::vector<unsigned int> dofs_on_face; + std::vector<types::global_dof_index> dofs_on_face; dofs_on_face.reserve (max_dofs_per_face(dof_handler)); - unsigned int next_boundary_index = 0; + types::global_dof_index next_boundary_index = 0; typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -5436,8 +5435,8 @@ namespace DoFTools template <class DH> void map_dofs_to_support_points(const hp::MappingCollection<DH::dimension, DH::space_dimension> &mapping, - const DH &dof_handler, - std::map<unsigned int,Point<DH::space_dimension> > &support_points) + const DH &dof_handler, + std::map<types::global_dof_index,Point<DH::space_dimension> > &support_points) { const unsigned int dim = DH::dimension; const unsigned int spacedim = DH::space_dimension; @@ -5467,7 +5466,7 @@ namespace DoFTools typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); - std::vector<unsigned int> local_dof_indices; + std::vector<types::global_dof_index> local_dof_indices; for (; cell != endc; ++cell) // only work on locally relevant cells if (cell->is_artificial() == false) @@ -5494,12 +5493,12 @@ namespace DoFTools std::vector<Point<DH::space_dimension> > &support_points) { // get the data in the form of the map as above - std::map<unsigned int,Point<DH::space_dimension> > x_support_points; + std::map<types::global_dof_index,Point<DH::space_dimension> > x_support_points; map_dofs_to_support_points(mapping, dof_handler, x_support_points); // now convert from the map to the linear vector. make sure every // entry really appeared in the map - for (unsigned int i=0; i<dof_handler.n_dofs(); ++i) + for (types::global_dof_index i=0; i<dof_handler.n_dofs(); ++i) { Assert (x_support_points.find(i) != x_support_points.end(), ExcInternalError()); @@ -5559,7 +5558,7 @@ namespace DoFTools void map_dofs_to_support_points (const Mapping<dim,spacedim> &mapping, const DoFHandler<dim,spacedim> &dof_handler, - std::map<unsigned int, Point<spacedim> > &support_points) + std::map<types::global_dof_index, Point<spacedim> > &support_points) { support_points.clear(); @@ -5577,7 +5576,7 @@ namespace DoFTools void map_dofs_to_support_points(const hp::MappingCollection<dim, spacedim> &mapping, const hp::DoFHandler<dim, spacedim> &dof_handler, - std::map<unsigned int, Point<spacedim> > &support_points) + std::map<types::global_dof_index, Point<spacedim> > &support_points) { support_points.clear(); @@ -5664,7 +5663,7 @@ namespace DoFTools VectorTools::ExcNoComponentSelected()); // a field to store the indices - std::vector<unsigned int> face_dofs; + std::vector<types::global_dof_index> face_dofs; face_dofs.reserve (max_dofs_per_face(dof)); typename DH<dim,spacedim>::active_cell_iterator @@ -5733,11 +5732,11 @@ namespace DoFTools const DH &dof_handler, const unsigned int level, const std::vector<bool> &selected_dofs, - unsigned int offset) + types::global_dof_index offset) { typename DH::level_cell_iterator cell; typename DH::level_cell_iterator endc = dof_handler.end(level); - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; unsigned int i=0; for (cell=dof_handler.begin(level); cell != endc; ++i, ++cell) @@ -5748,7 +5747,7 @@ namespace DoFTools if (selected_dofs.size()!=0) AssertDimension(indices.size(), selected_dofs.size()); - for (unsigned int j=0; j<indices.size(); ++j) + for (types::global_dof_index j=0; j<indices.size(); ++j) { if (selected_dofs.size() == 0) block_list.add(i,indices[j]-offset); @@ -5774,7 +5773,7 @@ namespace DoFTools typename DH::level_cell_iterator cell; typename DH::level_cell_iterator endc = dof_handler.end(level); - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; std::vector<bool> exclude; for (cell=dof_handler.begin(level); cell != endc; ++cell) @@ -5793,13 +5792,13 @@ namespace DoFTools if (cell->at_boundary(face) || cell->neighbor(face)->level() != cell->level()) for (unsigned int i=0; i<dpf; ++i) exclude[fe.face_to_cell_index(i,face)] = true; - for (unsigned int j=0; j<indices.size(); ++j) + for (types::global_dof_index j=0; j<indices.size(); ++j) if (!exclude[j]) block_list.add(0, indices[j]); } else { - for (unsigned int j=0; j<indices.size(); ++j) + for (types::global_dof_index j=0; j<indices.size(); ++j) block_list.add(0, indices[j]); } } @@ -5821,7 +5820,7 @@ namespace DoFTools typename DH::level_cell_iterator pcell = dof_handler.begin(level-1); typename DH::level_cell_iterator endc = dof_handler.end(level-1); - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; std::vector<bool> exclude; for (unsigned int block = 0; pcell != endc; ++pcell) @@ -5943,7 +5942,7 @@ namespace DoFTools // into the sparsity pattern. block_list.reinit(vertex_dof_count.size(), dof_handler.n_dofs(level), vertex_dof_count); - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; std::vector<bool> exclude; for (cell=dof_handler.begin(level); cell != endc; ++cell) diff --git a/deal.II/source/dofs/dof_tools.inst.in b/deal.II/source/dofs/dof_tools.inst.in index c935ac1dd8..17d1beaa6c 100644 --- a/deal.II/source/dofs/dof_tools.inst.in +++ b/deal.II/source/dofs/dof_tools.inst.in @@ -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. +// +// --------------------------------------------------------------------- + for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) @@ -76,32 +81,40 @@ for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) const hp::DoFHandler<deal_II_dimension,deal_II_dimension> &dof_col, SP &sparsity); - // #if deal_II_dimension > 1 template void DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,SP> (const DoFHandler<deal_II_dimension>& dof, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, SP &); template void DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SP> (const hp::DoFHandler<deal_II_dimension>& dof, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, SP &); template void DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension>,SP> (const DoFHandler<deal_II_dimension>& dof, const FunctionMap<deal_II_dimension>::type &boundary_indicators, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SP &sparsity); template void DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,SP> (const hp::DoFHandler<deal_II_dimension>& dof, const FunctionMap<deal_II_dimension>::type &boundary_indicators, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, + SP &sparsity); + +#if deal_II_dimension < 3 + template void + DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP> + (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof, + const FunctionMap<deal_II_dimension+1>::type &boundary_indicators, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SP &sparsity); + #endif template void DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>,SP> @@ -115,11 +128,11 @@ for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) template void DoFTools::make_cell_patches<DoFHandler<deal_II_dimension>,SP> - (SP&, const DoFHandler<deal_II_dimension>&, unsigned int, const std::vector<bool>&, unsigned int); + (SP&, const DoFHandler<deal_II_dimension>&, const unsigned int, const std::vector<bool>&, types::global_dof_index); template void DoFTools::make_cell_patches<MGDoFHandler<deal_II_dimension>,SP> - (SP&, const MGDoFHandler<deal_II_dimension>&, unsigned int, const std::vector<bool>&, unsigned int); + (SP&, const MGDoFHandler<deal_II_dimension>&, const unsigned int, const std::vector<bool>&, types::global_dof_index); #if deal_II_dimension > 1 @@ -203,27 +216,27 @@ for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) template void DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP> (const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, SP &); //template void //DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP> //(const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof, - // const std::vector<unsigned int> &, + // const std::vector<types::global_dof_index> &, // SP &); template void DoFTools::make_boundary_sparsity_pattern<DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP> (const DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof, const FunctionMap<deal_II_dimension+1>::type &boundary_indicators, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SP &sparsity); //template void //DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>,SP> //(const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>& dof, // const FunctionMap<deal_II_dimension+1>::type &boundary_indicators, - // const std::vector<unsigned int> &dof_to_boundary_mapping, + // const std::vector<types::global_dof_index> &dof_to_boundary_mapping, // SP &sparsity); #endif @@ -280,28 +293,28 @@ for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) template void DoFTools::make_boundary_sparsity_pattern<DoFHandler<1,3>,SP> (const DoFHandler<1,3>& dof, - const std::vector<unsigned int> &, + const std::vector<types::global_dof_index> &, SP &); - //template void - //DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<1,3>,SP> - //(const hp::DoFHandler<1,3>& dof, - // const std::vector<unsigned int> &, - // SP &); + template void + DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<1,3>,SP> + (const hp::DoFHandler<1,3>& dof, + const std::vector<types::global_dof_index> &, + SP &); template void DoFTools::make_boundary_sparsity_pattern<DoFHandler<1,3>,SP> (const DoFHandler<1,3>& dof, const FunctionMap<3>::type &boundary_indicators, - const std::vector<unsigned int> &dof_to_boundary_mapping, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, SP &sparsity); - //template void - //DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<1,3>,SP> - //(const hp::DoFHandler<1,3>& dof, - // const FunctionMap<3>::type &boundary_indicators, - // const std::vector<unsigned int> &dof_to_boundary_mapping, - // SP &sparsity); + template void + DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<1,3>,SP> + (const hp::DoFHandler<1,3>& dof, + const FunctionMap<3>::type &boundary_indicators, + const std::vector<types::global_dof_index> &dof_to_boundary_mapping, + SP &sparsity); #endif @@ -799,13 +812,13 @@ template void DoFTools::count_dofs_per_component<DoFHandler<deal_II_dimension> > ( const DoFHandler<deal_II_dimension>&, - std::vector<unsigned int>&, bool, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, bool, std::vector<unsigned int>); template void DoFTools::count_dofs_per_component<hp::DoFHandler<deal_II_dimension> > ( const hp::DoFHandler<deal_II_dimension>&, - std::vector<unsigned int>&, bool, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, bool, std::vector<unsigned int>); #if deal_II_dimension < 3 @@ -813,13 +826,13 @@ template void DoFTools::count_dofs_per_component<DoFHandler<deal_II_dimension, deal_II_dimension+1> > ( const DoFHandler<deal_II_dimension, deal_II_dimension+1>&, - std::vector<unsigned int>&, bool, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, bool, std::vector<unsigned int>); template void DoFTools::count_dofs_per_component<hp::DoFHandler<deal_II_dimension, deal_II_dimension+1> > ( const hp::DoFHandler<deal_II_dimension, deal_II_dimension+1>&, - std::vector<unsigned int>&, bool, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, bool, std::vector<unsigned int>); template void @@ -845,13 +858,13 @@ template void DoFTools::count_dofs_per_component<DoFHandler<1,3> > ( const DoFHandler<1,3>&, - std::vector<unsigned int>&, bool, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, bool, std::vector<unsigned int>); template void DoFTools::count_dofs_per_component<hp::DoFHandler<1,3> > ( const hp::DoFHandler<1,3>&, - std::vector<unsigned int>&, bool, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, bool, std::vector<unsigned int>); template void @@ -876,28 +889,28 @@ template void DoFTools::count_dofs_per_block<DoFHandler<deal_II_dimension> > ( const DoFHandler<deal_II_dimension>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_block<hp::DoFHandler<deal_II_dimension> > ( const hp::DoFHandler<deal_II_dimension>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_block<MGDoFHandler<deal_II_dimension> > ( const MGDoFHandler<deal_II_dimension>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_component<deal_II_dimension> ( const DoFHandler<deal_II_dimension>&, - std::vector<unsigned int>&, std::vector<unsigned int>); + std::vector<types::global_dof_index>&, std::vector<unsigned int>); template void @@ -913,7 +926,7 @@ DoFTools::compute_intergrid_transfer_representation<deal_II_dimension> (const DoFHandler<deal_II_dimension> &, const unsigned int, const DoFHandler<deal_II_dimension> &, const unsigned int, const InterGridMap<DoFHandler<deal_II_dimension> > &, - std::vector<std::map<unsigned int, float> > &); + std::vector<std::map<types::global_dof_index, float> > &); template @@ -921,13 +934,13 @@ void DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension> > (const DoFHandler<deal_II_dimension> &, const std::set<types::boundary_id> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template void DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension> > (const DoFHandler<deal_II_dimension> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); @@ -936,13 +949,13 @@ void DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension> > (const hp::DoFHandler<deal_II_dimension> &, const std::set<types::boundary_id> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template void DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension> > (const hp::DoFHandler<deal_II_dimension> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); @@ -967,7 +980,7 @@ void DoFTools::map_dofs_to_support_points<deal_II_dimension> (const Mapping<deal_II_dimension,deal_II_dimension>&, const DoFHandler<deal_II_dimension>&, - std::map<unsigned int, Point<deal_II_dimension> >&); + std::map<types::global_dof_index, Point<deal_II_dimension> >&); template @@ -975,7 +988,7 @@ void DoFTools::map_dofs_to_support_points<deal_II_dimension> (const hp::MappingCollection<deal_II_dimension,deal_II_dimension>&, const hp::DoFHandler<deal_II_dimension>&, - std::map<unsigned int, Point<deal_II_dimension> >&); + std::map<types::global_dof_index, Point<deal_II_dimension> >&); #if deal_II_dimension < 3 @@ -998,35 +1011,35 @@ void DoFTools::map_dofs_to_support_points<deal_II_dimension,deal_II_dimension+1> (const Mapping<deal_II_dimension,deal_II_dimension+1>&, const DoFHandler<deal_II_dimension, deal_II_dimension+1>&, - std::map<unsigned int, Point<deal_II_dimension+1> >&); + std::map<types::global_dof_index, Point<deal_II_dimension+1> >&); template void DoFTools::map_dofs_to_support_points<deal_II_dimension,deal_II_dimension+1> (const hp::MappingCollection<deal_II_dimension,deal_II_dimension+1>&, const hp::DoFHandler<deal_II_dimension, deal_II_dimension+1>&, - std::map<unsigned int, Point<deal_II_dimension+1> >&); + std::map<types::global_dof_index, Point<deal_II_dimension+1> >&); template void DoFTools::count_dofs_per_block<DoFHandler<deal_II_dimension,deal_II_dimension+1> > ( const DoFHandler<deal_II_dimension,deal_II_dimension+1>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_block<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> > ( const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_block<MGDoFHandler<deal_II_dimension,deal_II_dimension+1> > ( const MGDoFHandler<deal_II_dimension,deal_II_dimension+1>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); #endif @@ -1045,21 +1058,21 @@ template void DoFTools::count_dofs_per_block<DoFHandler<1,3> > ( const DoFHandler<1,3>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_block<hp::DoFHandler<1,3> > ( const hp::DoFHandler<1,3>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); template void DoFTools::count_dofs_per_block<MGDoFHandler<1,3> > ( const MGDoFHandler<1,3>&, - std::vector<unsigned int>&, + std::vector<types::global_dof_index>&, const std::vector<unsigned int> &); #endif @@ -1114,13 +1127,13 @@ void DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension,deal_II_dimension+1> > (const DoFHandler<deal_II_dimension,deal_II_dimension+1> &, const std::set<types::boundary_id> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template void DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension,deal_II_dimension+1> > (const DoFHandler<deal_II_dimension,deal_II_dimension+1> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template @@ -1134,13 +1147,13 @@ DoFTools::extract_hanging_node_dofs DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> > (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &, const std::set<types::boundary_id> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template void DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> > (const hp::DoFHandler<deal_II_dimension,deal_II_dimension+1> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); #endif @@ -1151,13 +1164,13 @@ void DoFTools::map_dof_to_boundary_indices<DoFHandler<1,3> > (const DoFHandler<1,3> &, const std::set<types::boundary_id> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template void DoFTools::map_dof_to_boundary_indices<DoFHandler<1,3> > (const DoFHandler<1,3> &, - std::vector<unsigned int> &); + std::vector<types::global_dof_index> &); template @@ -1166,18 +1179,18 @@ DoFTools::extract_hanging_node_dofs (const DoFHandler<1,3> &dof_handler, std::vector<bool> &selected_dofs); -// template -// void -// DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<1,3> > -// (const hp::DoFHandler<1,3> &, -// const std::set<unsigned char> &, -// std::vector<unsigned int> &); - -// template -// void -// DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<1,3> > -// (const hp::DoFHandler<1,3> &, -// std::vector<unsigned int> &); +template +void +DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<1,3> > +(const hp::DoFHandler<1,3> &, + const std::set<unsigned char> &, + std::vector<types::global_dof_index> &); + +template +void +DoFTools::map_dof_to_boundary_indices<hp::DoFHandler<1,3> > +(const hp::DoFHandler<1,3> &, + std::vector<types::global_dof_index> &); #endif 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 <deal.II/base/memory_consumption.h> #include <deal.II/dofs/number_cache.h> diff --git a/deal.II/source/fe/CMakeLists.txt b/deal.II/source/fe/CMakeLists.txt index d5d3852aab..5604f19339 100644 --- a/deal.II/source/fe/CMakeLists.txt +++ b/deal.II/source/fe/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/fe/block_mask.h> 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 <deal.II/fe/component_mask.h> diff --git a/deal.II/source/fe/fe.cc b/deal.II/source/fe/fe.cc index 1a9e9f9fa4..cdb97b5104 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 <deal.II/base/memory_consumption.h> #include <deal.II/fe/mapping.h> 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 3b756c5112..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 <deal.II/base/utilities.h> #include <deal.II/base/quadrature.h> @@ -290,7 +294,7 @@ FE_ABF<dim>::initialize_support_points (const unsigned int deg) // This function is the same Raviart-Thomas interpolation performed by // interpolate. Still, we cannot use interpolate, since it was written -// for smooth functions. Thefunctions interpolated here are not +// for smooth functions. The functions interpolated here are not // smooth, maybe even not continuous. Therefore, we must double the // number of quadrature points in each direction in order to integrate // only smooth functions. 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/qprojector.h> 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..e0873d9ba3 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 <deal.II/base/geometry_info.h> #include <deal.II/fe/fe.h> 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 <deal.II/fe/fe_dg_vector.templates.h> #include <deal.II/base/polynomials_abf.h> 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..bb3f9531af 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 <deal.II/fe/fe_dgp.h> #include <deal.II/fe/fe_tools.h> 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 <deal.II/fe/fe_dgp_monomial.h> #include <deal.II/fe/fe_tools.h> 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 <deal.II/base/quadrature.h> #include <deal.II/grid/tria.h> 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 <deal.II/base/quadrature.h> #include <deal.II/base/quadrature_lib.h> 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..b8637568fc 100644 --- a/deal.II/source/fe/fe_face.cc +++ b/deal.II/source/fe/fe_face.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 <deal.II/fe/fe_face.h> #include <deal.II/fe/fe_poly_face.templates.h> diff --git a/deal.II/source/fe/fe_face.inst.in b/deal.II/source/fe/fe_face.inst.in index 631a8f52f6..8d99474428 100644 --- a/deal.II/source/fe/fe_face.inst.in +++ b/deal.II/source/fe/fe_face.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_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 <deal.II/base/logstream.h> #include <deal.II/base/utilities.h> #include <deal.II/base/quadrature.h> @@ -230,7 +246,7 @@ FE_Nedelec<2>::initialize_support_points (const unsigned int degree) // Initialize quadratures to obtain // quadrature points later on. const QGauss<dim - 1> 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<dim>::lines_per_cell * n_edge_points; @@ -511,7 +527,7 @@ FE_Nedelec<dim>::initialize_restriction () const QGauss<1> edge_quadrature (2 * this->degree); const std::vector<Point<1> > &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<dim>::isotropic_refinement - 1; @@ -3290,7 +3306,7 @@ FE_Nedelec<dim>::interpolate (std::vector<double> &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<dim>::interpolate (std::vector<double> &local_dofs, // the interior shape // functions. const QGauss<dim> 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<dim - 1> 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<dim> reference_quadrature (this->degree); - const unsigned int& + const unsigned int & n_interior_points = reference_quadrature.size (); const std::vector<Polynomials::Polynomial<double> > & 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 <deal.II/fe/fe_nothing.h> 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 <deal.II/base/qprojector.h> #include <deal.II/base/tensor_product_polynomials.h> 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 <deal.II/base/derivative_form.h> #include <deal.II/base/qprojector.h> @@ -37,9 +41,9 @@ namespace * given cell. */ void - get_face_sign_change (const Triangulation<1>::cell_iterator &, - const unsigned int , - std::vector<double> &face_sign) + get_face_sign_change_rt (const Triangulation<1>::cell_iterator &, + const unsigned int , + std::vector<double> &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<double> &face_sign) + get_face_sign_change_rt (const Triangulation<2>::cell_iterator &cell, + const unsigned int dofs_per_face, + std::vector<double> &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<double> &face_sign) + get_face_sign_change_rt (const Triangulation<3>::cell_iterator &cell, + const unsigned int dofs_per_face, + std::vector<double> &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<double> &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<double> &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<double> &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<dim>::lines_per_cell; ++l) + if (!(cell->line_orientation (l))) + face_sign[l] = -1.0; + } } @@ -383,13 +421,18 @@ FE_PolyTensor<POLY,dim,spacedim>::fill_fe_values ( // Compute eventual sign changes depending on the neighborhood // between two faces. std::vector<double> 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<POLY,dim,spacedim>::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<POLY,dim,spacedim>::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<POLY,dim,spacedim>::fill_fe_face_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. std::vector<double> 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; i<this->dofs_per_cell; ++i) { @@ -646,7 +693,7 @@ FE_PolyTensor<POLY,dim,spacedim>::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<POLY,dim,spacedim>::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<POLY,dim,spacedim>::fill_fe_subface_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. std::vector<double> 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; i<this->dofs_per_cell; ++i) { @@ -849,7 +901,7 @@ FE_PolyTensor<POLY,dim,spacedim>::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 <deal.II/base/quadrature_lib.h> #include <deal.II/fe/fe_q.h> 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 43d46d3dc9..77aab44e1a 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 <deal.II/base/quadrature.h> #include <deal.II/base/qprojector.h> @@ -1007,7 +1011,7 @@ FE_Q_Base<POLY,dim,spacedim>::initialize_constraints (const std::vector<Point<1> template <class POLY, int dim, int spacedim> -const FullMatrix<double>& +const FullMatrix<double> & FE_Q_Base<POLY,dim,spacedim> ::get_prolongation_matrix (const unsigned int child, const RefinementCase<dim> &refinement_case) const @@ -1062,7 +1066,7 @@ FE_Q_Base<POLY,dim,spacedim> // almost negligible also for high order elements const unsigned int dofs1d = this->degree+1; std::vector<Table<2,double> > - subcell_evaluations (dim, Table<2,double>(dofs1d, dofs1d)); + subcell_evaluations (dim, Table<2,double>(dofs1d, dofs1d)); const std::vector<unsigned int> &index_map_inverse = this->poly_space.get_numbering_inverse(); @@ -1173,8 +1177,8 @@ FE_Q_Base<POLY,dim,spacedim> #endif // swap matrices - std::swap(const_cast<FullMatrix<double> &> - (this->prolongation[refinement_case-1][child]), prolongate); + prolongate.swap(const_cast<FullMatrix<double> &> + (this->prolongation[refinement_case-1][child])); } // finally return the matrix @@ -1184,7 +1188,7 @@ FE_Q_Base<POLY,dim,spacedim> template <class POLY, int dim, int spacedim> -const FullMatrix<double>& +const FullMatrix<double> & FE_Q_Base<POLY,dim,spacedim> ::get_restriction_matrix (const unsigned int child, const RefinementCase<dim> &refinement_case) const @@ -1305,9 +1309,8 @@ FE_Q_Base<POLY,dim,spacedim> } // swap matrices - std::swap(const_cast<FullMatrix<double> &> - (this->restriction[refinement_case-1][child]), restriction); - + restriction.swap(const_cast<FullMatrix<double> &> + (this->restriction[refinement_case-1][child])); } return this->restriction[refinement_case-1][child]; 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 <deal.II/base/quadrature.h> #include <deal.II/base/qprojector.h> @@ -260,7 +264,7 @@ get_interpolation_matrix (const FiniteElement<dim,spacedim> &x_source_fe, x_source_fe.dofs_per_cell)); this->FE_Q_Base<TensorProductPolynomialsConst<dim>,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 <deal.II/fe/fe_q_hierarchical.h> #include <deal.II/fe/fe_nothing.h> 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 <deal.II/base/quadrature_lib.h> #include <deal.II/fe/fe_q_iso_q1.h> @@ -29,7 +33,7 @@ FE_Q_iso_Q1<dim,spacedim>::FE_Q_iso_Q1 (const unsigned int subdivisions) : FE_Q_Base<TensorProductPolynomials<dim,Polynomials::PiecewisePolynomial<double> >, dim, spacedim> ( TensorProductPolynomials<dim,Polynomials::PiecewisePolynomial<double> > - (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)), + (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)), FiniteElementData<dim>(this->get_dpo_vector(subdivisions), 1, subdivisions, FiniteElementData<dim>::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 <deal.II/base/utilities.h> #include <deal.II/base/quadrature.h> 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/qprojector.h> 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 5d12365cc9..2f45064642 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/quadrature.h> @@ -591,7 +593,7 @@ FESystem<dim,spacedim>::get_interpolation_matrix ( template <int dim, int spacedim> -const FullMatrix<double>& +const FullMatrix<double> & FESystem<dim,spacedim> ::get_restriction_matrix (const unsigned int child, const RefinementCase<dim> &refinement_case) const @@ -618,7 +620,7 @@ FESystem<dim,spacedim> // shortcut for accessing local restrictions further down std::vector<const FullMatrix<double> *> - base_matrices(this->n_base_elements()); + base_matrices(this->n_base_elements()); for (unsigned int i=0; i<this->n_base_elements(); ++i) { @@ -658,19 +660,19 @@ FESystem<dim,spacedim> // 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: restriction(i,j) = (*base_matrices[base])(base_index_i,base_index_j); } - std::swap(restriction, const_cast<FullMatrix<double> &> - (this->restriction[refinement_case-1][child])); + restriction.swap(const_cast<FullMatrix<double> &> + (this->restriction[refinement_case-1][child])); } } @@ -680,7 +682,7 @@ FESystem<dim,spacedim> template <int dim, int spacedim> -const FullMatrix<double>& +const FullMatrix<double> & FESystem<dim,spacedim> ::get_prolongation_matrix (const unsigned int child, const RefinementCase<dim> &refinement_case) const @@ -704,7 +706,7 @@ FESystem<dim,spacedim> bool do_prolongation = true; std::vector<const FullMatrix<double> *> - base_matrices(this->n_base_elements()); + base_matrices(this->n_base_elements()); for (unsigned int i=0; i<this->n_base_elements(); ++i) { base_matrices[i] = @@ -727,15 +729,15 @@ FESystem<dim,spacedim> 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); } - std::swap(prolongate, const_cast<FullMatrix<double> &> - (this->prolongation[refinement_case-1][child])); + prolongate.swap(const_cast<FullMatrix<double> &> + (this->prolongation[refinement_case-1][child])); } } @@ -2460,17 +2462,17 @@ FESystem<dim,spacedim>::multiply_dof_numbers ( unsigned int index = 0; for (unsigned int index=0; index<fes.size(); ++index) if (multiplicities[index]>0) - { - total_conformity = fes[index]->conforming_space; - break; - } + { + total_conformity = fes[index]->conforming_space; + break; + } for (; index<fes.size(); ++index) if (multiplicities[index]>0) - total_conformity = - typename FiniteElementData<dim>::Conformity(total_conformity - & - fes[index]->conforming_space); + total_conformity = + typename FiniteElementData<dim>::Conformity(total_conformity + & + fes[index]->conforming_space); } std::vector<unsigned int> dpo; @@ -2480,10 +2482,10 @@ FESystem<dim,spacedim>::multiply_dof_numbers ( if (dim>2) dpo.push_back(multiplied_dofs_per_hex); return FiniteElementData<dim> (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 ccff1cf311..fe6be9fd8c 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/qprojector.h> @@ -362,8 +366,8 @@ namespace FETools template<int dim, int spacedim> void compute_block_renumbering ( const FiniteElement<dim,spacedim> &element, - std::vector<unsigned int> &renumbering, - std::vector<unsigned int> &block_data, + std::vector<types::global_dof_index> &renumbering, + std::vector<types::global_dof_index> &block_data, bool return_start_indices) { Assert(renumbering.size() == element.dofs_per_cell, @@ -373,7 +377,7 @@ namespace FETools ExcDimensionMismatch(block_data.size(), element.n_blocks())); - unsigned int k=0; + types::global_dof_index k=0; unsigned int i=0; for (unsigned int b=0; b<element.n_base_elements(); ++b) for (unsigned int m=0; m<element.element_multiplicity(b); ++m) @@ -385,7 +389,7 @@ namespace FETools } Assert (i == element.n_blocks(), ExcInternalError()); - std::vector<unsigned int> start_indices(block_data.size()); + std::vector<types::global_dof_index> start_indices(block_data.size()); k = 0; for (unsigned int i=0; i<block_data.size(); ++i) if (return_start_indices) @@ -399,7 +403,7 @@ namespace FETools //TODO:[GK] This does not work for a single RT for (unsigned int i=0; i<element.dofs_per_cell; ++i) { - std::pair<unsigned int, unsigned int> + std::pair<unsigned int, types::global_dof_index> indices = element.system_to_block_index(i); renumbering[i] = start_indices[indices.first] +indices.second; @@ -1341,7 +1345,7 @@ namespace FETools typename DH2<dim,spacedim>::active_cell_iterator cell2 = dof2.begin_active(), endc2 = dof2.end(); - std::vector<unsigned int> dofs; + std::vector<types::global_dof_index> dofs; dofs.reserve (DoFTools::max_dofs_per_cell (dof2)); u2 = 0; @@ -1435,7 +1439,7 @@ namespace FETools // for parallel vectors check, // if this component is owned by // this processor. - for (unsigned int i=0; i<dof2.n_dofs(); ++i) + for (types::global_dof_index i=0; i<dof2.n_dofs(); ++i) if (locally_owned_dofs.is_element(i)) { Assert(touch_count(i)!=0, ExcInternalError()); @@ -1690,10 +1694,10 @@ namespace FETools DoFTools::extract_locally_relevant_dofs (dof2, dof2_locally_relevant_dofs); - parallel::distributed::Vector<Number> - u2 (dof2_locally_owned_dofs, - dof2_locally_relevant_dofs, - u1.get_mpi_communicator()); + parallel::distributed::Vector<Number> + u2 (dof2_locally_owned_dofs, + dof2_locally_relevant_dofs, + u1.get_mpi_communicator()); interpolate(dof1, u1, dof2, constraints2, u2); u2.update_ghost_values (); @@ -1859,7 +1863,7 @@ namespace FETools Vector<double> u1_local(n1); Vector<double> u2_local(n2); - std::vector<unsigned int> dofs(n2); + std::vector<types::global_dof_index> dofs(n2); FullMatrix<double> matrix(n2,n1); get_projection_matrix(dof1.get_fe(), dof2.get_fe(), matrix); diff --git a/deal.II/source/fe/fe_tools.inst.in b/deal.II/source/fe/fe_tools.inst.in index 22ee6025b0..081a327485 100644 --- a/deal.II/source/fe/fe_tools.inst.in +++ b/deal.II/source/fe/fe_tools.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; Vector : SERIAL_VECTORS) @@ -39,7 +43,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void compute_block_renumbering ( const FiniteElement<deal_II_dimension,deal_II_space_dimension>& , - std::vector<unsigned int>&, std::vector<unsigned int>&, bool); + std::vector<types::global_dof_index>&, std::vector<types::global_dof_index>&, bool); template void compute_projection_matrices<deal_II_dimension, double, deal_II_space_dimension> diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index 44769ce659..0602d5fd09 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/quadrature.h> @@ -40,7 +42,7 @@ namespace template <class VectorType> double get_vector_element (const VectorType &vector, - const unsigned int cell_number) + const types::global_dof_index cell_number) { return vector[cell_number]; } @@ -48,7 +50,7 @@ namespace double get_vector_element (const IndexSet &is, - const unsigned int cell_number) + const types::global_dof_index cell_number) { return (is.is_element(cell_number) ? 1 : 0); } @@ -342,6 +344,104 @@ namespace FEValuesViews } + template <int dim, int spacedim> + Tensor<2, dim, spacedim>:: + Tensor(const FEValuesBase<dim, spacedim> &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<unsigned int> 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 <int dim, int spacedim> + Tensor<2, dim, spacedim>::Tensor() + : + fe_values(*static_cast<dealii::FEValuesBase<dim, spacedim>*> (0)), + first_tensor_component(numbers::invalid_unsigned_int) + {} + + + + template <int dim, int spacedim> + 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<n_quadrature_points; ++q_point) - values[q_point] += value * *shape_value_ptr++; + values[q_point] += value **shape_value_ptr++; } } @@ -391,9 +491,9 @@ namespace FEValuesViews template <int order, int dim, int spacedim> void do_function_derivatives (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<order,spacedim> > > &shape_derivatives, + const std::vector<std::vector<dealii::Tensor<order,spacedim> > > &shape_derivatives, const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data, - std::vector<Tensor<order,spacedim> > &derivatives) + std::vector<dealii::Tensor<order,spacedim> > &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<order,spacedim>()); + dealii::Tensor<order,spacedim>()); for (unsigned int shape_function=0; shape_function<dofs_per_cell; ++shape_function) @@ -411,10 +511,10 @@ namespace FEValuesViews if (value == 0.) continue; - const Tensor<order,spacedim> *shape_derivative_ptr = + const dealii::Tensor<order,spacedim> *shape_derivative_ptr = &shape_derivatives[shape_function_data[shape_function].row_index][0]; for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - derivatives[q_point] += value * *shape_derivative_ptr++; + derivatives[q_point] += value **shape_derivative_ptr++; } } @@ -423,7 +523,7 @@ namespace FEValuesViews template <int dim, int spacedim> void do_function_laplacians (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<2,spacedim> > > &shape_hessians, + const std::vector<std::vector<dealii::Tensor<2,spacedim> > > &shape_hessians, const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data, std::vector<double> &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<n_quadrature_points; ++q_point) laplacians[q_point] += value * trace(*shape_hessian_ptr++); @@ -457,14 +557,14 @@ namespace FEValuesViews void do_function_values (const ::dealii::Vector<double> &dof_values, const Table<2,double> &shape_values, const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data, - std::vector<Tensor<1,spacedim> > &values) + std::vector<dealii::Tensor<1,spacedim> > &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<dofs_per_cell; ++shape_function) @@ -485,7 +585,7 @@ namespace FEValuesViews shape_function_data[shape_function].single_nonzero_component_index; const double *shape_value_ptr = &shape_values(snc,0); for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - values[q_point][comp] += value * *shape_value_ptr++; + values[q_point][comp] += value **shape_value_ptr++; } else for (unsigned int d=0; d<spacedim; ++d) @@ -494,7 +594,7 @@ namespace FEValuesViews const double *shape_value_ptr = &shape_values(shape_function_data[shape_function].row_index[d],0); for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - values[q_point][d] += value * *shape_value_ptr++; + values[q_point][d] += value **shape_value_ptr++; } } } @@ -504,9 +604,9 @@ namespace FEValuesViews template <int order, int dim, int spacedim> void do_function_derivatives (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<order,spacedim> > > &shape_derivatives, + const std::vector<std::vector<dealii::Tensor<order,spacedim> > > &shape_derivatives, const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data, - std::vector<Tensor<order+1,spacedim> > &derivatives) + std::vector<dealii::Tensor<order+1,spacedim> > &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<order+1,spacedim>()); + dealii::Tensor<order+1,spacedim>()); for (unsigned int shape_function=0; shape_function<dofs_per_cell; ++shape_function) @@ -533,20 +633,20 @@ namespace FEValuesViews { const unsigned int comp = shape_function_data[shape_function].single_nonzero_component_index; - const Tensor<order,spacedim> *shape_derivative_ptr = + const dealii::Tensor<order,spacedim> *shape_derivative_ptr = &shape_derivatives[snc][0]; for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - derivatives[q_point][comp] += value * *shape_derivative_ptr++; + derivatives[q_point][comp] += value **shape_derivative_ptr++; } else for (unsigned int d=0; d<spacedim; ++d) if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) { - const Tensor<order,spacedim> *shape_derivative_ptr = + const dealii::Tensor<order,spacedim> *shape_derivative_ptr = &shape_derivatives[shape_function_data[shape_function]. row_index[d]][0]; for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - derivatives[q_point][d] += value * *shape_derivative_ptr++; + derivatives[q_point][d] += value **shape_derivative_ptr++; } } } @@ -556,7 +656,7 @@ namespace FEValuesViews template <int dim, int spacedim> void do_function_symmetric_gradients (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients, + const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients, const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data, std::vector<dealii::SymmetricTensor<2,spacedim> > &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<n_quadrature_points; ++q_point) symmetric_gradients[q_point] += value * @@ -594,7 +694,7 @@ namespace FEValuesViews else for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) { - Tensor<2,spacedim> grad; + dealii::Tensor<2,spacedim> grad; for (unsigned int d=0; d<spacedim; ++d) if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) grad[d] = value * @@ -609,7 +709,7 @@ namespace FEValuesViews template <int dim, int spacedim> void do_function_divergences (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients, + const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients, const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data, std::vector<double> &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<n_quadrature_points; ++q_point) divergences[q_point] += value * (*shape_gradient_ptr++)[comp]; } @@ -645,7 +745,7 @@ namespace FEValuesViews for (unsigned int d=0; d<spacedim; ++d) if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) { - 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; ++q_point) @@ -659,7 +759,7 @@ namespace FEValuesViews template <int dim, int spacedim> void do_function_curls (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients, + const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients, const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data, std::vector<typename dealii::internal::CurlType<spacedim>::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 <int dim, int spacedim> void do_function_laplacians (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<2,spacedim> > > &shape_hessians, + const std::vector<std::vector<dealii::Tensor<2,spacedim> > > &shape_hessians, const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data, - std::vector<Tensor<1,spacedim> > &laplacians) + std::vector<dealii::Tensor<1,spacedim> > &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<dofs_per_cell; ++shape_function) @@ -873,7 +974,7 @@ namespace FEValuesViews { const unsigned int comp = shape_function_data[shape_function].single_nonzero_component_index; - const Tensor<2,spacedim> *shape_hessian_ptr = + const dealii::Tensor<2,spacedim> *shape_hessian_ptr = &shape_hessians[snc][0]; for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) laplacians[q_point][comp] += value * trace(*shape_hessian_ptr++); @@ -882,7 +983,7 @@ namespace FEValuesViews for (unsigned int d=0; d<spacedim; ++d) if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) { - const Tensor<2,spacedim> *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<n_quadrature_points; ++q_point) @@ -930,7 +1031,7 @@ namespace FEValuesViews (shape_function_data[shape_function].single_nonzero_component_index); const double *shape_value_ptr = &shape_values(snc,0); for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - values[q_point][comp] += value * *shape_value_ptr++; + values[q_point][comp] += value **shape_value_ptr++; } else for (unsigned int d=0; @@ -942,7 +1043,7 @@ namespace FEValuesViews const double *shape_value_ptr = &shape_values(shape_function_data[shape_function].row_index[d],0); for (unsigned int q_point=0; q_point<n_quadrature_points; ++q_point) - values[q_point][comp] += value * *shape_value_ptr++; + values[q_point][comp] += value **shape_value_ptr++; } } } @@ -952,16 +1053,17 @@ namespace FEValuesViews template <int dim, int spacedim> void do_function_divergences (const ::dealii::Vector<double> &dof_values, - const std::vector<std::vector<Tensor<1,spacedim> > > &shape_gradients, + const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients, const std::vector<typename SymmetricTensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data, - std::vector<Tensor<1,spacedim> > &divergences) + std::vector<dealii::Tensor<1,spacedim> > &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<dofs_per_cell; ++shape_function) @@ -981,7 +1083,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]; 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 <int dim, int spacedim> + void + do_function_values (const ::dealii::Vector<double> &dof_values, + const Table<2,double> &shape_values, + const std::vector<typename Tensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data, + std::vector<dealii::Tensor<2,spacedim> > &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<dofs_per_cell; ++shape_function) + { + const int snc = shape_function_data[shape_function].single_nonzero_component; + + if (snc == -2) + // shape function is zero for the selected components + continue; + + const double value = dof_values(shape_function); + if (value == 0.) + continue; + + if (snc != -1) + { + const unsigned int comp = + shape_function_data[shape_function].single_nonzero_component_index; + + const TableIndices<2> 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<n_quadrature_points; ++q_point) + values[q_point][indices] += value **shape_value_ptr++; + } + else + for (unsigned int d=0; + d<dim*dim; ++d) + if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) + { + const TableIndices<2> 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<n_quadrature_points; ++q_point) + values[q_point][indices] += value **shape_value_ptr++; + } + } + } + + + + template <int dim, int spacedim> + void + do_function_divergences (const ::dealii::Vector<double> &dof_values, + const std::vector<std::vector<dealii::Tensor<1,spacedim> > > &shape_gradients, + const std::vector<typename Tensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data, + std::vector<dealii::Tensor<1,spacedim> > &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<dofs_per_cell; ++shape_function) + { + const int snc = shape_function_data[shape_function].single_nonzero_component; + + if (snc == -2) + // shape function is zero for the selected components + continue; + + const double value = dof_values(shape_function); + if (value == 0.) + continue; + + if (snc != -1) + { + const unsigned int comp = + shape_function_data[shape_function].single_nonzero_component_index; + + const dealii::Tensor < 1, spacedim> *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<dim,spacedim> (dof_values, fe_values.shape_gradients, shape_function_data, divergences); } + + template <int dim, int spacedim> + template <class InputVector> + void + Tensor<2, dim, spacedim>:: + get_function_values(const InputVector &fe_function, + std::vector<value_type> &values) const + { + typedef FEValuesBase<dim, spacedim> 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<double> dof_values(fe_values.dofs_per_cell); + fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values); + internal::do_function_values<dim,spacedim> + (dof_values, fe_values.shape_values, shape_function_data, values); + } + + + + template <int dim, int spacedim> + template <class InputVector> + void + Tensor<2, dim, spacedim>:: + get_function_divergences(const InputVector &fe_function, + std::vector<divergence_type> &divergences) const + { + typedef FEValuesBase<dim, spacedim> 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<double> dof_values(fe_values.dofs_per_cell); + fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values); + internal::do_function_divergences<dim,spacedim> + (dof_values, fe_values.shape_gradients, shape_function_data, divergences); + } } @@ -1431,6 +1696,28 @@ namespace internal 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) + { +#ifndef DEAL_II_EXPLICIT_DESTRUCTOR_BUG + second_order_tensors[component] + .dealii::FEValuesViews::Tensor<2, dim, spacedim>::~Tensor(); +#else + typedef dealii::FEValuesViews::Tensor<2, dim, spacedim> TensorView; + second_order_tensors[component].TensorView::~TensorView(); +#endif + new (&second_order_tensors[component]) + dealii::FEValuesViews::Tensor<2, dim, spacedim > (fe_values, + component); + } } } } @@ -1474,7 +1761,7 @@ public: * to. */ virtual - unsigned int + types::global_dof_index n_dofs_for_dof_handler () const = 0; #include "fe_values.decl.1.inst" @@ -1543,7 +1830,7 @@ public: * to. */ virtual - unsigned int + types::global_dof_index n_dofs_for_dof_handler () const; #include "fe_values.decl.2.inst" @@ -1646,7 +1933,7 @@ public: * error. */ virtual - unsigned int + types::global_dof_index n_dofs_for_dof_handler () const; #include "fe_values.decl.2.inst" @@ -1706,7 +1993,7 @@ operator typename Triangulation<dim,spacedim>::cell_iterator () const template <int dim, int spacedim> template <typename CI> -unsigned int +types::global_dof_index FEValuesBase<dim,spacedim>::CellIterator<CI>::n_dofs_for_dof_handler () const { return cell->get_dof_handler().n_dofs(); @@ -1726,7 +2013,7 @@ get_interpolated_dof_values (const IndexSet &in, { Assert (cell->has_children() == false, ExcNotImplemented()); - std::vector<unsigned int> dof_indices (cell->get_fe().dofs_per_cell); + std::vector<types::global_dof_index> dof_indices (cell->get_fe().dofs_per_cell); cell->get_dof_indices (dof_indices); for (unsigned int i=0; i<cell->get_fe().dofs_per_cell; ++i) @@ -1767,7 +2054,7 @@ operator typename Triangulation<dim,spacedim>::cell_iterator () const template <int dim, int spacedim> -unsigned int +types::global_dof_index FEValuesBase<dim,spacedim>::TriaCellIterator::n_dofs_for_dof_handler () const { Assert (false, ExcMessage (message_string)); @@ -1950,7 +2237,7 @@ namespace internal const double *shape_value_ptr = &shape_values(shape_func, 0); for (unsigned int point=0; point<n_quadrature_points; ++point) - values[point] += value * *shape_value_ptr++; + values[point] += value **shape_value_ptr++; } } @@ -2013,11 +2300,11 @@ namespace internal { VectorType &values_comp = values[comp]; for (unsigned int point=0; point<n_quadrature_points; ++point) - values_comp[point] += value * *shape_value_ptr++; + values_comp[point] += value **shape_value_ptr++; } else for (unsigned int point=0; point<n_quadrature_points; ++point) - values[point][comp] += value * *shape_value_ptr++; + values[point][comp] += value **shape_value_ptr++; } else for (unsigned int c=0; c<n_components; ++c) @@ -2036,11 +2323,11 @@ namespace internal VectorType &values_comp = values[comp]; for (unsigned int point=0; point<n_quadrature_points; ++point) - values_comp[point] += value * *shape_value_ptr++; + values_comp[point] += value **shape_value_ptr++; } else for (unsigned int point=0; point<n_quadrature_points; ++point) - values[point][comp] += value * *shape_value_ptr++; + values[point][comp] += value **shape_value_ptr++; } } } @@ -2077,7 +2364,7 @@ namespace internal const Tensor<order,spacedim> *shape_derivative_ptr = &shape_derivatives[shape_func][0]; for (unsigned int point=0; point<n_quadrature_points; ++point) - derivatives[point] += value * *shape_derivative_ptr++; + derivatives[point] += value **shape_derivative_ptr++; } } @@ -2139,10 +2426,10 @@ namespace internal if (quadrature_points_fastest) for (unsigned int point=0; point<n_quadrature_points; ++point) - derivatives[comp][point] += value * *shape_derivative_ptr++; + derivatives[comp][point] += value **shape_derivative_ptr++; else for (unsigned int point=0; point<n_quadrature_points; ++point) - derivatives[point][comp] += value * *shape_derivative_ptr++; + derivatives[point][comp] += value **shape_derivative_ptr++; } else for (unsigned int c=0; c<n_components; ++c) @@ -2159,10 +2446,10 @@ namespace internal if (quadrature_points_fastest) for (unsigned int point=0; point<n_quadrature_points; ++point) - derivatives[comp][point] += value * *shape_derivative_ptr++; + derivatives[comp][point] += value **shape_derivative_ptr++; else for (unsigned int point=0; point<n_quadrature_points; ++point) - derivatives[point][comp] += value * *shape_derivative_ptr++; + derivatives[point][comp] += value **shape_derivative_ptr++; } } } @@ -2318,7 +2605,7 @@ template <int dim, int spacedim> template <class InputVector, typename number> void FEValuesBase<dim,spacedim>::get_function_values ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<number> &values) const { Assert (this->update_flags & update_values, ExcAccessToUninitializedField()); @@ -2371,7 +2658,7 @@ template <int dim, int spacedim> template <class InputVector, typename number> void FEValuesBase<dim,spacedim>::get_function_values ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Vector<number> > &values) const { // Size of indices must be a multiple of dofs_per_cell such that an integer @@ -2407,7 +2694,7 @@ template <int dim, int spacedim> template <class InputVector> void FEValuesBase<dim,spacedim>::get_function_values ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, VectorSlice<std::vector<std::vector<double> > > values, bool quadrature_points_fastest) const { @@ -2468,7 +2755,7 @@ template <int dim, int spacedim> template <class InputVector> void FEValuesBase<dim,spacedim>::get_function_gradients ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Tensor<1,spacedim> > &gradients) const { Assert (this->update_flags & update_gradients, ExcAccessToUninitializedField()); @@ -2522,7 +2809,7 @@ template <int dim, int spacedim> template <class InputVector> void FEValuesBase<dim,spacedim>::get_function_gradients ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, VectorSlice<std::vector<std::vector<Tensor<1,spacedim> > > > gradients, bool quadrature_points_fastest) const { @@ -2581,7 +2868,7 @@ template <int dim, int spacedim> template <class InputVector> void FEValuesBase<dim,spacedim>::get_function_hessians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Tensor<2,spacedim> > &hessians) const { Assert (this->update_flags & update_second_derivatives, @@ -2637,7 +2924,7 @@ template <int dim, int spacedim> template <class InputVector> void FEValuesBase<dim, spacedim>::get_function_hessians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, VectorSlice<std::vector<std::vector<Tensor<2,spacedim> > > > hessians, bool quadrature_points_fastest) const { @@ -2694,7 +2981,7 @@ template <int dim, int spacedim> template <class InputVector, typename number> void FEValuesBase<dim,spacedim>::get_function_laplacians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<number> &laplacians) const { Assert (this->update_flags & update_hessians, ExcAccessToUninitializedField()); @@ -2745,7 +3032,7 @@ template <int dim, int spacedim> template <class InputVector, typename number> void FEValuesBase<dim,spacedim>::get_function_laplacians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<Vector<number> > &laplacians) const { // Size of indices must be a multiple of dofs_per_cell such that an integer @@ -2781,7 +3068,7 @@ template <int dim, int spacedim> template <class InputVector, typename number> void FEValuesBase<dim,spacedim>::get_function_laplacians ( const InputVector &fe_function, - const VectorSlice<const std::vector<unsigned int> > &indices, + const VectorSlice<const std::vector<types::global_dof_index> > &indices, std::vector<std::vector<number> > &laplacians, bool quadrature_points_fastest) const { diff --git a/deal.II/source/fe/fe_values.decl.1.inst.in b/deal.II/source/fe/fe_values.decl.1.inst.in index 3ce481ba0d..e220a5e85b 100644 --- a/deal.II/source/fe/fe_values.decl.1.inst.in +++ b/deal.II/source/fe/fe_values.decl.1.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. +// +// --------------------------------------------------------------------- + // Declarations of member functions of FEValuesBase::CellIteratorBase diff --git a/deal.II/source/fe/fe_values.decl.2.inst.in b/deal.II/source/fe/fe_values.decl.2.inst.in index ea74d7d29e..567c93f435 100644 --- a/deal.II/source/fe/fe_values.decl.2.inst.in +++ b/deal.II/source/fe/fe_values.decl.2.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. +// +// --------------------------------------------------------------------- + // Declarations of member functions of FEValuesBase::CellIteratorBase diff --git a/deal.II/source/fe/fe_values.impl.1.inst.in b/deal.II/source/fe/fe_values.impl.1.inst.in index 2bc5e86253..3dfaaa1a9d 100644 --- a/deal.II/source/fe/fe_values.impl.1.inst.in +++ b/deal.II/source/fe/fe_values.impl.1.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/fe/fe_values.impl.2.inst.in b/deal.II/source/fe/fe_values.impl.2.inst.in index 5abe9d29fd..95883209fd 100644 --- a/deal.II/source/fe/fe_values.impl.2.inst.in +++ b/deal.II/source/fe/fe_values.impl.2.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/fe/fe_values.inst.in b/deal.II/source/fe/fe_values.inst.in index 111b81394a..e63ce3fced 100644 --- a/deal.II/source/fe/fe_values.inst.in +++ b/deal.II/source/fe/fe_values.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. +// +// --------------------------------------------------------------------- + // Instantiations of functions in FEValuesViews (explicitly write // dealii:: namespace in order to not confuse the compiler with @@ -36,6 +40,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template class Scalar<deal_II_dimension, deal_II_space_dimension>; template class Vector<deal_II_dimension, deal_II_space_dimension>; 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<deal_II_dimension, deal_II_space_dimension> ::get_function_gradients<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<1,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<1,deal_II_space_dimension> >&) const; template void FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension> ::get_function_hessians<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<2,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<2,deal_II_space_dimension> >&) const; template void FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension> ::get_function_laplacians<dealii::VEC> @@ -83,11 +88,11 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension> ::get_function_values<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<1,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<1,deal_II_space_dimension> >&) const; template void FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension> ::get_function_gradients<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<2,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<2,deal_II_space_dimension> >&) const; template void FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension> ::get_function_symmetric_gradients<dealii::VEC> @@ -103,11 +108,11 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension> ::get_function_hessians<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<3,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<3,deal_II_space_dimension> >&) const; template void FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension> ::get_function_laplacians<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<1,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<1,deal_II_space_dimension> >&) 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<dealii::VEC> - (const dealii::VEC&, std::vector<Tensor<1,deal_II_space_dimension> >&) const; + (const dealii::VEC&, std::vector<dealii::Tensor<1,deal_II_space_dimension> >&) const; + + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension> + ::get_function_values<dealii::VEC> + (const dealii::VEC&, std::vector<dealii::Tensor<2,deal_II_space_dimension> >&) const; + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension> + ::get_function_divergences<dealii::VEC> + (const dealii::VEC&, std::vector<dealii::Tensor<1,deal_II_space_dimension> >&) const; #endif #endif } @@ -136,10 +150,10 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi (const VEC&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<double>&) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> @@ -150,53 +164,53 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<double> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<float> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, VectorSlice<std::vector<std::vector<double> > >, bool) const; // template // void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_values<VEC> -// (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, +// (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, // VectorSlice<std::vector<std::vector<float> > >, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_gradients<VEC> - (const VEC&, std::vector<Tensor<1,deal_II_space_dimension> > &) const; + (const VEC&, std::vector<dealii::Tensor<1,deal_II_space_dimension> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_gradients<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, - std::vector<Tensor<1,deal_II_space_dimension> > &) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, + std::vector<dealii::Tensor<1,deal_II_space_dimension> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_gradients<VEC> - (const VEC&, std::vector<std::vector<Tensor<1,deal_II_space_dimension> > > &) const; + (const VEC&, std::vector<std::vector<dealii::Tensor<1,deal_II_space_dimension> > > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_gradients<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, - VectorSlice<std::vector<std::vector<Tensor<1,deal_II_space_dimension> > > >, bool) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, + VectorSlice<std::vector<std::vector<dealii::Tensor<1,deal_II_space_dimension> > > >, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_hessians<VEC> - (const VEC&, std::vector<Tensor<2,deal_II_space_dimension> > &) const; + (const VEC&, std::vector<dealii::Tensor<2,deal_II_space_dimension> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_hessians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, - std::vector<Tensor<2,deal_II_space_dimension> > &) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, + std::vector<dealii::Tensor<2,deal_II_space_dimension> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_hessians<VEC> - (const VEC&, std::vector<std::vector<Tensor<2,deal_II_space_dimension> > > &, bool) const; + (const VEC&, std::vector<std::vector<dealii::Tensor<2,deal_II_space_dimension> > > &, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_hessians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, - VectorSlice<std::vector<std::vector<Tensor<2,deal_II_space_dimension> > > >, bool) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, + VectorSlice<std::vector<std::vector<dealii::Tensor<2,deal_II_space_dimension> > > >, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> @@ -206,10 +220,10 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi (const VEC&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<double>&) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const; + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> @@ -220,20 +234,20 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<double> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<float> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<std::vector<double> > &, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_space_dimension>::get_function_laplacians<VEC> - (const VEC&, const VectorSlice<const std::vector<unsigned int> >&, + (const VEC&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<std::vector<float> > &, bool) const; #endif @@ -251,20 +265,20 @@ for (deal_II_dimension : DIMENSIONS) (const dealii::IndexSet&, std::vector<double>&) const; template void FEValuesViews::Scalar<deal_II_dimension>::get_function_gradients<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension> >&) const; template void FEValuesViews::Scalar<deal_II_dimension>::get_function_hessians<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension> >&) const; template void FEValuesViews::Scalar<deal_II_dimension>::get_function_laplacians<dealii::IndexSet> (const dealii::IndexSet&, std::vector<double>&) const; template void FEValuesViews::Vector<deal_II_dimension>::get_function_values<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension> >&) const; template void FEValuesViews::Vector<deal_II_dimension>::get_function_gradients<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension> >&) const; template void FEValuesViews::Vector<deal_II_dimension>::get_function_symmetric_gradients<dealii::IndexSet> (const dealii::IndexSet&, std::vector<dealii::SymmetricTensor<2,deal_II_dimension> >&) const; @@ -276,17 +290,24 @@ for (deal_II_dimension : DIMENSIONS) (const dealii::IndexSet&, std::vector<double>&) const; template void FEValuesViews::Vector<deal_II_dimension>::get_function_hessians<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<3,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<3,deal_II_dimension> >&) const; template void FEValuesViews::Vector<deal_II_dimension>::get_function_laplacians<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension> >&) const; template void FEValuesViews::SymmetricTensor<2,deal_II_dimension,deal_II_dimension>::get_function_values<dealii::IndexSet> (const dealii::IndexSet&, std::vector<dealii::SymmetricTensor<2,deal_II_dimension> >&) const; template void FEValuesViews::SymmetricTensor<2,deal_II_dimension,deal_II_dimension>::get_function_divergences<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension> >&) const; + + template + void FEValuesViews::Tensor<2,deal_II_dimension,deal_II_dimension>::get_function_values<dealii::IndexSet> + (const dealii::IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension> >&) const; + template + void FEValuesViews::Tensor<2,deal_II_dimension,deal_II_dimension>::get_function_divergences<dealii::IndexSet> + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension> >&) const; #if deal_II_dimension != 3 @@ -297,11 +318,11 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1> ::get_function_gradients<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension+1> >&) const; template void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1> ::get_function_hessians<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension+1> >&) const; template void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1> ::get_function_laplacians<dealii::IndexSet> @@ -310,11 +331,11 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1> ::get_function_values<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension+1> >&) const; template void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1> ::get_function_gradients<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension+1> >&) const; template void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1> ::get_function_symmetric_gradients<dealii::IndexSet> @@ -326,11 +347,11 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1> ::get_function_hessians<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<3,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<3,deal_II_dimension+1> >&) const; template void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1> ::get_function_laplacians<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension+1> >&) 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<dealii::IndexSet> - (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const; + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension+1> >&) const; + + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_dimension+1> + ::get_function_values<dealii::IndexSet> + (const dealii::IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension+1> >&) const; + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_dimension+1> + ::get_function_divergences<dealii::IndexSet> + (const dealii::IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension+1> >&) const; #endif #endif @@ -360,10 +390,10 @@ for (deal_II_dimension : DIMENSIONS) (const IndexSet&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<double>&) const; template void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> @@ -374,53 +404,53 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<double> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<float> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, VectorSlice<std::vector<std::vector<double> > >, bool) const; // template // void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet> -// (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, +// (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, // VectorSlice<std::vector<std::vector<float> > >, bool) const; template void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet> - (const IndexSet&, std::vector<Tensor<1,deal_II_dimension> > &) const; + (const IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - std::vector<Tensor<1,deal_II_dimension> > &) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + std::vector<dealii::Tensor<1,deal_II_dimension> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet> - (const IndexSet&, std::vector<std::vector<Tensor<1,deal_II_dimension> > > &) const; + (const IndexSet&, std::vector<std::vector<dealii::Tensor<1,deal_II_dimension> > > &) const; template void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - VectorSlice<std::vector<std::vector<Tensor<1,deal_II_dimension> > > >, bool) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + VectorSlice<std::vector<std::vector<dealii::Tensor<1,deal_II_dimension> > > >, bool) const; template void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet> - (const IndexSet&, std::vector<Tensor<2,deal_II_dimension> > &) const; + (const IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - std::vector<Tensor<2,deal_II_dimension> > &) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + std::vector<dealii::Tensor<2,deal_II_dimension> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet> - (const IndexSet&, std::vector<std::vector<Tensor<2,deal_II_dimension> > > &, bool) const; + (const IndexSet&, std::vector<std::vector<dealii::Tensor<2,deal_II_dimension> > > &, bool) const; template void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - VectorSlice<std::vector<std::vector<Tensor<2,deal_II_dimension> > > >, bool) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + VectorSlice<std::vector<std::vector<dealii::Tensor<2,deal_II_dimension> > > >, bool) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> @@ -430,10 +460,10 @@ for (deal_II_dimension : DIMENSIONS) (const IndexSet&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<double>&) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> @@ -444,20 +474,20 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<double> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<float> > &) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<std::vector<double> > &, bool) const; template void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<std::vector<float> > &, bool) const; @@ -471,10 +501,10 @@ for (deal_II_dimension : DIMENSIONS) (const IndexSet&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<double>&) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> @@ -485,53 +515,53 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<double> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<float> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, VectorSlice<std::vector<std::vector<double> > >, bool) const; // template // void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet> -// (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, +// (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, // VectorSlice<std::vector<std::vector<float> > >, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet> - (const IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> > &) const; + (const IndexSet&, std::vector<dealii::Tensor<1,deal_II_dimension+1> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - std::vector<Tensor<1,deal_II_dimension+1> > &) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + std::vector<dealii::Tensor<1,deal_II_dimension+1> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet> - (const IndexSet&, std::vector<std::vector<Tensor<1,deal_II_dimension+1> > > &) const; + (const IndexSet&, std::vector<std::vector<dealii::Tensor<1,deal_II_dimension+1> > > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - VectorSlice<std::vector<std::vector<Tensor<1,deal_II_dimension+1> > > >, bool) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + VectorSlice<std::vector<std::vector<dealii::Tensor<1,deal_II_dimension+1> > > >, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet> - (const IndexSet&, std::vector<Tensor<2,deal_II_dimension+1> > &) const; + (const IndexSet&, std::vector<dealii::Tensor<2,deal_II_dimension+1> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - std::vector<Tensor<2,deal_II_dimension+1> > &) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + std::vector<dealii::Tensor<2,deal_II_dimension+1> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet> - (const IndexSet&, std::vector<std::vector<Tensor<2,deal_II_dimension+1> > > &, bool) const; + (const IndexSet&, std::vector<std::vector<dealii::Tensor<2,deal_II_dimension+1> > > &, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, - VectorSlice<std::vector<std::vector<Tensor<2,deal_II_dimension+1> > > >, bool) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, + VectorSlice<std::vector<std::vector<dealii::Tensor<2,deal_II_dimension+1> > > >, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> @@ -541,10 +571,10 @@ for (deal_II_dimension : DIMENSIONS) (const IndexSet&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<double>&) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const; + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<float>&) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> @@ -555,20 +585,20 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<double> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<Vector<float> > &) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<std::vector<double> > &, bool) const; template void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet> - (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, + (const IndexSet&, const VectorSlice<const std::vector<types::global_dof_index> >&, std::vector<std::vector<float> > &, bool) const; #endif 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 <deal.II/grid/tria.h> #include <deal.II/fe/mapping.h> 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..1873d9c737 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 <deal.II/grid/tria_accessor.h> #include <deal.II/grid/tria_iterator.h> 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 <deal.II/base/tensor.h> #include <deal.II/base/quadrature.h> 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..663d77482e 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 <deal.II/base/utilities.h> #include <deal.II/base/polynomial.h> 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 <deal.II/base/derivative_form.h> #include <deal.II/base/quadrature.h> @@ -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 <deal.II/fe/mapping_q1_eulerian.h> #include <deal.II/lac/vector.h> 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 a294849a02..4e005c2f8f 100644 --- a/deal.II/source/fe/mapping_q_eulerian.cc +++ b/deal.II/source/fe/mapping_q_eulerian.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $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 <deal.II/base/utilities.h> #include <deal.II/base/quadrature_lib.h> @@ -110,8 +112,8 @@ compute_mapping_support_points // first, basic assertion // with respect to vector size, - const unsigned int n_dofs = euler_dof_handler->n_dofs(); - const unsigned int vector_size = euler_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); diff --git a/deal.II/source/fe/mapping_q_eulerian.inst.in b/deal.II/source/fe/mapping_q_eulerian.inst.in index 4bed2047f6..dd64c5497f 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) { diff --git a/deal.II/source/grid/CMakeLists.txt b/deal.II/source/grid/CMakeLists.txt index bd92b3debb..5e13fa938c 100644 --- a/deal.II/source/grid/CMakeLists.txt +++ b/deal.II/source/grid/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 12dadd0437..e834ca6334 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/thread_management.h> @@ -182,7 +184,7 @@ void GridGenerator::hyper_cube (Triangulation<dim,spacedim> &tria, void GridGenerator::moebius ( Triangulation<3> &tria, - const unsigned int n_cells, + const size_type n_cells, const unsigned int n_rotations, const double R, const double r) @@ -197,7 +199,7 @@ GridGenerator::moebius ( double beta_step=n_rotations*numbers::PI/2.0/n_cells; double alpha_step=2.0*numbers::PI/n_cells; - for (unsigned int i=0; i<n_cells; ++i) + for (size_type i=0; i<n_cells; ++i) for (unsigned int j=0; j<4; ++j) { vertices[4*i+j][0]=R*std::cos(i*alpha_step)+r*std::cos(i*beta_step+j*numbers::PI/2.0)*std::cos(i*alpha_step); @@ -205,10 +207,10 @@ GridGenerator::moebius ( vertices[4*i+j][2]=r*std::sin(i*beta_step+j*numbers::PI/2.0); } - unsigned int offset=0; + size_type offset=0; std::vector<CellData<dim> > cells (n_cells); - for (unsigned int i=0; i<n_cells; ++i) + for (size_type i=0; i<n_cells; ++i) { for (unsigned int j=0; j<2; ++j) { @@ -482,13 +484,13 @@ GridGenerator::parallelepiped (Triangulation<dim> &tria, template<int dim> void GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, - const unsigned int n_subdivisions, + const size_type n_subdivisions, const Point<dim> (&corners) [dim], const bool colorize) { // Equalise number of subdivisions in each dim-direction, heir // validity will be checked later - unsigned int (n_subdivisions_) [dim]; + size_type (n_subdivisions_) [dim]; for (unsigned int i=0; i<dim; ++i) n_subdivisions_[i] = n_subdivisions; @@ -501,7 +503,7 @@ GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, template<int dim> void GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, - const unsigned int ( n_subdivisions) [dim], + const size_type ( n_subdivisions) [dim], const Point<dim> (&corners) [dim], const bool colorize) { @@ -525,20 +527,20 @@ GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, switch (dim) { case 1: - for (unsigned int x=0; x<=n_subdivisions[0]; ++x) + for (size_type x=0; x<=n_subdivisions[0]; ++x) points.push_back (Point<dim> (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) + for (size_type y=0; y<=n_subdivisions[1]; ++y) + for (size_type x=0; x<=n_subdivisions[0]; ++x) points.push_back (Point<dim> (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) + 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<dim> (x*delta[0] + y*delta[1] + z*delta[2])); break; @@ -547,7 +549,7 @@ GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, } // Prepare cell data - unsigned int n_cells = 1; + size_type n_cells = 1; for (unsigned int i=0; i<dim; ++i) n_cells *= n_subdivisions[i]; std::vector<CellData<dim> > cells (n_cells); @@ -556,7 +558,7 @@ GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, switch (dim) { case 1: - for (unsigned int x=0; x<n_subdivisions[0]; ++x) + for (size_type x=0; x<n_subdivisions[0]; ++x) { cells[x].vertices[0] = x; cells[x].vertices[1] = x+1; @@ -569,13 +571,13 @@ GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, case 2: { // Shorthand - const unsigned int n_dy = n_subdivisions[1]; - const unsigned int n_dx = n_subdivisions[0]; + const size_type n_dy = n_subdivisions[1]; + const size_type n_dx = n_subdivisions[0]; - for (unsigned int y=0; y<n_dy; ++y) - for (unsigned int x=0; x<n_dx; ++x) + for (size_type y=0; y<n_dy; ++y) + for (size_type x=0; x<n_dx; ++x) { - const unsigned int c = y*n_dx + x; + const size_type c = y*n_dx + x; cells[c].vertices[0] = y*(n_dx+1) + x; cells[c].vertices[1] = y*(n_dx+1) + x+1; cells[c].vertices[2] = (y+1)*(n_dx+1) + x; @@ -590,15 +592,15 @@ GridGenerator::subdivided_parallelepiped (Triangulation<dim> &tria, case 3: { // Shorthand - const unsigned int n_dz = n_subdivisions[2]; - const unsigned int n_dy = n_subdivisions[1]; - const unsigned int n_dx = n_subdivisions[0]; + const size_type n_dz = n_subdivisions[2]; + const size_type n_dy = n_subdivisions[1]; + const size_type n_dx = n_subdivisions[0]; - for (unsigned int z=0; z<n_dz; ++z) - for (unsigned int y=0; y<n_dy; ++y) - for (unsigned int x=0; x<n_dx; ++x) + for (size_type z=0; z<n_dz; ++z) + for (size_type y=0; y<n_dy; ++y) + for (size_type x=0; x<n_dx; ++x) { - const unsigned int c = z*n_dy*n_dx + y*n_dx + x; + const size_type c = z*n_dy*n_dx + y*n_dx + x; cells[c].vertices[0] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x; cells[c].vertices[1] = z*(n_dy+1)*(n_dx+1) + y*(n_dx+1) + x+1; @@ -932,7 +934,7 @@ GridGenerator::subdivided_hyper_rectangle( } double x = 0; - for (unsigned int j=0; j<step_sizes.at(i).size(); j++) + for (size_type j=0; j<step_sizes.at(i).size(); j++) x += step_sizes[i][j]; Assert(std::fabs(x - (p2(i)-p1(i))) <= 1e-12*std::fabs(x), ExcInvalidRepetitions (i) ); @@ -947,7 +949,7 @@ GridGenerator::subdivided_hyper_rectangle( case 1: { double x=0; - for (unsigned int i=0; ; ++i) + for (size_type i=0; ; ++i) { points.push_back (Point<dim> (p1[0]+x)); @@ -967,10 +969,10 @@ GridGenerator::subdivided_hyper_rectangle( case 2: { double y=0; - for (unsigned int j=0; ; ++j) + for (size_type j=0; ; ++j) { double x=0; - for (unsigned int i=0; ; ++i) + for (size_type i=0; ; ++i) { points.push_back (Point<dim> (p1[0]+x, p1[1]+y)); @@ -991,13 +993,13 @@ GridGenerator::subdivided_hyper_rectangle( case 3: { double z=0; - for (unsigned int k=0; ; ++k) + for (size_type k=0; ; ++k) { double y=0; - for (unsigned int j=0; ; ++j) + for (size_type j=0; ; ++j) { double x=0; - for (unsigned int i=0; ; ++i) + for (size_type i=0; ; ++i) { points.push_back (Point<dim> (p1[0]+x, p1[1]+y, @@ -1034,7 +1036,7 @@ GridGenerator::subdivided_hyper_rectangle( case 1: { cells.resize (step_sizes[0].size()); - for (unsigned int x=0; x<step_sizes[0].size(); ++x) + for (size_type x=0; x<step_sizes[0].size(); ++x) { cells[x].vertices[0] = x; cells[x].vertices[1] = x+1; @@ -1046,10 +1048,10 @@ GridGenerator::subdivided_hyper_rectangle( case 2: { cells.resize (step_sizes[1].size()*step_sizes[0].size()); - for (unsigned int y=0; y<step_sizes[1].size(); ++y) - for (unsigned int x=0; x<step_sizes[0].size(); ++x) + for (size_type y=0; y<step_sizes[1].size(); ++y) + for (size_type x=0; x<step_sizes[0].size(); ++x) { - const unsigned int c = x+y*step_sizes[0].size(); + const size_type c = x+y*step_sizes[0].size(); cells[c].vertices[0] = y*(step_sizes[0].size()+1)+x; cells[c].vertices[1] = y*(step_sizes[0].size()+1)+x+1; cells[c].vertices[2] = (y+1)*(step_sizes[0].size()+1)+x; @@ -1061,15 +1063,15 @@ GridGenerator::subdivided_hyper_rectangle( case 3: { - const unsigned int n_x = (step_sizes[0].size()+1); - const unsigned int n_xy = (step_sizes[0].size()+1)*(step_sizes[1].size()+1); + const size_type n_x = (step_sizes[0].size()+1); + const size_type n_xy = (step_sizes[0].size()+1)*(step_sizes[1].size()+1); cells.resize (step_sizes[2].size()*step_sizes[1].size()*step_sizes[0].size()); - for (unsigned int z=0; z<step_sizes[2].size(); ++z) - for (unsigned int y=0; y<step_sizes[1].size(); ++y) - for (unsigned int x=0; x<step_sizes[0].size(); ++x) + for (size_type z=0; z<step_sizes[2].size(); ++z) + for (size_type y=0; y<step_sizes[1].size(); ++y) + for (size_type x=0; x<step_sizes[0].size(); ++x) { - const unsigned int c = x+y*step_sizes[0].size() + + const size_type c = x+y*step_sizes[0].size() + z*step_sizes[0].size()*step_sizes[1].size(); cells[c].vertices[0] = z*n_xy + y*n_x + x; cells[c].vertices[1] = z*n_xy + y*n_x + x+1; @@ -1130,13 +1132,13 @@ GridGenerator::subdivided_hyper_rectangle ( Assert(spacing.size() == 1, ExcInvalidRepetitionsDimension(1)); - const unsigned int n_cells = material_id.size(0); + const size_type n_cells = material_id.size(0); Assert(spacing[0].size() == n_cells, ExcInvalidRepetitionsDimension(1)); double delta = std::numeric_limits<double>::max(); - for (unsigned int i=0; i<n_cells; i++) + for (size_type i=0; i<n_cells; i++) { Assert (spacing[0][i] >= 0, ExcInvalidRepetitions(-1)); delta = std::min (delta, spacing[0][i]); @@ -1145,20 +1147,20 @@ GridGenerator::subdivided_hyper_rectangle ( // generate the necessary points std::vector<Point<1> > points; double ax = p[0]; - for (unsigned int x=0; x<=n_cells; ++x) + for (size_type x=0; x<=n_cells; ++x) { points.push_back (Point<1> (ax)); if (x<n_cells) ax += spacing[0][x]; } // create the cells - unsigned int n_val_cells = 0; - for (unsigned int i=0; i<n_cells; i++) + size_type n_val_cells = 0; + for (size_type i=0; i<n_cells; i++) if (material_id[i]!=numbers::invalid_material_id) n_val_cells++; std::vector<CellData<1> > cells(n_val_cells); - unsigned int id = 0; - for (unsigned int x=0; x<n_cells; ++x) + size_type id = 0; + for (size_type x=0; x<n_cells; ++x) if (material_id[x] != numbers::invalid_material_id) { cells[id].vertices[0] = x; @@ -1191,14 +1193,14 @@ GridGenerator::subdivided_hyper_rectangle ( Assert(spacing.size() == 2, ExcInvalidRepetitionsDimension(2)); - std::vector<unsigned int> repetitions(2); - unsigned int n_cells = 1; + std::vector<size_type> repetitions(2); + size_type n_cells = 1; double delta = std::numeric_limits<double>::max(); for (unsigned int i=0; i<2; i++) { repetitions[i] = spacing[i].size(); n_cells *= repetitions[i]; - for (unsigned int j=0; j<repetitions[i]; j++) + for (size_type j=0; j<repetitions[i]; j++) { Assert (spacing[i][j] >= 0, ExcInvalidRepetitions(-1)); delta = std::min (delta, spacing[i][j]); @@ -1210,10 +1212,10 @@ GridGenerator::subdivided_hyper_rectangle ( // generate the necessary points std::vector<Point<2> > points; double ay = p[1]; - for (unsigned int y=0; y<=repetitions[1]; ++y) + for (size_type y=0; y<=repetitions[1]; ++y) { double ax = p[0]; - for (unsigned int x=0; x<=repetitions[0]; ++x) + for (size_type x=0; x<=repetitions[0]; ++x) { points.push_back (Point<2> (ax,ay)); if (x<repetitions[0]) @@ -1224,16 +1226,16 @@ GridGenerator::subdivided_hyper_rectangle ( } // create the cells - unsigned int n_val_cells = 0; - for (unsigned int i=0; i<material_id.size(0); i++) - for (unsigned int j=0; j<material_id.size(1); j++) + size_type n_val_cells = 0; + for (size_type i=0; i<material_id.size(0); i++) + for (size_type j=0; j<material_id.size(1); j++) if (material_id[i][j] != numbers::invalid_material_id) n_val_cells++; std::vector<CellData<2> > cells(n_val_cells); - unsigned int id = 0; - for (unsigned int y=0; y<repetitions[1]; ++y) - for (unsigned int x=0; x<repetitions[0]; ++x) + size_type id = 0; + for (size_type y=0; y<repetitions[1]; ++y) + for (size_type x=0; x<repetitions[0]; ++x) if (material_id[x][y]!=numbers::invalid_material_id) { cells[id].vertices[0] = y*(repetitions[0]+1)+x; @@ -1291,14 +1293,14 @@ GridGenerator::subdivided_hyper_rectangle ( Assert(spacing.size() == dim, ExcInvalidRepetitionsDimension(dim)); - std::vector<unsigned int> repetitions(dim); - unsigned int n_cells = 1; + std::vector<size_type > repetitions(dim); + size_type n_cells = 1; double delta = std::numeric_limits<double>::max(); for (unsigned int i=0; i<dim; i++) { repetitions[i] = spacing[i].size(); n_cells *= repetitions[i]; - for (unsigned int j=0; j<repetitions[i]; j++) + for (size_type j=0; j<repetitions[i]; j++) { Assert (spacing[i][j] >= 0, ExcInvalidRepetitions(-1)); delta = std::min (delta, spacing[i][j]); @@ -1310,13 +1312,13 @@ GridGenerator::subdivided_hyper_rectangle ( // generate the necessary points std::vector<Point<dim> > points; double az = p[2]; - for (unsigned int z=0; z<=repetitions[2]; ++z) + for (size_type z=0; z<=repetitions[2]; ++z) { double ay = p[1]; - for (unsigned int y=0; y<=repetitions[1]; ++y) + for (size_type y=0; y<=repetitions[1]; ++y) { double ax = p[0]; - for (unsigned int x=0; x<=repetitions[0]; ++x) + for (size_type x=0; x<=repetitions[0]; ++x) { points.push_back (Point<dim> (ax,ay,az)); if (x<repetitions[0]) @@ -1330,20 +1332,20 @@ GridGenerator::subdivided_hyper_rectangle ( } // create the cells - unsigned int n_val_cells = 0; - for (unsigned int i=0; i<material_id.size(0); i++) - for (unsigned int j=0; j<material_id.size(1); j++) - for (unsigned int k=0; k<material_id.size(2); k++) + size_type n_val_cells = 0; + for (size_type i=0; i<material_id.size(0); i++) + for (size_type j=0; j<material_id.size(1); j++) + for (size_type k=0; k<material_id.size(2); k++) if (material_id[i][j][k]!=numbers::invalid_material_id) n_val_cells++; std::vector<CellData<dim> > 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<repetitions[2]; ++z) - for (unsigned int y=0; y<repetitions[1]; ++y) - for (unsigned int x=0; x<repetitions[0]; ++x) + 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; z<repetitions[2]; ++z) + for (size_type y=0; y<repetitions[1]; ++y) + for (size_type x=0; x<repetitions[0]; ++x) if (material_id[x][y][z]!=numbers::invalid_material_id) { cells[id].vertices[0] = z*n_xy + y*n_x + x; @@ -1532,7 +1534,7 @@ void GridGenerator::hyper_shell (Triangulation<1> &, const Point<1> &, const double, const double, - const unsigned int, + const size_type , const bool) { Assert (false, ExcNotImplemented()); @@ -1554,8 +1556,8 @@ void GridGenerator::cylinder_shell (Triangulation<1> &, const double, const double, const double, - const unsigned int, - const unsigned int) + const size_type , + const size_type ) { Assert (false, ExcNotImplemented()); } @@ -1577,7 +1579,7 @@ GridGenerator::half_hyper_shell (Triangulation<1> &, const Point<1> &, const double, const double, - const unsigned int, + const size_type , const bool) { Assert (false, ExcNotImplemented()); @@ -1588,7 +1590,7 @@ void GridGenerator::quarter_hyper_shell (Triangulation<1> &, const Point<1> &, const double, const double, - const unsigned int, + const size_type , const bool) { Assert (false, ExcNotImplemented()); @@ -1834,11 +1836,11 @@ GridGenerator::colorize_hyper_shell ( template <> -void GridGenerator::hyper_shell (Triangulation<2> &tria, - const Point<2> &center, - const double inner_radius, - const double outer_radius, - const unsigned int n_cells, +void GridGenerator::hyper_shell (Triangulation<2> &tria, + const Point<2> &center, + const double inner_radius, + const double outer_radius, + const size_type n_cells, const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), @@ -1855,11 +1857,11 @@ void GridGenerator::hyper_shell (Triangulation<2> &tria, // radial extent (which is the // difference between the two // radii) - const unsigned int N = (n_cells == 0 ? - static_cast<unsigned int> - (std::ceil((2*pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : - n_cells); + const size_type N = (n_cells == 0 ? + static_cast<size_type> + (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 @@ -1868,7 +1870,7 @@ void GridGenerator::hyper_shell (Triangulation<2> &tria, // outer one, and all are // numbered counter-clockwise std::vector<Point<2> > vertices(2*N); - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { vertices[i] = Point<2>( std::cos(2*pi * i/N), std::sin(2*pi * i/N)) * outer_radius; @@ -1880,7 +1882,7 @@ void GridGenerator::hyper_shell (Triangulation<2> &tria, std::vector<CellData<2> > cells (N, CellData<2>()); - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { cells[i].vertices[0] = i; cells[i].vertices[1] = (i+1)%N; @@ -1938,8 +1940,8 @@ void GridGenerator::cylinder_shell (Triangulation<2> &, const double, const double, const double, - const unsigned int, - const unsigned int) + const size_type, + const size_type) { Assert (false, ExcNotImplemented()); } @@ -2009,11 +2011,11 @@ GridGenerator::half_hyper_ball (Triangulation<2> &tria, // Implementation for 2D only template <> void -GridGenerator::half_hyper_shell (Triangulation<2> &tria, - const Point<2> &center, - const double inner_radius, - const double outer_radius, - const unsigned int n_cells, +GridGenerator::half_hyper_shell (Triangulation<2> &tria, + const Point<2> &center, + const double inner_radius, + const double outer_radius, + const size_type n_cells, const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), @@ -2029,11 +2031,11 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, // radial extent (which is the // difference between the two // radii) - const unsigned int N = (n_cells == 0 ? - static_cast<unsigned int> - (std::ceil((pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : - n_cells); + const size_type N = (n_cells == 0 ? + static_cast<size_type> + (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 @@ -2042,7 +2044,7 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, // outer one, and all are // numbered counter-clockwise std::vector<Point<2> > vertices(2*(N+1)); - for (unsigned int i=0; i<=N; ++i) + for (size_type i=0; i<=N; ++i) { // enforce that the x-coordinates // of the first and last point of @@ -2063,7 +2065,7 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, std::vector<CellData<2> > cells (N, CellData<2>()); - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { cells[i].vertices[0] = i; cells[i].vertices[1] = (i+1)%(N+1); @@ -2090,11 +2092,11 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, template <> -void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria, - const Point<2> &center, - const double inner_radius, - const double outer_radius, - const unsigned int n_cells, +void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria, + const Point<2> &center, + const double inner_radius, + const double outer_radius, + const size_type n_cells, const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), @@ -2110,11 +2112,11 @@ void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria, // radial extent (which is the // difference between the two // radii) - const unsigned int N = (n_cells == 0 ? - static_cast<unsigned int> - (std::ceil((pi* (outer_radius + inner_radius)/4) / - (outer_radius - inner_radius))) : - n_cells); + const size_type N = (n_cells == 0 ? + static_cast<size_type> + (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 @@ -2123,7 +2125,7 @@ void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria, // outer one, and all are // numbered counter-clockwise std::vector<Point<2> > vertices(2*(N+1)); - for (unsigned int i=0; i<=N; ++i) + for (size_type i=0; i<=N; ++i) { // enforce that the x-coordinates // of the last point is exactly @@ -2143,7 +2145,7 @@ void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria, std::vector<CellData<2> > cells (N, CellData<2>()); - for (unsigned int i=0; i<N; ++i) + for (size_type i=0; i<N; ++i) { cells[i].vertices[0] = i; cells[i].vertices[1] = (i+1)%(N+1); @@ -2302,12 +2304,12 @@ void GridGenerator::truncated_cone (Triangulation<3> &triangulation, const double half_length) { // Determine number of cells and vertices - const unsigned int - n_cells = static_cast<unsigned int>(std::floor (half_length / - std::max (radius_0, - radius_1) + - 0.5)); - const unsigned int n_vertices = 4 * (n_cells + 1); + const size_type + n_cells = static_cast<size_type>(std::floor (half_length / + std::max (radius_0, + radius_1) + + 0.5)); + const size_type n_vertices = 4 * (n_cells + 1); std::vector<Point<3> > vertices_tmp(n_vertices); vertices_tmp[0] = Point<3> (-half_length, 0, -radius_0); @@ -2317,7 +2319,7 @@ void GridGenerator::truncated_cone (Triangulation<3> &triangulation, const double dx = 2 * half_length / n_cells; - for (unsigned int i = 0; i < n_cells; ++i) + for (size_type i = 0; i < n_cells; ++i) { vertices_tmp[4 * (i + 1)] = vertices_tmp[4 * i] + @@ -2337,13 +2339,13 @@ void GridGenerator::truncated_cone (Triangulation<3> &triangulation, vertices_tmp.end()); Table<2,unsigned int> cell_vertices(n_cells,GeometryInfo<3>::vertices_per_cell); - for (unsigned int i = 0; i < n_cells; ++i) + 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; std::vector<CellData<3> > cells (n_cells, CellData<3> ()); - for (unsigned int i = 0; i < n_cells; ++i) + 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]; @@ -2589,7 +2591,7 @@ GridGenerator::cylinder (Triangulation<3> &tria, // respectively. note that we also // have to deal with those lines // that are purely in the interior - // of the ends. we determine wether + // of the ends. we determine whether // an edge is purely in the // interior if one of its vertices // is at coordinates '+-a' as set @@ -2712,17 +2714,18 @@ GridGenerator::half_hyper_ball (Triangulation<3> &tria, { cell->face(i)->set_boundary_indicator(1); for (unsigned int j=0; j<GeometryInfo<3>::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); - } + { + 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; @@ -2810,7 +2813,7 @@ GridGenerator::hyper_shell (Triangulation<3> &tria, const Point<3> &p, const double inner_radius, const double outer_radius, - const unsigned int n, + const size_type n, const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), @@ -3039,7 +3042,7 @@ GridGenerator::half_hyper_shell (Triangulation<3> &tria, const Point<3> &center, const double inner_radius, const double outer_radius, - const unsigned int n, + const size_type n, const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), @@ -3185,7 +3188,7 @@ void GridGenerator::quarter_hyper_shell (Triangulation<3> &tria, const Point<3> &center, const double inner_radius, const double outer_radius, - const unsigned int n, + const size_type n, const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), @@ -3245,12 +3248,12 @@ void GridGenerator::quarter_hyper_shell (Triangulation<3> &tria, // Implementation for 3D only template <> -void GridGenerator::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) +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 ()); @@ -3266,16 +3269,16 @@ void GridGenerator::cylinder_shell (Triangulation<3> &tria, // radial extent (which is the // difference between the two // radii) - const unsigned int N_r = (n_radial_cells == 0 ? - static_cast<unsigned int> - (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<unsigned int> - (std::ceil (length / - (2*pi*(outer_radius + inner_radius)/2/N_r))) : - n_axial_cells); + const size_type N_r = (n_radial_cells == 0 ? + static_cast<size_type> + (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<size_type> + (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 @@ -3284,7 +3287,7 @@ void GridGenerator::cylinder_shell (Triangulation<3> &tria, // outer one, and all are // numbered counter-clockwise std::vector<Point<2> > vertices_2d(2*N_r); - for (unsigned int i=0; i<N_r; ++i) + for (size_type i=0; i<N_r; ++i) { vertices_2d[i] = Point<2>( std::cos(2*pi * i/N_r), std::sin(2*pi * i/N_r)) * outer_radius; @@ -3293,8 +3296,8 @@ void GridGenerator::cylinder_shell (Triangulation<3> &tria, std::vector<Point<3> > 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 (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], @@ -3304,8 +3307,8 @@ void GridGenerator::cylinder_shell (Triangulation<3> &tria, std::vector<CellData<3> > cells (N_r*N_z, CellData<3>()); - for (unsigned int j=0; j<N_z; ++j) - for (unsigned int i=0; i<N_r; ++i) + for (size_type j=0; j<N_z; ++j) + for (size_type i=0; i<N_r; ++i) { cells[i+j*N_r].vertices[0] = i + (j+1)*2*N_r; cells[i+j*N_r].vertices[1] = (i+1)%N_r + (j+1)*2*N_r; @@ -3381,7 +3384,7 @@ merge_triangulations (const Triangulation<dim, spacedim> &triangulation_1, void GridGenerator:: extrude_triangulation(const Triangulation<2, 2> &input, - const unsigned int n_slices, + const size_type n_slices, const double height, Triangulation<3,3> &result) { @@ -3395,9 +3398,9 @@ extrude_triangulation(const Triangulation<2, 2> &input, std::vector<CellData<3> > cells; cells.reserve((n_slices-1)*input.n_active_cells()); - for (unsigned int slice=0; slice<n_slices; ++slice) + for (size_type slice=0; slice<n_slices; ++slice) { - for (unsigned int i=0; i<input.n_vertices(); ++i) + for (size_type i=0; i<input.n_vertices(); ++i) { const Point<2> &v = input.get_vertices()[i]; @@ -3410,7 +3413,7 @@ extrude_triangulation(const Triangulation<2, 2> &input, for (Triangulation<2,2>::cell_iterator cell = input.begin(); cell != input.end(); ++cell) { - for (unsigned int slice=0; slice<n_slices-1; ++slice) + for (size_type slice=0; slice<n_slices-1; ++slice) { CellData<3> this_cell; for (unsigned int v=0; v<GeometryInfo<2>::vertices_per_cell; ++v) @@ -3438,7 +3441,7 @@ extrude_triangulation(const Triangulation<2, 2> &input, { quad.boundary_id = cell->face(f)->boundary_indicator(); bid = std::max(bid, quad.boundary_id); - for (unsigned int slice=0; slice<n_slices-1; ++slice) + for (size_type slice=0; slice<n_slices-1; ++slice) { quad.vertices[0] = cell->face(f)->vertex_index(0)+slice*input.n_vertices(); quad.vertices[1] = cell->face(f)->vertex_index(1)+slice*input.n_vertices(); @@ -3482,10 +3485,10 @@ extrude_triangulation(const Triangulation<2, 2> &input, // this is not necessary here as this is an internal only function. inline void GridGenerator::laplace_solve (const SparseMatrix<double> &S, - const std::map<unsigned int,double> &m, + const std::map<size_type,double> &m, Vector<double> &u) { - const unsigned int n_dofs=S.n(); + const size_type n_dofs=S.n(); FilteredMatrix<Vector<double> > SF (S); PreconditionJacobi<SparseMatrix<double> > prec; prec.initialize(S, 1.2); @@ -3506,7 +3509,7 @@ void GridGenerator::laplace_solve (const SparseMatrix<double> &S, // Implementation for 1D only template <> void GridGenerator::laplace_transformation (Triangulation<1> &, - const std::map<unsigned int,Point<1> > &) + const std::map<size_type,Point<1> > &) { Assert(false, ExcNotImplemented()); } @@ -3515,7 +3518,7 @@ void GridGenerator::laplace_transformation (Triangulation<1> &, // Implementation for dimensions except 1 template <int dim> void GridGenerator::laplace_transformation (Triangulation<dim> &tria, - const std::map<unsigned int,Point<dim> > &new_points) + const std::map<size_type,Point<dim> > &new_points) { // first provide everything that is // needed for solving a Laplace @@ -3543,9 +3546,9 @@ void GridGenerator::laplace_transformation (Triangulation<dim> &tria, // set up the boundary values for // the laplace problem - std::vector<std::map<unsigned int,double> > m(dim); - typename std::map<unsigned int,Point<dim> >::const_iterator map_iter; - typename std::map<unsigned int,Point<dim> >::const_iterator map_end=new_points.end(); + std::vector<std::map<size_type,double> > m(dim); + typename std::map<size_type,Point<dim> >::const_iterator map_iter; + typename std::map<size_type,Point<dim> >::const_iterator map_end=new_points.end(); // fill these maps using the data // given by new_points @@ -3562,12 +3565,12 @@ void GridGenerator::laplace_transformation (Triangulation<dim> &tria, for (unsigned int vertex_no=0; vertex_no<GeometryInfo<dim>::vertices_per_face; ++vertex_no) { - const unsigned int vertex_index=face->vertex_index(vertex_no); + 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<dim; ++i) - m[i].insert(std::pair<unsigned int,double> ( + m[i].insert(std::pair<size_type,double> ( face->vertex_dof_index(vertex_no, 0), map_iter->second(i))); } } @@ -3590,11 +3593,11 @@ void GridGenerator::laplace_transformation (Triangulation<dim> &tria, // points of the triangulation // according to the computed values for (cell=dof_handler.begin_active(); cell!=endc; ++cell) - for (unsigned int vertex_no=0; + for (size_type vertex_no=0; vertex_no<GeometryInfo<dim>::vertices_per_cell; ++vertex_no) { Point<dim> &v=cell->vertex(vertex_no); - const unsigned int dof_index=cell->vertex_dof_index(vertex_no, 0); + const size_type dof_index=cell->vertex_dof_index(vertex_no, 0); for (unsigned int i=0; i<dim; ++i) v(i)=us[i](dof_index); } @@ -3607,7 +3610,7 @@ void GridGenerator::hyper_cube_with_cylindrical_hole (Triangulation<1> &, const double, const double, const double, - const unsigned int, + const size_type, bool) { Assert(false, ExcNotImplemented()); @@ -3621,7 +3624,7 @@ GridGenerator::hyper_cube_with_cylindrical_hole (Triangulation<2> &triangulation const double inner_radius, const double outer_radius, const double, // width, - const unsigned int, // width_repetition, + const size_type, // width_repetition, bool colorize) { const int dim = 2; @@ -3645,7 +3648,7 @@ GridGenerator::hyper_cube_with_cylindrical_hole (Triangulation<2> &triangulation { for (unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v) { - unsigned int vv = cell->face(f)->vertex_index(v); + size_type vv = cell->face(f)->vertex_index(v); if (treated_vertices[vv] == false) { treated_vertices[vv] = true; @@ -3708,7 +3711,7 @@ void GridGenerator::hyper_cube_with_cylindrical_hole(Triangulation<3> &triangula const double inner_radius, const double outer_radius, const double L, - const unsigned int Nz, + const size_type Nz, bool colorize) { const int dim = 3; @@ -3735,11 +3738,11 @@ void GridGenerator::hyper_cube_with_cylindrical_hole(Triangulation<3> &triangula { for (unsigned int v=0; v < GeometryInfo<dim>::vertices_per_face; ++v) { - unsigned int vv = cell->face(f)->vertex_index(v); + size_type vv = cell->face(f)->vertex_index(v); if (treated_vertices[vv] == false) { treated_vertices[vv] = true; - for (unsigned int i=0; i<=Nz; ++i) + for (size_type i=0; i<=Nz; ++i) { double d = ((double) i)*L/((double) Nz); switch (vv-i*16) diff --git a/deal.II/source/grid/grid_generator.inst.in b/deal.II/source/grid/grid_generator.inst.in index 5444c06e09..fadcea0bc7 100644 --- a/deal.II/source/grid/grid_generator.inst.in +++ b/deal.II/source/grid/grid_generator.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; deal_II_space_dimension : SPACE_DIMENSIONS) { @@ -73,14 +77,14 @@ for (deal_II_dimension : DIMENSIONS) template void GridGenerator::subdivided_parallelepiped<deal_II_dimension> ( Triangulation<deal_II_dimension>&, - const unsigned int, + const size_type, const Point<deal_II_dimension> (&) [deal_II_dimension], const bool); template void GridGenerator::subdivided_parallelepiped<deal_II_dimension> ( Triangulation<deal_II_dimension>&, - const unsigned int [deal_II_dimension], + const size_type [deal_II_dimension], const Point<deal_II_dimension> (&) [deal_II_dimension], const bool); @@ -88,7 +92,7 @@ for (deal_II_dimension : DIMENSIONS) template void GridGenerator:: laplace_transformation<deal_II_dimension> (Triangulation<deal_II_dimension> &, - const std::map<unsigned int,Point<deal_II_dimension> > &); + const std::map<types::global_dof_index,Point<deal_II_dimension> > &); #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 <deal.II/base/path_search.h> #include <deal.II/base/utilities.h> 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 837063c9ef..839f3ff04b 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 <deal.II/grid/grid_out.h> #include <deal.II/base/parameter_handler.h> @@ -1363,7 +1365,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 +1439,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,9 +1460,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; - subdomains[cell->subdomain_id()+2] = 1; + if (cell->active()) + subdomains[cell->subdomain_id()+2] = 1; level_subdomains[cell->level_subdomain_id()+2] = 1; } @@ -1486,14 +1489,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: @@ -1502,7 +1505,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; @@ -1656,7 +1660,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<unsigned int>(.5 + (height/100.) * 2.75) * 9. * (min_level_min_vertex_distance / std::min(x_dimension, y_dimension)); + cell_label_font_size = static_cast<unsigned int>((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 @@ -1767,9 +1771,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; } @@ -1846,11 +1850,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; } @@ -1958,19 +1965,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<int>(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<int>(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<int>(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<int>(cell->level_subdomain_id()); + } out << "</text>" << '\n'; } @@ -2091,21 +2104,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 << "</text>" << '\n'; } - if(svg_flags.label_level_subdomain_id) - { - out << " <text x= \"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.) - << "\" y=\"" << static_cast<unsigned int>(.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" - << "</text>" << '\n'; - } + if (svg_flags.label_level_subdomain_id) + { + out << " <text x= \"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.) + << "\" y=\"" << static_cast<unsigned int>(.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" + << "</text>" << '\n'; + } } // show azimuth angle and polar angle as text below the explanation of the cell labeling @@ -2138,8 +2151,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; } @@ -2164,8 +2178,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; } @@ -2285,11 +2300,11 @@ void GridOut::write_mathgl (const Triangulation<dim> &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 ()); 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 <deal.II/base/template_constraints.h> #include <deal.II/lac/vector.h> 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 <deal.II/grid/grid_reordering.h> #include <deal.II/grid/grid_reordering_internal.h> diff --git a/deal.II/source/grid/grid_tools.cc b/deal.II/source/grid/grid_tools.cc index 7ee013a043..ed2325f2b1 100644 --- a/deal.II/source/grid/grid_tools.cc +++ b/deal.II/source/grid/grid_tools.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $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 <deal.II/base/std_cxx1x/array.h> #include <deal.II/base/quadrature_lib.h> @@ -605,7 +607,7 @@ namespace GridTools template <int dim> void - laplace_transform (const std::map<unsigned int,Point<dim> > &new_points, + laplace_transform (const std::map<types::global_dof_index,Point<dim> > &new_points, Triangulation<dim> &triangulation) { //TODO: Move implementation of this function into the current @@ -1245,7 +1247,6 @@ next_cell: // finally loop over all cells and set the // subdomain ids - std::vector<unsigned int> dof_indices(1); unsigned int index = 0; for (typename Triangulation<dim,spacedim>::active_cell_iterator cell = triangulation.begin_active(); diff --git a/deal.II/source/grid/grid_tools.inst.in b/deal.II/source/grid/grid_tools.inst.in index 22aed5c106..9087a8e74f 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) @@ -157,7 +161,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS #if deal_II_dimension == deal_II_space_dimension template void - laplace_transform (const std::map<unsigned int,Point<deal_II_dimension> > &new_points, + laplace_transform (const std::map<types::global_dof_index,Point<deal_II_dimension> > &new_points, Triangulation<deal_II_dimension> &triangulation); template 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/smartpointer.h> 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 <deal.II/base/memory_consumption.h> #include <deal.II/grid/persistent_tria.h> diff --git a/deal.II/source/grid/tria.cc b/deal.II/source/grid/tria.cc index 99ff9be217..a29e247a5e 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/table.h> @@ -157,7 +161,7 @@ namespace - // return, wheter a given @p cell will be + // return, whether a given @p cell will be // coarsened, which is the case if all // children are active and have their coarsen // flag set. In case only part of the coarsen @@ -2071,7 +2075,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 @@ -2596,7 +2600,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()) @@ -2656,7 +2660,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); @@ -4259,6 +4263,7 @@ namespace internal new_lines[5]->index())); } + types::subdomain_id subdomainid = cell->subdomain_id(); for (unsigned int i=0; i<n_children; ++i) { @@ -4271,7 +4276,7 @@ namespace internal // properties subcells[i]->set_material_id (cell->material_id()); subcells[i]->set_manifold_id (cell->manifold_id()); - subcells[i]->set_subdomain_id (cell->subdomain_id()); + subcells[i]->set_subdomain_id (subdomainid); if (i%2==0) subcells[i]->set_parent (cell->index ()); @@ -4467,6 +4472,8 @@ namespace internal second_child->set_used_flag (); second_child->clear_user_data (); + types::subdomain_id subdomainid = cell->subdomain_id(); + // insert first child cell->set_children (0, first_child->index()); first_child->clear_children (); @@ -4475,7 +4482,7 @@ namespace internal next_unused_vertex)); first_child->set_material_id (cell->material_id()); first_child->set_manifold_id (cell->manifold_id()); - first_child->set_subdomain_id (cell->subdomain_id()); + first_child->set_subdomain_id (subdomainid); first_child->set_direction_flag (cell->direction_flag()); first_child->set_parent (cell->index ()); @@ -4543,7 +4550,7 @@ namespace internal second_child->set_neighbor (0, first_child); second_child->set_material_id (cell->material_id()); second_child->set_manifold_id (cell->manifold_id()); - second_child->set_subdomain_id (cell->subdomain_id()); + second_child->set_subdomain_id (subdomainid); second_child->set_direction_flag (cell->direction_flag()); if (cell->neighbor(1).state() != IteratorState::valid) @@ -6489,6 +6496,8 @@ namespace internal new_quads[i]->set_line_orientation(j,true); } + types::subdomain_id subdomainid = hex->subdomain_id(); + // find some space for the newly to // be created hexes and initialize // them. @@ -6513,7 +6522,7 @@ namespace internal // properties new_hexes[i]->set_material_id (hex->material_id()); new_hexes[i]->set_manifold_id (hex->manifold_id()); - new_hexes[i]->set_subdomain_id (hex->subdomain_id()); + new_hexes[i]->set_subdomain_id (subdomainid); if (i%2) new_hexes[i]->set_parent (hex->index ()); @@ -9398,7 +9407,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 @@ -9455,7 +9464,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 @@ -9862,7 +9871,7 @@ create_triangulation (const std::vector<Point<spacedim> > &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 @@ -11113,18 +11122,11 @@ template <int dim, int spacedim> typename Triangulation<dim,spacedim>::cell_iterator Triangulation<dim,spacedim>::last () const { - return last (levels.size()-1); -} - + const unsigned int level = levels.size()-1; - -template <int dim, int spacedim> -typename Triangulation<dim,spacedim>::cell_iterator -Triangulation<dim,spacedim>::last (const unsigned int level) const -{ - Assert (level<levels.size(), ExcInvalidLevel(level)); - Assert (levels[level]->cells.cells.size() != 0, - ExcEmptyLevel (level)); + Assert (level<n_global_levels() || level<levels.size(), ExcInvalidLevel(level)); + if (levels[level]->cells.cells.size() ==0) + return end(level); // find the last raw iterator on // this level @@ -11150,30 +11152,15 @@ Triangulation<dim,spacedim>::last_active () const // get the last used cell cell_iterator cell = last(); - // 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 <int dim, int spacedim> -typename Triangulation<dim,spacedim>::active_cell_iterator -Triangulation<dim,spacedim>::last_active (const unsigned int level) const -{ - // get the last used cell on this level - cell_iterator cell = last(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; + if (cell != end()) + { + // 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; } @@ -11194,9 +11181,11 @@ template <int dim, int spacedim> typename Triangulation<dim, spacedim>::raw_cell_iterator Triangulation<dim, spacedim>::end_raw (const unsigned int level) const { - return (level == levels.size()-1 ? - end() : - begin_raw (level+1)); + Assert (level<n_global_levels(), ExcInvalidLevel(level)); + if (level < levels.size()-1) + return begin_raw (level+1); + else + return end(); } @@ -11204,9 +11193,10 @@ template <int dim, int spacedim> typename Triangulation<dim, spacedim>::cell_iterator Triangulation<dim, spacedim>::end (const unsigned int level) const { - return (level == levels.size()-1 ? - cell_iterator(end()) : - begin (level+1)); + if (level < levels.size()-1) + return begin (level+1); + Assert (level<n_global_levels() || level<levels.size(), ExcInvalidLevel(level)); + return end(); } @@ -11298,10 +11288,10 @@ Triangulation<dim, spacedim>::begin_raw_line (const unsigned int level) const switch (dim) { case 1: - Assert (level<levels.size(), ExcInvalidLevel(level)); + Assert (level<n_global_levels() || level<levels.size(), ExcInvalidLevel(level)); - if (levels[level]->cells.cells.size() == 0) - return end_line (); + if (level >= levels.size() || levels[level]->cells.cells.size() == 0) + return end_line(); return raw_line_iterator (const_cast<Triangulation<dim,spacedim>*>(this), level, @@ -11373,9 +11363,9 @@ Triangulation<dim,spacedim>::begin_raw_quad (const unsigned int level) const return raw_hex_iterator(); case 2: { - Assert (level<levels.size(), ExcInvalidLevel(level)); + Assert (level<n_global_levels() || level<levels.size(), ExcInvalidLevel(level)); - if (levels[level]->cells.cells.size() == 0) + if (level >= levels.size() || levels[level]->cells.cells.size() == 0) return end_quad(); return raw_quad_iterator (const_cast<Triangulation<dim,spacedim>*>(this), @@ -11458,9 +11448,9 @@ Triangulation<dim,spacedim>::begin_raw_hex (const unsigned int level) const return raw_hex_iterator(); case 3: { - Assert (level<levels.size(), ExcInvalidLevel(level)); + Assert (level<n_global_levels() || level<levels.size(), ExcInvalidLevel(level)); - if (levels[level]->cells.cells.size() == 0) + if (level >= levels.size() || levels[level]->cells.cells.size() == 0) return end_hex(); return raw_hex_iterator (const_cast<Triangulation<dim,spacedim>*>(this), @@ -12339,11 +12329,12 @@ void Triangulation<dim, spacedim>::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<int>(levels.size()-2) && cell->user_flag_set()) // use a separate function, // since this is dimension // specific @@ -13726,7 +13717,7 @@ bool Triangulation<dim,spacedim>::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 1be216faeb..66e61c2864 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, 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; 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 f912650032..0a94641d9c 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, 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 <deal.II/grid/tria.h> #include <deal.II/grid/tria_levels.h> @@ -1355,6 +1357,7 @@ template <int dim, int spacedim> types::subdomain_id CellAccessor<dim, spacedim>::subdomain_id () const { Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert (this->active(), ExcMessage("subdomains only work on active cells!")); return this->tria->levels[this->present_level]->subdomain_ids[this->present_index]; } @@ -1365,6 +1368,7 @@ void CellAccessor<dim, spacedim>::set_subdomain_id (const types::subdomain_id new_subdomain_id) const { Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed()); + Assert (this->active(), ExcMessage("subdomains only work on active cells!")); this->tria->levels[this->present_level]->subdomain_ids[this->present_index] = new_subdomain_id; } @@ -1435,11 +1439,11 @@ void CellAccessor<dim, spacedim>:: recursively_set_subdomain_id (const types::subdomain_id new_subdomain_id) const { - set_subdomain_id (new_subdomain_id); - if (this->has_children()) for (unsigned int c=0; c<this->n_children(); ++c) this->child(c)->recursively_set_subdomain_id (new_subdomain_id); + else + set_subdomain_id (new_subdomain_id); } 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..f956c1d16c 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 <deal.II/base/tensor.h> #include <deal.II/grid/tria_boundary.h> diff --git a/deal.II/source/grid/tria_boundary.inst.in b/deal.II/source/grid/tria_boundary.inst.in index 7d3392dd1d..3e44346c13 100644 --- a/deal.II/source/grid/tria_boundary.inst.in +++ b/deal.II/source/grid/tria_boundary.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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/grid/tria_boundary_lib.cc b/deal.II/source/grid/tria_boundary_lib.cc index d756a32a83..df1f4e9911 100644 --- a/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/source/grid/tria_boundary_lib.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- #include <deal.II/grid/tria_boundary_lib.h> #include <deal.II/grid/tria.h> @@ -841,10 +843,10 @@ get_new_point_on_line (const typename Triangulation<dim>::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<dim>::get_new_point_on_line (line); diff --git a/deal.II/source/grid/tria_boundary_lib.inst.in b/deal.II/source/grid/tria_boundary_lib.inst.in index e175f58d33..24af1048b7 100644 --- a/deal.II/source/grid/tria_boundary_lib.inst.in +++ b/deal.II/source/grid/tria_boundary_lib.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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 (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/grid/tria_faces.cc b/deal.II/source/grid/tria_faces.cc index 3c613a9927..b9b57a2551 100644 --- a/deal.II/source/grid/tria_faces.cc +++ b/deal.II/source/grid/tria_faces.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $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 <deal.II/base/memory_consumption.h> #include <deal.II/grid/tria_faces.h> 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 <deal.II/base/memory_consumption.h> #include <deal.II/grid/tria_levels.h> diff --git a/deal.II/source/grid/tria_objects.cc b/deal.II/source/grid/tria_objects.cc index b8e092d5c5..800d61de65 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, 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 <deal.II/base/memory_consumption.h> #include <deal.II/grid/tria_objects.h> 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..140accecb5 100644 --- a/deal.II/source/hp/CMakeLists.txt +++ b/deal.II/source/hp/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/deal.II/source/hp/dof_faces.cc b/deal.II/source/hp/dof_faces.cc index 54f743349c..280ab65a9a 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 <deal.II/base/memory_consumption.h> #include <deal.II/hp/dof_faces.h> diff --git a/deal.II/source/hp/dof_handler.cc b/deal.II/source/hp/dof_handler.cc index 4dbeb003b9..0b4b865540 100644 --- a/deal.II/source/hp/dof_handler.cc +++ b/deal.II/source/hp/dof_handler.cc @@ -1,16 +1,18 @@ -//---------------------------- hp_dof_handler.cc ------------------------ -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 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. // -//---------------------------- 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 <deal.II/base/memory_consumption.h> #include <deal.II/base/geometry_info.h> @@ -263,7 +265,7 @@ namespace internal // already fill the // vertex_dofs_offsets field dof_handler.vertex_dofs_offsets.resize (dof_handler.tria->n_vertices(), - numbers::invalid_unsigned_int); + numbers::invalid_dof_index); unsigned int vertex_slots_needed = 0; for (unsigned int v=0; v<dof_handler.tria->n_vertices(); ++v) @@ -286,7 +288,7 @@ namespace internal for (unsigned int v=0; v<dof_handler.tria->n_vertices(); ++v) if (dof_handler.tria->vertex_used(v) == true) { - unsigned int pointer = dof_handler.vertex_dofs_offsets[v]; + types::global_dof_index pointer = dof_handler.vertex_dofs_offsets[v]; for (unsigned int fe=0; fe<dof_handler.finite_elements->size(); ++fe) if (vertex_fe_association[fe][v] == true) { @@ -301,7 +303,7 @@ namespace internal } // finally place the end // marker - dof_handler.vertex_dofs[pointer] = numbers::invalid_unsigned_int; + dof_handler.vertex_dofs[pointer] = numbers::invalid_dof_index; } } @@ -323,9 +325,9 @@ namespace internal */ template <int spacedim> static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const typename dealii::hp::DoFHandler<1,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { const unsigned int dim = 1; @@ -368,9 +370,9 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const typename dealii::hp::DoFHandler<2,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { const unsigned int dim = 2; @@ -431,9 +433,9 @@ namespace internal template <int spacedim> static - unsigned int + types::global_dof_index distribute_dofs_on_cell (const typename dealii::hp::DoFHandler<3,spacedim>::active_cell_iterator &cell, - unsigned int next_free_dof) + types::global_dof_index next_free_dof) { const unsigned int dim = 3; @@ -575,10 +577,11 @@ namespace internal for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level) { dof_handler.levels[level]->dof_object.dof_offsets - = std::vector<unsigned int> (dof_handler.tria->n_raw_lines(level), - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> ( + dof_handler.tria->n_raw_lines(level), + DoFHandler<dim,spacedim>::invalid_dof_index); - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; for (typename DoFHandler<dim,spacedim>::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -589,8 +592,8 @@ namespace internal } dof_handler.levels[level]->dof_object.dofs - = std::vector<unsigned int> (next_free_dof, - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (next_free_dof, + DoFHandler<dim,spacedim>::invalid_dof_index); } // safety check: make sure that @@ -603,7 +606,7 @@ namespace internal #ifdef DEBUG for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level) { - unsigned int counter = 0; + types::global_dof_index counter = 0; for (typename DoFHandler<dim,spacedim>::cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -691,10 +694,11 @@ namespace internal for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level) { dof_handler.levels[level]->dof_object.dof_offsets - = std::vector<unsigned int> (dof_handler.tria->n_raw_quads(level), - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> ( + dof_handler.tria->n_raw_quads(level), + DoFHandler<dim,spacedim>::invalid_dof_index); - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; for (typename DoFHandler<dim,spacedim>::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -705,8 +709,8 @@ namespace internal } dof_handler.levels[level]->dof_object.dofs - = std::vector<unsigned int> (next_free_dof, - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (next_free_dof, + DoFHandler<dim,spacedim>::invalid_dof_index); } // safety check: make sure that @@ -719,7 +723,7 @@ namespace internal #ifdef DEBUG for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level) { - unsigned int counter = 0; + types::global_dof_index counter = 0; for (typename DoFHandler<dim,spacedim>::cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -842,11 +846,11 @@ namespace internal // active ones will have a // non-invalid value later on dof_handler.faces->lines.dof_offsets - = std::vector<unsigned int> (dof_handler.tria->n_raw_lines(), - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (dof_handler.tria->n_raw_lines(), + DoFHandler<dim,spacedim>::invalid_dof_index); dof_handler.faces->lines.dofs - = std::vector<unsigned int> (n_line_slots, - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (n_line_slots, + DoFHandler<dim,spacedim>::invalid_dof_index); // with the memory now // allocated, loop over the @@ -1055,10 +1059,10 @@ namespace internal for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level) { dof_handler.levels[level]->dof_object.dof_offsets - = std::vector<unsigned int> (dof_handler.tria->n_raw_hexs(level), - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (dof_handler.tria->n_raw_hexs(level), + DoFHandler<dim,spacedim>::invalid_dof_index); - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; for (typename DoFHandler<dim,spacedim>::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -1069,8 +1073,8 @@ namespace internal } dof_handler.levels[level]->dof_object.dofs - = std::vector<unsigned int> (next_free_dof, - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (next_free_dof, + DoFHandler<dim,spacedim>::invalid_dof_index); } // safety check: make sure that @@ -1083,7 +1087,7 @@ namespace internal #ifdef DEBUG for (unsigned int level=0; level<dof_handler.tria->n_levels(); ++level) { - unsigned int counter = 0; + types::global_dof_index counter = 0; for (typename DoFHandler<dim,spacedim>::cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) @@ -1210,11 +1214,11 @@ namespace internal if (true) { dof_handler.faces->quads.dof_offsets - = std::vector<unsigned int> (dof_handler.tria->n_raw_quads(), - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (dof_handler.tria->n_raw_quads(), + DoFHandler<dim,spacedim>::invalid_dof_index); dof_handler.faces->quads.dofs - = std::vector<unsigned int> (n_quad_slots, - DoFHandler<dim,spacedim>::invalid_dof_index); + = std::vector<types::global_dof_index> (n_quad_slots, + DoFHandler<dim,spacedim>::invalid_dof_index); } // with the memory now @@ -1419,7 +1423,7 @@ namespace internal // line_dofs_offsets field dof_handler.faces->lines.dof_offsets .resize (dof_handler.tria->n_raw_lines(), - numbers::invalid_unsigned_int); + numbers::invalid_dof_index); unsigned int line_slots_needed = 0; for (unsigned int line=0; line<dof_handler.tria->n_raw_lines(); ++line) @@ -1457,7 +1461,7 @@ namespace internal } // finally place the end // marker - dof_handler.faces->lines.dofs[pointer] = numbers::invalid_unsigned_int; + dof_handler.faces->lines.dofs[pointer] = numbers::invalid_dof_index; } } @@ -1477,8 +1481,10 @@ namespace internal unsigned int max_couplings_between_dofs (const DoFHandler<1,spacedim> &dof_handler) { - return std::min(3*dof_handler.finite_elements->max_dofs_per_vertex() + - 2*dof_handler.finite_elements->max_dofs_per_line(), dof_handler.n_dofs()); + return std::min(static_cast<types::global_dof_index> (3* + dof_handler.finite_elements->max_dofs_per_vertex() + + 2*dof_handler.finite_elements->max_dofs_per_line()), + dof_handler.n_dofs()); } @@ -1509,7 +1515,7 @@ namespace internal // nodes) // count lines -> 28 (don't forget to count // mother and children separately!) - unsigned int max_couplings; + types::global_dof_index max_couplings; switch (dof_handler.tria->max_adjacent_cells()) { case 4: @@ -1562,7 +1568,7 @@ namespace internal // can anyone give better estimate here? const unsigned int max_adjacent_cells = dof_handler.tria->max_adjacent_cells(); - unsigned int max_couplings; + types::global_dof_index max_couplings; if (max_adjacent_cells <= 8) max_couplings=7*7*7*dof_handler.finite_elements->max_dofs_per_vertex() + 7*6*7*3*dof_handler.finite_elements->max_dofs_per_line() + @@ -1588,7 +1594,7 @@ namespace hp const unsigned int DoFHandler<dim,spacedim>::dimension; template<int dim, int spacedim> - const unsigned int DoFHandler<dim,spacedim>::invalid_dof_index; + const types::global_dof_index DoFHandler<dim,spacedim>::invalid_dof_index; template<int dim, int spacedim> const unsigned int DoFHandler<dim,spacedim>::default_fe_index; @@ -1703,12 +1709,12 @@ namespace hp template <> - unsigned int DoFHandler<1>::n_boundary_dofs () const + types::global_dof_index DoFHandler<1>::n_boundary_dofs () const { Assert (finite_elements != 0, ExcNoFESelected()); DoFHandler<1,1>::cell_iterator cell; - unsigned int n = 0; + types::global_dof_index n = 0; // search left-most cell cell = this->begin_active(); @@ -1728,7 +1734,7 @@ namespace hp template <> - unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const + types::global_dof_index DoFHandler<1>::n_boundary_dofs (const FunctionMap &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -1741,7 +1747,7 @@ namespace hp ExcInvalidBoundaryIndicator()); DoFHandler<1,1>::active_cell_iterator cell; - unsigned int n = 0; + types::global_dof_index n = 0; // search left-most cell if (boundary_indicators.find (0) != boundary_indicators.end()) @@ -1767,7 +1773,7 @@ namespace hp template <> - unsigned int DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const + types::global_dof_index DoFHandler<1>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -1780,7 +1786,7 @@ namespace hp ExcInvalidBoundaryIndicator()); DoFHandler<1,1>::active_cell_iterator cell; - unsigned int n = 0; + types::global_dof_index n = 0; // search left-most cell if (boundary_indicators.find (0) != boundary_indicators.end()) @@ -1805,21 +1811,21 @@ namespace hp template <> - unsigned int DoFHandler<1,2>::n_boundary_dofs () const + types::global_dof_index DoFHandler<1,2>::n_boundary_dofs () const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &) const + types::global_dof_index DoFHandler<1,2>::n_boundary_dofs (const FunctionMap &) const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,2>::n_boundary_dofs (const std::set<types::boundary_id> &) const + types::global_dof_index DoFHandler<1,2>::n_boundary_dofs (const std::set<types::boundary_id> &) const { Assert(false,ExcNotImplemented()); return 0; @@ -1828,21 +1834,21 @@ namespace hp template <> - unsigned int DoFHandler<1,3>::n_boundary_dofs () const + types::global_dof_index DoFHandler<1,3>::n_boundary_dofs () const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,3>::n_boundary_dofs (const FunctionMap &) const + types::global_dof_index DoFHandler<1,3>::n_boundary_dofs (const FunctionMap &) const { Assert(false,ExcNotImplemented()); return 0; } template <> - unsigned int DoFHandler<1,3>::n_boundary_dofs (const std::set<types::boundary_id> &) const + types::global_dof_index DoFHandler<1,3>::n_boundary_dofs (const std::set<types::boundary_id> &) const { Assert(false,ExcNotImplemented()); return 0; @@ -1850,12 +1856,12 @@ namespace hp template<int dim, int spacedim> - unsigned int DoFHandler<dim,spacedim>::n_boundary_dofs () const + types::global_dof_index DoFHandler<dim,spacedim>::n_boundary_dofs () const { Assert (finite_elements != 0, ExcNoFESelected()); - std::set<int> boundary_dofs; - std::vector<unsigned int> dofs_on_face; + std::set<types::global_dof_index> boundary_dofs; + std::vector<types::global_dof_index> dofs_on_face; dofs_on_face.reserve (this->get_fe ().max_dofs_per_face()); // loop over all faces to check @@ -1888,7 +1894,7 @@ namespace hp template<int dim, int spacedim> - unsigned int + types::global_dof_index DoFHandler<dim,spacedim>::n_boundary_dofs (const FunctionMap &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -1898,8 +1904,8 @@ namespace hp // same as above, but with // additional checks for set of // boundary indicators - std::set<int> boundary_dofs; - std::vector<unsigned int> dofs_on_face; + std::set<types::global_dof_index> boundary_dofs; + std::vector<types::global_dof_index> dofs_on_face; dofs_on_face.reserve (this->get_fe ().max_dofs_per_face()); typename DoFHandler<dim,spacedim>::active_cell_iterator cell = this->begin_active (), @@ -1924,7 +1930,7 @@ namespace hp template<int dim, int spacedim> - unsigned int + types::global_dof_index DoFHandler<dim,spacedim>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const { Assert (finite_elements != 0, ExcNoFESelected()); @@ -1934,8 +1940,8 @@ namespace hp // same as above, but with // additional checks for set of // boundary indicators - std::set<int> boundary_dofs; - std::vector<unsigned int> dofs_on_face; + std::set<types::global_dof_index> boundary_dofs; + std::vector<types::global_dof_index> dofs_on_face; dofs_on_face.reserve (this->get_fe ().max_dofs_per_face()); typename DoFHandler<dim,spacedim>::active_cell_iterator cell = this->begin_active (), @@ -1949,7 +1955,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<dofs_per_face; ++i) boundary_dofs.insert(dofs_on_face[i]); }; @@ -1959,7 +1966,7 @@ namespace hp template <> - unsigned int DoFHandler<2,3>::n_boundary_dofs () const + types::global_dof_index DoFHandler<2,3>::n_boundary_dofs () const { Assert(false,ExcNotImplemented()); return 0; @@ -1968,7 +1975,7 @@ namespace hp template <> - unsigned int DoFHandler<2,3>::n_boundary_dofs (const FunctionMap &) const + types::global_dof_index DoFHandler<2,3>::n_boundary_dofs (const FunctionMap &) const { Assert(false,ExcNotImplemented()); return 0; @@ -1977,7 +1984,7 @@ namespace hp template <> - unsigned int DoFHandler<2,3>::n_boundary_dofs (const std::set<types::boundary_id> &) const + types::global_dof_index DoFHandler<2,3>::n_boundary_dofs (const std::set<types::boundary_id> &) const { Assert(false,ExcNotImplemented()); return 0; @@ -2010,7 +2017,7 @@ namespace hp template<int dim, int spacedim> void DoFHandler<dim,spacedim>:: - compute_vertex_dof_identities (std::vector<unsigned int> &new_dof_indices) const + compute_vertex_dof_identities (std::vector<types::global_dof_index> &new_dof_indices) const { // Note: we may wish to have // something here similar to what @@ -2092,13 +2099,13 @@ namespace hp = *vertex_dof_identities[first_fe_index][other_fe_index]; for (unsigned int i=0; i<identities.size(); ++i) { - const unsigned int lower_dof_index + const types::global_dof_index lower_dof_index = dealii::internal::DoFAccessor::Implementation:: get_vertex_dof_index (*this, vertex_index, first_fe_index, identities[i].first); - const unsigned int higher_dof_index + const types::global_dof_index higher_dof_index = dealii::internal::DoFAccessor::Implementation:: get_vertex_dof_index (*this, vertex_index, @@ -2106,7 +2113,7 @@ namespace hp identities[i].second); Assert ((new_dof_indices[higher_dof_index] == - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) || (new_dof_indices[higher_dof_index] == lower_dof_index), @@ -2123,7 +2130,7 @@ namespace hp template <> void DoFHandler<1,1>:: - compute_line_dof_identities (std::vector<unsigned int> &) const + compute_line_dof_identities (std::vector<types::global_dof_index> &) const {} @@ -2131,20 +2138,20 @@ namespace hp template <> void DoFHandler<1,2>:: - compute_line_dof_identities (std::vector<unsigned int> &) const + compute_line_dof_identities (std::vector<types::global_dof_index> &) const {} template <> void DoFHandler<1,3>:: - compute_line_dof_identities (std::vector<unsigned int> &) const + compute_line_dof_identities (std::vector<types::global_dof_index> &) const {} template<int dim, int spacedim> void DoFHandler<dim,spacedim>:: - compute_line_dof_identities (std::vector<unsigned int> &new_dof_indices) const + compute_line_dof_identities (std::vector<types::global_dof_index> &new_dof_indices) const { // we will mark lines that we // have already treated, so first @@ -2262,9 +2269,9 @@ namespace hp for (unsigned int j=0; j<(*finite_elements)[fe_index_1].dofs_per_line; ++j) { - const unsigned int master_dof_index + const types::global_dof_index master_dof_index = line->dof_index (j, fe_index_1); - const unsigned int slave_dof_index + const types::global_dof_index slave_dof_index = line->dof_index (j, fe_index_2); // if master dof @@ -2277,10 +2284,10 @@ namespace hp // slave to // master if (new_dof_indices[master_dof_index] != - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) { Assert (new_dof_indices[new_dof_indices[master_dof_index]] == - numbers::invalid_unsigned_int, + numbers::invalid_dof_index, ExcInternalError()); new_dof_indices[slave_dof_index] @@ -2289,7 +2296,7 @@ namespace hp else { Assert ((new_dof_indices[master_dof_index] == - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) || (new_dof_indices[slave_dof_index] == master_dof_index), @@ -2349,13 +2356,13 @@ namespace hp = *line_dof_identities[most_dominating_fe_index][other_fe_index]; for (unsigned int i=0; i<identities.size(); ++i) { - const unsigned int master_dof_index + const types::global_dof_index master_dof_index = line->dof_index (identities[i].first, most_dominating_fe_index); - const unsigned int slave_dof_index + const types::global_dof_index slave_dof_index = line->dof_index (identities[i].second, other_fe_index); Assert ((new_dof_indices[master_dof_index] == - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) || (new_dof_indices[slave_dof_index] == master_dof_index), @@ -2377,25 +2384,25 @@ namespace hp template <> void DoFHandler<1>:: - compute_quad_dof_identities (std::vector<unsigned int> &) const + compute_quad_dof_identities (std::vector<types::global_dof_index> &) const {} template <> void DoFHandler<1,2>:: - compute_quad_dof_identities (std::vector<unsigned int> &) const + compute_quad_dof_identities (std::vector<types::global_dof_index> &) const {} template <> void DoFHandler<1,3>:: - compute_quad_dof_identities (std::vector<unsigned int> &) const + compute_quad_dof_identities (std::vector<types::global_dof_index> &) const {} template <> void DoFHandler<2>:: - compute_quad_dof_identities (std::vector<unsigned int> &) const + compute_quad_dof_identities (std::vector<types::global_dof_index> &) const {} @@ -2403,7 +2410,7 @@ namespace hp template <> void DoFHandler<2,3>:: - compute_quad_dof_identities (std::vector<unsigned int> &) const + compute_quad_dof_identities (std::vector<types::global_dof_index> &) const {} @@ -2411,7 +2418,7 @@ namespace hp template<int dim, int spacedim> void DoFHandler<dim,spacedim>:: - compute_quad_dof_identities (std::vector<unsigned int> &new_dof_indices) const + compute_quad_dof_identities (std::vector<types::global_dof_index> &new_dof_indices) const { // we will mark quads that we // have already treated, so first @@ -2487,13 +2494,13 @@ namespace hp = *quad_dof_identities[most_dominating_fe_index][other_fe_index]; for (unsigned int i=0; i<identities.size(); ++i) { - const unsigned int master_dof_index + const types::global_dof_index master_dof_index = quad->dof_index (identities[i].first, most_dominating_fe_index); - const unsigned int slave_dof_index + const types::global_dof_index slave_dof_index = quad->dof_index (identities[i].second, other_fe_index); Assert ((new_dof_indices[master_dof_index] == - numbers::invalid_unsigned_int) + numbers::invalid_dof_index) || (new_dof_indices[slave_dof_index] == master_dof_index), @@ -2594,7 +2601,7 @@ namespace hp // Step 1: distribute DoFs on all // active entities { - unsigned int next_free_dof = 0; + types::global_dof_index next_free_dof = 0; active_cell_iterator cell = begin_active(), endc = end(); @@ -2616,8 +2623,8 @@ namespace hp // faces and other // lower-dimensional objects // where elements come together - std::vector<unsigned int> - constrained_indices (number_cache.n_global_dofs, numbers::invalid_unsigned_int); + std::vector<types::global_dof_index> + constrained_indices (number_cache.n_global_dofs, numbers::invalid_dof_index); compute_vertex_dof_identities (constrained_indices); compute_line_dof_identities (constrained_indices); compute_quad_dof_identities (constrained_indices); @@ -2625,11 +2632,11 @@ namespace hp // loop over all dofs and assign // new numbers to those which are // not constrained - std::vector<unsigned int> - new_dof_indices (number_cache.n_global_dofs, numbers::invalid_unsigned_int); - unsigned int next_free_dof = 0; - for (unsigned int i=0; i<number_cache.n_global_dofs; ++i) - if (constrained_indices[i] == numbers::invalid_unsigned_int) + std::vector<types::global_dof_index> + new_dof_indices (number_cache.n_global_dofs, numbers::invalid_dof_index); + types::global_dof_index next_free_dof = 0; + for (types::global_dof_index i=0; i<number_cache.n_global_dofs; ++i) + if (constrained_indices[i] == numbers::invalid_dof_index) { new_dof_indices[i] = next_free_dof; ++next_free_dof; @@ -2638,19 +2645,19 @@ namespace hp // then loop over all those that // are constrained and record the // new dof number for those: - for (unsigned int i=0; i<number_cache.n_global_dofs; ++i) - if (constrained_indices[i] != numbers::invalid_unsigned_int) + for (types::global_dof_index i=0; i<number_cache.n_global_dofs; ++i) + if (constrained_indices[i] != numbers::invalid_dof_index) { Assert (new_dof_indices[constrained_indices[i]] != - numbers::invalid_unsigned_int, + numbers::invalid_dof_index, ExcInternalError()); new_dof_indices[i] = new_dof_indices[constrained_indices[i]]; } - for (unsigned int i=0; i<number_cache.n_global_dofs; ++i) + for (types::global_dof_index i=0; i<number_cache.n_global_dofs; ++i) { - Assert (new_dof_indices[i] != numbers::invalid_unsigned_int, + Assert (new_dof_indices[i] != numbers::invalid_dof_index, ExcInternalError()); Assert (new_dof_indices[i] < next_free_dof, ExcInternalError()); @@ -2670,10 +2677,11 @@ namespace hp = IndexSet (number_cache.n_global_dofs); number_cache.locally_owned_dofs.add_range (0, number_cache.n_global_dofs); - + Assert (number_cache.n_global_dofs < std::numeric_limits<unsigned int>::max (), + ExcMessage ("Global number of degrees of freedom is too large.")); number_cache.n_locally_owned_dofs_per_processor - = std::vector<unsigned int> (1, - number_cache.n_global_dofs); + = std::vector<types::global_dof_index> (1, + (types::global_dof_index) number_cache.n_global_dofs); number_cache.locally_owned_dofs_per_processor = std::vector<IndexSet> (1, @@ -2698,7 +2706,7 @@ namespace hp template<int dim, int spacedim> - void DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<unsigned int> &new_numbers) + void DoFHandler<dim,spacedim>::renumber_dofs (const std::vector<types::global_dof_index> &new_numbers) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); #ifdef DEBUG @@ -2706,10 +2714,10 @@ namespace hp // consecutively numbered if (true) { - std::vector<unsigned int> tmp(new_numbers); + std::vector<types::global_dof_index> tmp(new_numbers); std::sort (tmp.begin(), tmp.end()); - std::vector<unsigned int>::const_iterator p = tmp.begin(); - unsigned int i = 0; + std::vector<types::global_dof_index>::const_iterator p = tmp.begin(); + types::global_dof_index i = 0; for (; p!=tmp.end(); ++p, ++i) Assert (*p == i, ExcNewNumbersNotConsecutive(i)); } @@ -2723,7 +2731,7 @@ namespace hp template<int dim, int spacedim> void DoFHandler<dim,spacedim>:: - renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<0>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -2743,7 +2751,7 @@ namespace hp for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_vertex; ++d) { - const unsigned int vertex_dof_index + const types::global_dof_index vertex_dof_index = dealii::internal::DoFAccessor::Implementation:: get_vertex_dof_index(*this, vertex_index, @@ -2765,7 +2773,7 @@ namespace hp template<int dim, int spacedim> void DoFHandler<dim,spacedim>:: - renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<1>) { Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete()); @@ -2815,7 +2823,7 @@ namespace hp template<> void DoFHandler<2,2>:: - renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<2>) { const unsigned int dim = 2; @@ -2867,7 +2875,7 @@ namespace hp template<> void DoFHandler<2,3>:: - renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<2>) { const unsigned int dim = 2; @@ -2918,7 +2926,7 @@ namespace hp template<> void DoFHandler<3,3>:: - renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<2>) { const unsigned int dim = 3; @@ -2969,7 +2977,7 @@ namespace hp template<> void DoFHandler<3,3>:: - renumber_dofs_internal (const std::vector<unsigned int> &new_numbers, + renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers, dealii::internal::int2type<3>) { const unsigned int dim = 3; @@ -3312,14 +3320,14 @@ namespace hp template <int dim, int spacedim> template <int structdim> - unsigned int + types::global_dof_index DoFHandler<dim,spacedim>::get_dof_index (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const { Assert (false, ExcNotImplemented()); - return numbers::invalid_unsigned_int; + return numbers::invalid_dof_index; } @@ -3330,7 +3338,7 @@ namespace hp const unsigned int, const unsigned int, const unsigned int, - const unsigned int) const + const types::global_dof_index) const { Assert (false, ExcNotImplemented()); } @@ -3346,12 +3354,12 @@ namespace hp faces = NULL; { - std::vector<unsigned int> tmp; + std::vector<types::global_dof_index> tmp; std::swap (vertex_dofs, tmp); } { - std::vector<unsigned int> tmp; + std::vector<types::global_dof_index> tmp; std::swap (vertex_dofs_offsets, tmp); } } diff --git a/deal.II/source/hp/dof_handler.inst.in b/deal.II/source/hp/dof_handler.inst.in index cb3e175963..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) { @@ -21,21 +25,21 @@ for (deal_II_dimension : DIMENSIONS) template class DoFHandler<deal_II_dimension, deal_II_dimension+1>; template - unsigned int + types::global_dof_index DoFHandler<deal_II_dimension, deal_II_dimension+1>::get_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; template void - DoFHandler<deal_II_dimension, deal_II_dimension+1>::set_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; + DoFHandler<deal_II_dimension, deal_II_dimension+1>::set_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const types::global_dof_index) const; #if deal_II_dimension >= 2 template - unsigned int + types::global_dof_index DoFHandler<deal_II_dimension, deal_II_dimension+1>::get_dof_index<2> (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; template void - DoFHandler<deal_II_dimension, deal_II_dimension+1>::set_dof_index<2> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; + DoFHandler<deal_II_dimension, deal_II_dimension+1>::set_dof_index<2> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const types::global_dof_index) const; #endif #endif @@ -43,43 +47,43 @@ for (deal_II_dimension : DIMENSIONS) template class DoFHandler<1, 3>; template -unsigned int +types::global_dof_index DoFHandler<1,3>::get_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; template void -DoFHandler<1,3>::set_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, unsigned int) const; +DoFHandler<1,3>::set_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const types::global_dof_index) const; #endif template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension>::get_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; #if deal_II_dimension >= 2 template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension>::get_dof_index<2> (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; #if deal_II_dimension >= 3 template -unsigned int +types::global_dof_index DoFHandler<deal_II_dimension>::get_dof_index<3> (const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; #endif #endif template void -DoFHandler<deal_II_dimension>::set_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; +DoFHandler<deal_II_dimension>::set_dof_index<1> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const types::global_dof_index) const; #if deal_II_dimension >= 2 template void -DoFHandler<deal_II_dimension>::set_dof_index<2> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; +DoFHandler<deal_II_dimension>::set_dof_index<2> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const types::global_dof_index) const; #if deal_II_dimension >= 3 template void -DoFHandler<deal_II_dimension>::set_dof_index<3> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int) const; +DoFHandler<deal_II_dimension>::set_dof_index<3> (const unsigned int, const unsigned int, const unsigned int, const unsigned int, const types::global_dof_index) const; #endif #endif \} diff --git a/deal.II/source/hp/dof_levels.cc b/deal.II/source/hp/dof_levels.cc index f37fbcdef4..6ee1b772fd 100644 --- a/deal.II/source/hp/dof_levels.cc +++ b/deal.II/source/hp/dof_levels.cc @@ -1,16 +1,18 @@ -//---------------------------- hp_dof_levels.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. // -//---------------------------- hp_dof_levels.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 <deal.II/base/memory_consumption.h> #include <deal.II/hp/dof_levels.h> diff --git a/deal.II/source/hp/dof_objects.cc b/deal.II/source/hp/dof_objects.cc index 38c3a0347b..361e15da2a 100644 --- a/deal.II/source/hp/dof_objects.cc +++ b/deal.II/source/hp/dof_objects.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 <deal.II/base/memory_consumption.h> #include <deal.II/hp/dof_objects.h> 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 <deal.II/base/memory_consumption.h> #include <deal.II/hp/fe_collection.h> 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 <deal.II/hp/fe_values.h> #include <deal.II/fe/mapping_q1.h> 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 <deal.II/base/memory_consumption.h> #include <deal.II/hp/mapping_collection.h> 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..45ba6b7b61 100644 --- a/deal.II/source/integrators/CMakeLists.txt +++ b/deal.II/source/integrators/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/deal.II/source/lac/CMakeLists.txt b/deal.II/source/lac/CMakeLists.txt index e4a11e76c9..bc2e40555c 100644 --- a/deal.II/source/lac/CMakeLists.txt +++ b/deal.II/source/lac/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/deal.II/source/lac/block_matrix_array.cc b/deal.II/source/lac/block_matrix_array.cc index e62f320d35..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 <deal.II/lac/block_matrix_array.h> #include <deal.II/lac/vector.h> @@ -320,7 +325,7 @@ template <typename number> void BlockTrianglePrecondition<number>::do_row ( BlockVector<number> &dst, - unsigned int row_num) const + size_type row_num) const { GrowingVectorMemory<Vector<number> > mem; typename std::vector<typename BlockMatrixArray<number>::Entry>::const_iterator @@ -339,12 +344,12 @@ BlockTrianglePrecondition<number>::do_row ( // they are not ordered by rows. for (; m != end ; ++m) { - const unsigned int i=m->row; + const size_type i=m->row; // Ignore everything not in // this row if (i != row_num) continue; - const unsigned int j=m->col; + const size_type j=m->col; // Only use the lower (upper) // triangle for forward // (backward) substitution @@ -379,7 +384,7 @@ BlockTrianglePrecondition<number>::do_row ( else { aux = 0.; - for (unsigned int i=0; i<diagonals.size(); ++i) + for (size_type i=0; i<diagonals.size(); ++i) { m = diagonals[i]; // First, divide by the current 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 <deal.II/lac/block_sparse_matrix.templates.h> 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<S>; 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 <deal.II/lac/block_sparse_matrix_ez.h> #include <deal.II/lac/block_sparse_matrix_ez.templates.h> diff --git a/deal.II/source/lac/block_sparsity_pattern.cc b/deal.II/source/lac/block_sparsity_pattern.cc index b09aeb3df9..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 <deal.II/base/vector_slice.h> #include <deal.II/base/memory_consumption.h> @@ -29,8 +33,8 @@ BlockSparsityPatternBase<SparsityPatternBase>::BlockSparsityPatternBase () template <class SparsityPatternBase> BlockSparsityPatternBase<SparsityPatternBase>:: -BlockSparsityPatternBase (const unsigned int n_block_rows, - const unsigned int n_block_columns) +BlockSparsityPatternBase (const size_type n_block_rows, + const size_type n_block_columns) : rows (0), columns (0) @@ -67,14 +71,14 @@ BlockSparsityPatternBase<SparsityPatternBase>::~BlockSparsityPatternBase () template <class SparsityPatternBase> void BlockSparsityPatternBase<SparsityPatternBase>:: -reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns) +reinit (const size_type n_block_rows, + const size_type n_block_columns) { // delete previous content and // clean the sub_objects array // completely - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) { SparsityPatternBase *sp = sub_objects[i][j]; sub_objects[i][j] = 0; @@ -88,8 +92,8 @@ reinit (const unsigned int n_block_rows, sub_objects.reinit (rows, columns); // allocate new objects - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) { SparsityPatternBase *p = new SparsityPatternBase; sub_objects[i][j] = p; @@ -105,8 +109,8 @@ operator = (const BlockSparsityPatternBase<SparsityPatternBase> &bsp) Assert (rows == bsp.rows, ExcDimensionMismatch(rows, bsp.rows)); Assert (columns == bsp.columns, ExcDimensionMismatch(columns, bsp.columns)); // copy objects - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) *sub_objects[i][j] = *bsp.sub_objects[i][j]; // update index objects collect_sizes (); @@ -120,18 +124,18 @@ template <class SparsityPatternBase> void BlockSparsityPatternBase<SparsityPatternBase>::collect_sizes () { - std::vector<unsigned int> row_sizes (rows); - std::vector<unsigned int> col_sizes (columns); + std::vector<size_type > row_sizes (rows); + std::vector<size_type > col_sizes (columns); // first find out the row sizes // from the first block column - for (unsigned int r=0; r<rows; ++r) + for (size_type r=0; r<rows; ++r) row_sizes[r] = sub_objects[r][0]->n_rows(); // then check that the following // block columns have the same // sizes - for (unsigned int c=1; c<columns; ++c) - for (unsigned int r=0; r<rows; ++r) + for (size_type c=1; c<columns; ++c) + for (size_type r=0; r<rows; ++r) Assert (row_sizes[r] == sub_objects[r][c]->n_rows(), ExcIncompatibleRowNumbers (r,0,r,c)); @@ -141,10 +145,10 @@ BlockSparsityPatternBase<SparsityPatternBase>::collect_sizes () // then do the same with the columns - for (unsigned int c=0; c<columns; ++c) + for (size_type c=0; c<columns; ++c) col_sizes[c] = sub_objects[0][c]->n_cols(); - for (unsigned int r=1; r<rows; ++r) - for (unsigned int c=0; c<columns; ++c) + for (size_type r=1; r<rows; ++r) + for (size_type c=0; c<columns; ++c) Assert (col_sizes[c] == sub_objects[r][c]->n_cols(), ExcIncompatibleRowNumbers (0,c,r,c)); @@ -159,8 +163,8 @@ template <class SparsityPatternBase> void BlockSparsityPatternBase<SparsityPatternBase>::compress () { - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) sub_objects[i][j]->compress (); } @@ -170,8 +174,8 @@ template <class SparsityPatternBase> bool BlockSparsityPatternBase<SparsityPatternBase>::empty () const { - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) if (sub_objects[i][j]->empty () == false) return false; return true; @@ -180,14 +184,14 @@ BlockSparsityPatternBase<SparsityPatternBase>::empty () const template <class SparsityPatternBase> -unsigned int +typename BlockSparsityPatternBase<SparsityPatternBase>::size_type BlockSparsityPatternBase<SparsityPatternBase>::max_entries_per_row () const { - unsigned int max_entries = 0; - for (unsigned int block_row=0; block_row<rows; ++block_row) + size_type max_entries = 0; + for (size_type block_row=0; block_row<rows; ++block_row) { - unsigned int this_row = 0; - for (unsigned int c=0; c<columns; ++c) + size_type this_row = 0; + for (size_type c=0; c<columns; ++c) this_row += sub_objects[block_row][c]->max_entries_per_row (); if (this_row > max_entries) @@ -199,13 +203,13 @@ BlockSparsityPatternBase<SparsityPatternBase>::max_entries_per_row () const template <class SparsityPatternBase> -unsigned int +typename BlockSparsityPatternBase<SparsityPatternBase>::size_type BlockSparsityPatternBase<SparsityPatternBase>::n_rows () const { // only count in first column, since // all rows should be equivalent - unsigned int count = 0; - for (unsigned int r=0; r<rows; ++r) + size_type count = 0; + for (size_type r=0; r<rows; ++r) count += sub_objects[r][0]->n_rows(); return count; } @@ -213,13 +217,13 @@ BlockSparsityPatternBase<SparsityPatternBase>::n_rows () const template <class SparsityPatternBase> -unsigned int +typename BlockSparsityPatternBase<SparsityPatternBase>::size_type BlockSparsityPatternBase<SparsityPatternBase>::n_cols () const { // only count in first row, since // all rows should be equivalent - unsigned int count = 0; - for (unsigned int c=0; c<columns; ++c) + size_type count = 0; + for (size_type c=0; c<columns; ++c) count += sub_objects[0][c]->n_cols(); return count; } @@ -227,12 +231,12 @@ BlockSparsityPatternBase<SparsityPatternBase>::n_cols () const template <class SparsityPatternBase> -unsigned int +typename BlockSparsityPatternBase<SparsityPatternBase>::size_type BlockSparsityPatternBase<SparsityPatternBase>::n_nonzero_elements () const { - unsigned int count = 0; - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + size_type count = 0; + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) count += sub_objects[i][j]->n_nonzero_elements (); return count; } @@ -243,17 +247,17 @@ template <class SparsityPatternBase> void BlockSparsityPatternBase<SparsityPatternBase>::print(std::ostream &out) const { - unsigned int k=0; - for (unsigned int ib=0; ib<n_block_rows(); ++ib) + size_type k=0; + for (size_type ib=0; ib<n_block_rows(); ++ib) { - for (unsigned int i=0; i<block(ib,0).n_rows(); ++i) + for (size_type i=0; i<block(ib,0).n_rows(); ++i) { out << '[' << i+k; - unsigned int l=0; - for (unsigned int jb=0; jb<n_block_cols(); ++jb) + size_type l=0; + for (size_type jb=0; jb<n_block_cols(); ++jb) { const SparsityPatternBase &b = block(ib,jb); - for (unsigned int j=0; j<b.n_cols(); ++j) + for (size_type j=0; j<b.n_cols(); ++j) if (b.exists(i,j)) out << ',' << l+j; l += b.n_cols(); @@ -269,18 +273,18 @@ template <> void BlockSparsityPatternBase<CompressedSimpleSparsityPattern>::print(std::ostream &out) const { - unsigned int k=0; - for (unsigned int ib=0; ib<n_block_rows(); ++ib) + size_type k=0; + for (size_type ib=0; ib<n_block_rows(); ++ib) { - for (unsigned int i=0; i<block(ib,0).n_rows(); ++i) + for (size_type i=0; i<block(ib,0).n_rows(); ++i) { out << '[' << i+k; - unsigned int l=0; - for (unsigned int jb=0; jb<n_block_cols(); ++jb) + size_type l=0; + for (size_type jb=0; jb<n_block_cols(); ++jb) { const CompressedSimpleSparsityPattern &b = block(ib,jb); if (b.row_index_set().size()==0 || b.row_index_set().is_element(i)) - for (unsigned int j=0; j<b.n_cols(); ++j) + for (size_type j=0; j<b.n_cols(); ++j) if (b.exists(i,j)) out << ',' << l+j; l += b.n_cols(); @@ -296,16 +300,16 @@ template <class SparsityPatternBase> void BlockSparsityPatternBase<SparsityPatternBase>::print_gnuplot(std::ostream &out) const { - unsigned int k=0; - for (unsigned int ib=0; ib<n_block_rows(); ++ib) + size_type k=0; + for (size_type ib=0; ib<n_block_rows(); ++ib) { - for (unsigned int i=0; i<block(ib,0).n_rows(); ++i) + for (size_type i=0; i<block(ib,0).n_rows(); ++i) { - unsigned int l=0; - for (unsigned int jb=0; jb<n_block_cols(); ++jb) + size_type l=0; + for (size_type jb=0; jb<n_block_cols(); ++jb) { const SparsityPatternBase &b = block(ib,jb); - for (unsigned int j=0; j<b.n_cols(); ++j) + for (size_type j=0; j<b.n_cols(); ++j) if (b.exists(i,j)) out << l+j << " " << -static_cast<signed int>(i+k) << std::endl; l += b.n_cols(); @@ -347,8 +351,8 @@ BlockSparsityPattern::BlockSparsityPattern () -BlockSparsityPattern::BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns) +BlockSparsityPattern::BlockSparsityPattern (const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns) @@ -364,11 +368,11 @@ BlockSparsityPattern::reinit( AssertDimension (row_lengths.size(), cols.size()); this->reinit(rows.size(), cols.size()); - for (unsigned int j=0; j<cols.size(); ++j) - for (unsigned int i=0; i<rows.size(); ++i) + for (size_type j=0; j<cols.size(); ++j) + for (size_type i=0; i<rows.size(); ++i) { - const unsigned int start = rows.local_to_global(i, 0); - const unsigned int length = rows.block_size(i); + const size_type start = rows.local_to_global(i, 0); + const size_type length = rows.block_size(i); if (row_lengths[j].size()==1) block(i,j).reinit(rows.block_size(i), @@ -391,8 +395,8 @@ BlockSparsityPattern::reinit( bool BlockSparsityPattern::is_compressed () const { - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<columns; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<columns; ++j) if (sub_objects[i][j]->is_compressed () == false) return false; return true; @@ -408,8 +412,8 @@ BlockSparsityPattern::memory_consumption () const MemoryConsumption::memory_consumption (sub_objects) + MemoryConsumption::memory_consumption (row_indices) + MemoryConsumption::memory_consumption (column_indices)); - for (unsigned int r=0; r<rows; ++r) - for (unsigned int c=0; c<columns; ++c) + for (size_type r=0; r<rows; ++r) + for (size_type c=0; c<columns; ++c) mem += MemoryConsumption::memory_consumption (*sub_objects[r][c]); return mem; @@ -425,8 +429,8 @@ BlockSparsityPattern::copy_from (const BlockCompressedSparsityPattern &csp) reinit (csp.n_block_rows(), csp.n_block_cols()); // copy over blocks - for (unsigned int i=0; i<n_block_rows(); ++i) - for (unsigned int j=0; j<n_block_cols(); ++j) + for (size_type i=0; i<n_block_rows(); ++i) + for (size_type j=0; j<n_block_cols(); ++j) block(i,j).copy_from (csp.block(i,j)); // and finally enquire their new @@ -442,8 +446,8 @@ BlockSparsityPattern::copy_from (const BlockCompressedSimpleSparsityPattern &cs reinit (csp.n_block_rows(), csp.n_block_cols()); // copy over blocks - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<rows; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<rows; ++j) block(i,j).copy_from (csp.block(i,j)); // and finally enquire their new @@ -459,8 +463,8 @@ BlockSparsityPattern::copy_from (const BlockCompressedSetSparsityPattern &csp) reinit (csp.n_block_rows(), csp.n_block_cols()); // copy over blocks - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=0; j<rows; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=0; j<rows; ++j) block(i,j).copy_from (csp.block(i,j)); // and finally enquire their new @@ -477,8 +481,8 @@ BlockCompressedSparsityPattern::BlockCompressedSparsityPattern () BlockCompressedSparsityPattern:: BlockCompressedSparsityPattern ( - const unsigned int n_rows, - const unsigned int n_columns) + const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase<CompressedSparsityPattern>(n_rows, n_columns) @@ -487,8 +491,8 @@ BlockCompressedSparsityPattern ( BlockCompressedSparsityPattern:: BlockCompressedSparsityPattern ( - const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices) + const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices) { reinit(row_indices, col_indices); } @@ -505,12 +509,12 @@ BlockCompressedSparsityPattern ( void BlockCompressedSparsityPattern::reinit ( - const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes) + const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes) { BlockSparsityPatternBase<CompressedSparsityPattern>::reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; i<row_block_sizes.size(); ++i) - for (unsigned int j=0; j<col_block_sizes.size(); ++j) + for (size_type i=0; i<row_block_sizes.size(); ++i) + for (size_type j=0; j<col_block_sizes.size(); ++j) this->block(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -524,8 +528,8 @@ BlockCompressedSparsityPattern::reinit ( { BlockSparsityPatternBase<CompressedSparsityPattern>::reinit(row_indices.size(), col_indices.size()); - for (unsigned int i=0; i<row_indices.size(); ++i) - for (unsigned int j=0; j<col_indices.size(); ++j) + for (size_type i=0; i<row_indices.size(); ++i) + for (size_type j=0; j<col_indices.size(); ++j) this->block(i,j).reinit(row_indices.block_size(i), col_indices.block_size(j)); this->collect_sizes(); @@ -540,8 +544,8 @@ BlockCompressedSetSparsityPattern::BlockCompressedSetSparsityPattern () BlockCompressedSetSparsityPattern:: BlockCompressedSetSparsityPattern ( - const unsigned int n_rows, - const unsigned int n_columns) + const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase<CompressedSetSparsityPattern>(n_rows, n_columns) @@ -550,8 +554,8 @@ BlockCompressedSetSparsityPattern ( BlockCompressedSetSparsityPattern:: BlockCompressedSetSparsityPattern ( - const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices) + const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices) { reinit(row_indices, col_indices); } @@ -568,12 +572,12 @@ BlockCompressedSetSparsityPattern ( void BlockCompressedSetSparsityPattern::reinit ( - const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes) + const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes) { BlockSparsityPatternBase<CompressedSetSparsityPattern>::reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; i<row_block_sizes.size(); ++i) - for (unsigned int j=0; j<col_block_sizes.size(); ++j) + for (size_type i=0; i<row_block_sizes.size(); ++i) + for (size_type j=0; j<col_block_sizes.size(); ++j) this->block(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -587,8 +591,8 @@ BlockCompressedSetSparsityPattern::reinit ( { BlockSparsityPatternBase<CompressedSetSparsityPattern>::reinit(row_indices.size(), col_indices.size()); - for (unsigned int i=0; i<row_indices.size(); ++i) - for (unsigned int j=0; j<col_indices.size(); ++j) + for (size_type i=0; i<row_indices.size(); ++i) + for (size_type j=0; j<col_indices.size(); ++j) this->block(i,j).reinit(row_indices.block_size(i), col_indices.block_size(j)); this->collect_sizes(); @@ -602,8 +606,8 @@ BlockCompressedSimpleSparsityPattern::BlockCompressedSimpleSparsityPattern () BlockCompressedSimpleSparsityPattern:: -BlockCompressedSimpleSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns) +BlockCompressedSimpleSparsityPattern (const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase<CompressedSimpleSparsityPattern>(n_rows, n_columns) @@ -612,14 +616,14 @@ BlockCompressedSimpleSparsityPattern (const unsigned int n_rows, BlockCompressedSimpleSparsityPattern:: -BlockCompressedSimpleSparsityPattern (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices) +BlockCompressedSimpleSparsityPattern (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices) : BlockSparsityPatternBase<CompressedSimpleSparsityPattern>(row_indices.size(), col_indices.size()) { - for (unsigned int i=0; i<row_indices.size(); ++i) - for (unsigned int j=0; j<col_indices.size(); ++j) + for (size_type i=0; i<row_indices.size(); ++i) + for (size_type j=0; j<col_indices.size(); ++j) this->block(i,j).reinit(row_indices[i],col_indices[j]); this->collect_sizes(); } @@ -631,8 +635,8 @@ BlockCompressedSimpleSparsityPattern (const std::vector<IndexSet> &partitioning) BlockSparsityPatternBase<CompressedSimpleSparsityPattern>(partitioning.size(), partitioning.size()) { - for (unsigned int i=0; i<partitioning.size(); ++i) - for (unsigned int j=0; j<partitioning.size(); ++j) + for (size_type i=0; i<partitioning.size(); ++i) + for (size_type j=0; j<partitioning.size(); ++j) this->block(i,j).reinit(partitioning[i].size(), partitioning[j].size(), partitioning[i]); @@ -643,13 +647,13 @@ BlockCompressedSimpleSparsityPattern (const std::vector<IndexSet> &partitioning) void BlockCompressedSimpleSparsityPattern::reinit ( - const std::vector< unsigned int > &row_block_sizes, - const std::vector< unsigned int > &col_block_sizes) + const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes) { BlockSparsityPatternBase<CompressedSimpleSparsityPattern>:: reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; i<row_block_sizes.size(); ++i) - for (unsigned int j=0; j<col_block_sizes.size(); ++j) + for (size_type i=0; i<row_block_sizes.size(); ++i) + for (size_type j=0; j<col_block_sizes.size(); ++j) this->block(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -660,8 +664,8 @@ BlockCompressedSimpleSparsityPattern::reinit ( { BlockSparsityPatternBase<CompressedSimpleSparsityPattern>:: reinit(partitioning.size(), partitioning.size()); - for (unsigned int i=0; i<partitioning.size(); ++i) - for (unsigned int j=0; j<partitioning.size(); ++j) + for (size_type i=0; i<partitioning.size(); ++i) + for (size_type j=0; j<partitioning.size(); ++j) this->block(i,j).reinit(partitioning[i].size(), partitioning[j].size(), partitioning[i]); @@ -679,8 +683,8 @@ namespace TrilinosWrappers BlockSparsityPattern:: - BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns) + BlockSparsityPattern (const size_type n_rows, + const size_type n_columns) : dealii::BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns) @@ -689,14 +693,14 @@ namespace TrilinosWrappers BlockSparsityPattern:: - BlockSparsityPattern (const std::vector<unsigned int> &row_indices, - const std::vector<unsigned int> &col_indices) + BlockSparsityPattern (const std::vector<size_type> &row_indices, + const std::vector<size_type> &col_indices) : BlockSparsityPatternBase<SparsityPattern>(row_indices.size(), col_indices.size()) { - for (unsigned int i=0; i<row_indices.size(); ++i) - for (unsigned int j=0; j<col_indices.size(); ++j) + for (size_type i=0; i<row_indices.size(); ++i) + for (size_type j=0; j<col_indices.size(); ++j) this->block(i,j).reinit(row_indices[i],col_indices[j]); this->collect_sizes(); } @@ -710,8 +714,8 @@ namespace TrilinosWrappers (parallel_partitioning.size(), parallel_partitioning.size()) { - for (unsigned int i=0; i<parallel_partitioning.size(); ++i) - for (unsigned int j=0; j<parallel_partitioning.size(); ++j) + for (size_type i=0; i<parallel_partitioning.size(); ++i) + for (size_type j=0; j<parallel_partitioning.size(); ++j) this->block(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j]); this->collect_sizes(); @@ -727,8 +731,8 @@ namespace TrilinosWrappers (parallel_partitioning.size(), parallel_partitioning.size()) { - for (unsigned int i=0; i<parallel_partitioning.size(); ++i) - for (unsigned int j=0; j<parallel_partitioning.size(); ++j) + for (size_type i=0; i<parallel_partitioning.size(); ++i) + for (size_type j=0; j<parallel_partitioning.size(); ++j) this->block(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j], communicator); @@ -738,13 +742,13 @@ namespace TrilinosWrappers void - BlockSparsityPattern::reinit (const std::vector<unsigned int> &row_block_sizes, - const std::vector<unsigned int> &col_block_sizes) + BlockSparsityPattern::reinit (const std::vector<size_type> &row_block_sizes, + const std::vector<size_type> &col_block_sizes) { dealii::BlockSparsityPatternBase<SparsityPattern>:: reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; i<row_block_sizes.size(); ++i) - for (unsigned int j=0; j<col_block_sizes.size(); ++j) + for (size_type i=0; i<row_block_sizes.size(); ++i) + for (size_type j=0; j<col_block_sizes.size(); ++j) this->block(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -757,8 +761,8 @@ namespace TrilinosWrappers dealii::BlockSparsityPatternBase<SparsityPattern>:: reinit(parallel_partitioning.size(), parallel_partitioning.size()); - for (unsigned int i=0; i<parallel_partitioning.size(); ++i) - for (unsigned int j=0; j<parallel_partitioning.size(); ++j) + for (size_type i=0; i<parallel_partitioning.size(); ++i) + for (size_type j=0; j<parallel_partitioning.size(); ++j) this->block(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j]); this->collect_sizes(); @@ -773,8 +777,8 @@ namespace TrilinosWrappers dealii::BlockSparsityPatternBase<SparsityPattern>:: reinit(parallel_partitioning.size(), parallel_partitioning.size()); - for (unsigned int i=0; i<parallel_partitioning.size(); ++i) - for (unsigned int j=0; j<parallel_partitioning.size(); ++j) + for (size_type i=0; i<parallel_partitioning.size(); ++i) + for (size_type j=0; j<parallel_partitioning.size(); ++j) this->block(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j], communicator); 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 <deal.II/lac/block_vector.templates.h> 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 <deal.II/lac/chunk_sparse_matrix.templates.h> #include <deal.II/lac/block_vector.h> diff --git a/deal.II/source/lac/chunk_sparse_matrix.inst.in b/deal.II/source/lac/chunk_sparse_matrix.inst.in index 3b1b4e6a74..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 @@ -81,13 +85,13 @@ for (S1, S2 : REAL_SCALARS) const S1) const; template void ChunkSparseMatrix<S1>:: PSOR<S2> (Vector<S2> &, - const std::vector<unsigned int>&, - const std::vector<unsigned int>&, + const std::vector<types::global_dof_index>&, + const std::vector<types::global_dof_index>&, const S1) const; template void ChunkSparseMatrix<S1>:: TPSOR<S2> (Vector<S2> &, - const std::vector<unsigned int>&, - const std::vector<unsigned int>&, + const std::vector<types::global_dof_index>&, + const std::vector<types::global_dof_index>&, const S1) const; template void ChunkSparseMatrix<S1>:: SOR_step<S2> (Vector<S2> &, @@ -188,13 +192,13 @@ for (S1, S2, S3 : REAL_SCALARS; // const S1) const; // template void ChunkSparseMatrix<S1>:: // PSOR<S2> (Vector<S2> &, -// const std::vector<unsigned int>&, -// const std::vector<unsigned int>&, +// const std::vector<types::global_dof_index>&, +// const std::vector<types::global_dof_index>&, // const S1) const; // template void ChunkSparseMatrix<S1>:: // TPSOR<S2> (Vector<S2> &, -// const std::vector<unsigned int>&, -// const std::vector<unsigned int>&, +// const std::vector<types::global_dof_index>&, +// const std::vector<types::global_dof_index>&, // const S1) const; // template void ChunkSparseMatrix<S1>:: // SOR_step<S2> (Vector<S2> &, diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index 5bcb7c0470..a9e5b9de0b 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 <deal.II/lac/chunk_sparsity_pattern.h> #include <deal.II/lac/compressed_sparsity_pattern.h> @@ -42,10 +46,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const ChunkSparsityPattern &s) -ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size, +ChunkSparsityPattern::ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size, const bool) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -54,10 +58,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int m, } -ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size) +ChunkSparsityPattern::ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -67,10 +71,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int m, ChunkSparsityPattern::ChunkSparsityPattern ( - const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size, + const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size, const bool) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -81,10 +85,10 @@ ChunkSparsityPattern::ChunkSparsityPattern ( ChunkSparsityPattern::ChunkSparsityPattern ( - const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size) + const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -93,9 +97,9 @@ ChunkSparsityPattern::ChunkSparsityPattern ( -ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size) +ChunkSparsityPattern::ChunkSparsityPattern (const size_type n, + const size_type max_per_row, + const size_type chunk_size) { reinit (n, n, max_per_row, chunk_size); } @@ -103,9 +107,9 @@ ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int n, ChunkSparsityPattern::ChunkSparsityPattern ( - const unsigned int m, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size, + const size_type m, + const std::vector<size_type> &row_lengths, + const size_type chunk_size, const bool) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -116,9 +120,9 @@ ChunkSparsityPattern::ChunkSparsityPattern ( ChunkSparsityPattern::ChunkSparsityPattern ( - const unsigned int m, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size) + const size_type m, + const std::vector<size_type > &row_lengths, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -147,10 +151,10 @@ ChunkSparsityPattern::operator = (const ChunkSparsityPattern &s) void -ChunkSparsityPattern::reinit (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size, +ChunkSparsityPattern::reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size, const bool) { reinit (m, n, max_per_row, chunk_size); @@ -158,15 +162,15 @@ ChunkSparsityPattern::reinit (const unsigned int m, void -ChunkSparsityPattern::reinit (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size) +ChunkSparsityPattern::reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); // simply map this function to the other @p{reinit} function - const std::vector<unsigned int> row_lengths (m, max_per_row); + const std::vector<size_type> row_lengths (m, max_per_row); reinit (m, n, row_lengths, chunk_size); } @@ -174,10 +178,10 @@ ChunkSparsityPattern::reinit (const unsigned int m, void ChunkSparsityPattern::reinit ( - const unsigned int m, - const unsigned int n, - const VectorSlice<const std::vector<unsigned int> > &row_lengths, - const unsigned int chunk_size, + const size_type m, + const size_type n, + const VectorSlice<const std::vector<size_type> > &row_lengths, + const size_type chunk_size, const bool) { reinit (m, n, row_lengths, chunk_size); @@ -186,10 +190,10 @@ ChunkSparsityPattern::reinit ( void ChunkSparsityPattern::reinit ( - const unsigned int m, - const unsigned int n, - const VectorSlice<const std::vector<unsigned int> > &row_lengths, - const unsigned int chunk_size) + const size_type m, + const size_type n, + const VectorSlice<const std::vector<size_type> > &row_lengths, + const size_type chunk_size) { Assert (row_lengths.size() == m, ExcInvalidNumber (m)); Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -203,8 +207,8 @@ ChunkSparsityPattern::reinit ( // to calculate how many chunks we need: we need to round up (m/chunk_size) // and (n/chunk_size). rounding up in integer arithmetic equals // ((m+chunk_size-1)/chunk_size): - const unsigned int m_chunks = (m+chunk_size-1) / chunk_size, - n_chunks = (n+chunk_size-1) / chunk_size; + const size_type m_chunks = (m+chunk_size-1) / chunk_size, + n_chunks = (n+chunk_size-1) / chunk_size; // compute the maximum number of chunks in each row. the passed array // denotes the number of entries in each row of the big matrix -- in the @@ -213,7 +217,7 @@ ChunkSparsityPattern::reinit ( // and entries in row zero at columns {0,2} and for row one at {4,6} --> // we'll need 4 chunks for the first chunk row!) : std::vector<unsigned int> chunk_row_lengths (m_chunks, 0); - for (unsigned int i=0; i<m; ++i) + for (size_type i=0; i<m; ++i) chunk_row_lengths[i/chunk_size] += row_lengths[i]; // for the case that the reduced sparsity pattern optimizes the diagonal but @@ -241,7 +245,7 @@ ChunkSparsityPattern::compress () template <typename SparsityType> void ChunkSparsityPattern::copy_from (const SparsityType &csp, - const unsigned int chunk_size, + const size_type chunk_size, const bool) { copy_from (csp, chunk_size); @@ -253,11 +257,16 @@ namespace internal { namespace { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + // distinguish between compressed sparsity types that define row_begin() // and SparsityPattern that uses begin() as iterator type template <typename Sparsity> void copy_row (const Sparsity &csp, - const unsigned int row, + const size_type row, ChunkSparsityPattern &dst) { typename Sparsity::row_iterator col_num = csp.row_begin (row); @@ -266,7 +275,7 @@ namespace internal } void copy_row (const SparsityPattern &csp, - const unsigned int row, + const size_type row, ChunkSparsityPattern &dst) { SparsityPattern::iterator col_num = csp.begin (row); @@ -280,14 +289,14 @@ namespace internal template <typename SparsityType> void ChunkSparsityPattern::copy_from (const SparsityType &csp, - const unsigned int chunk_size) + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); // count number of entries per row, then initialize the underlying sparsity // pattern - std::vector<unsigned int> entries_per_row (csp.n_rows(), 0); - for (unsigned int row = 0; row<csp.n_rows(); ++row) + std::vector<size_type> entries_per_row (csp.n_rows(), 0); + for (size_type row = 0; row<csp.n_rows(); ++row) entries_per_row[row] = csp.row_length(row); reinit (csp.n_rows(), csp.n_cols(), @@ -295,7 +304,7 @@ ChunkSparsityPattern::copy_from (const SparsityType &csp, chunk_size); // then actually fill it - for (unsigned int row = 0; row<csp.n_rows(); ++row) + for (size_type row = 0; row<csp.n_rows(); ++row) internal::copy_row(csp, row, *this); // finally compress @@ -307,7 +316,7 @@ ChunkSparsityPattern::copy_from (const SparsityType &csp, template <typename number> void ChunkSparsityPattern::copy_from (const FullMatrix<number> &matrix, - const unsigned int chunk_size, + const size_type chunk_size, const bool) { copy_from (matrix, chunk_size); @@ -316,7 +325,7 @@ void ChunkSparsityPattern::copy_from (const FullMatrix<number> &matrix, template <typename number> void ChunkSparsityPattern::copy_from (const FullMatrix<number> &matrix, - const unsigned int chunk_size) + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -324,17 +333,17 @@ void ChunkSparsityPattern::copy_from (const FullMatrix<number> &matrix, // pattern. remember to also allocate space for the diagonal entry (if that // hasn't happened yet) if m==n since we always allocate that for diagonal // matrices - std::vector<unsigned int> entries_per_row (matrix.m(), 0); - for (unsigned int row=0; row<matrix.m(); ++row) + std::vector<size_type> entries_per_row (matrix.m(), 0); + for (size_type row=0; row<matrix.m(); ++row) { - for (unsigned int col=0; col<matrix.n(); ++col) - if (matrix(row,col) != 0) - ++entries_per_row[row]; + for (size_type col=0; col<matrix.n(); ++col) + if (matrix(row,col) != 0) + ++entries_per_row[row]; if ((matrix.m() == matrix.n()) - && - (matrix(row,row) == 0)) - ++entries_per_row[row]; + && + (matrix(row,row) == 0)) + ++entries_per_row[row]; } reinit (matrix.m(), matrix.n(), @@ -342,8 +351,8 @@ void ChunkSparsityPattern::copy_from (const FullMatrix<number> &matrix, chunk_size); // then actually fill it - for (unsigned int row=0; row<matrix.m(); ++row) - for (unsigned int col=0; col<matrix.n(); ++col) + for (size_type row=0; row<matrix.m(); ++row) + for (size_type col=0; col<matrix.n(); ++col) if (matrix(row,col) != 0) add (row,col); @@ -354,10 +363,10 @@ void ChunkSparsityPattern::copy_from (const FullMatrix<number> &matrix, void ChunkSparsityPattern::reinit ( - const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size, + const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size, const bool) { reinit (m, n, row_lengths, chunk_size); @@ -366,10 +375,10 @@ ChunkSparsityPattern::reinit ( void ChunkSparsityPattern::reinit ( - const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const unsigned int chunk_size) + const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -433,7 +442,7 @@ ChunkSparsityPattern::empty () const -unsigned int +ChunkSparsityPattern::size_type ChunkSparsityPattern::max_entries_per_row () const { return sparsity_pattern.max_entries_per_row() * chunk_size; @@ -442,8 +451,8 @@ ChunkSparsityPattern::max_entries_per_row () const void -ChunkSparsityPattern::add (const unsigned int i, - const unsigned int j) +ChunkSparsityPattern::add (const size_type i, + const size_type j) { Assert (i<rows, ExcInvalidIndex(i,rows)); Assert (j<cols, ExcInvalidIndex(j,cols)); @@ -453,8 +462,8 @@ ChunkSparsityPattern::add (const unsigned int i, bool -ChunkSparsityPattern::exists (const unsigned int i, - const unsigned int j) const +ChunkSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i<rows, ExcIndexRange(i,0,rows)); Assert (j<cols, ExcIndexRange(j,0,cols)); @@ -478,8 +487,8 @@ ChunkSparsityPattern::symmetrize () -unsigned int -ChunkSparsityPattern::row_length (const unsigned int i) const +ChunkSparsityPattern::size_type +ChunkSparsityPattern::row_length (const size_type i) const { Assert (i<rows, ExcIndexRange(i,0,rows)); @@ -504,7 +513,7 @@ ChunkSparsityPattern::row_length (const unsigned int i) const -unsigned int +ChunkSparsityPattern::size_type ChunkSparsityPattern::n_nonzero_elements () const { if ((n_rows() % chunk_size == 0) @@ -523,9 +532,9 @@ ChunkSparsityPattern::n_nonzero_elements () const (n_cols() % chunk_size == 0)) { // columns align with chunks, but not rows - unsigned int n = sparsity_pattern.n_nonzero_elements() * - chunk_size * - chunk_size; + size_type n = sparsity_pattern.n_nonzero_elements() * + chunk_size * + chunk_size; n -= (sparsity_pattern.n_rows() * chunk_size - n_rows()) * sparsity_pattern.row_length(sparsity_pattern.n_rows()-1) * chunk_size; @@ -534,38 +543,38 @@ ChunkSparsityPattern::n_nonzero_elements () const else { - // 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 - unsigned int n = 0; - - for (unsigned int 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; + // 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; } } } @@ -580,16 +589,16 @@ ChunkSparsityPattern::print (std::ostream &out) const AssertThrow (out, ExcIO()); - for (unsigned int i=0; i<sparsity_pattern.rows; ++i) - for (unsigned int d=0; + for (size_type i=0; i<sparsity_pattern.rows; ++i) + for (size_type d=0; (d<chunk_size) && (i*chunk_size + d < n_rows()); ++d) { out << '[' << i *chunk_size+d; - for (unsigned int j=sparsity_pattern.rowstart[i]; + for (size_type j=sparsity_pattern.rowstart[i]; j<sparsity_pattern.rowstart[i+1]; ++j) if (sparsity_pattern.colnums[j] != sparsity_pattern.invalid_entry) - for (unsigned int e=0; + for (size_type e=0; ((e<chunk_size) && (sparsity_pattern.colnums[j]*chunk_size + e < n_cols())); ++e) @@ -612,15 +621,15 @@ ChunkSparsityPattern::print_gnuplot (std::ostream &out) const // for each entry in the underlying sparsity pattern, repeat everything // chunk_size x chunk_size times - for (unsigned int i=0; i<sparsity_pattern.rows; ++i) - for (unsigned int j=sparsity_pattern.rowstart[i]; + for (size_type i=0; i<sparsity_pattern.rows; ++i) + for (size_type j=sparsity_pattern.rowstart[i]; j<sparsity_pattern.rowstart[i+1]; ++j) if (sparsity_pattern.colnums[j] != sparsity_pattern.invalid_entry) - for (unsigned int d=0; + for (size_type d=0; ((d<chunk_size) && (sparsity_pattern.colnums[j]*chunk_size+d < n_cols())); ++d) - for (unsigned int e=0; + for (size_type e=0; (e<chunk_size) && (i*chunk_size + e < n_rows()); ++e) // while matrix entries are usually written (i,j), with i vertical @@ -635,7 +644,7 @@ ChunkSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +ChunkSparsityPattern::size_type ChunkSparsityPattern::bandwidth () const { // calculate the bandwidth from that of the underlying sparsity @@ -722,19 +731,19 @@ ChunkSparsityPattern::memory_consumption () const // explicit instantiations template void ChunkSparsityPattern::copy_from<SparsityPattern> (const SparsityPattern &, - const unsigned int, + const size_type, const bool); template void ChunkSparsityPattern::copy_from<CompressedSparsityPattern> (const CompressedSparsityPattern &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from<CompressedSetSparsityPattern> (const CompressedSetSparsityPattern &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from<CompressedSimpleSparsityPattern> (const CompressedSimpleSparsityPattern &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::create_from<SparsityPattern> @@ -766,11 +775,11 @@ void ChunkSparsityPattern::create_from<CompressedSimpleSparsityPattern> const bool); template void ChunkSparsityPattern::copy_from<float> (const FullMatrix<float> &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from<double> (const FullMatrix<double> &, - const unsigned int, + const size_type , const bool); DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/lac/compressed_set_sparsity_pattern.cc b/deal.II/source/lac/compressed_set_sparsity_pattern.cc index 6a99f09f16..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 <deal.II/lac/compressed_set_sparsity_pattern.h> @@ -46,8 +48,8 @@ CompressedSetSparsityPattern (const CompressedSetSparsityPattern &s) -CompressedSetSparsityPattern::CompressedSetSparsityPattern (const unsigned int m, - const unsigned int n) +CompressedSetSparsityPattern::CompressedSetSparsityPattern (const size_type m, + const size_type n) : rows(0), cols(0) @@ -57,7 +59,7 @@ CompressedSetSparsityPattern::CompressedSetSparsityPattern (const unsigned int m -CompressedSetSparsityPattern::CompressedSetSparsityPattern (const unsigned int n) +CompressedSetSparsityPattern::CompressedSetSparsityPattern (const size_type n) : rows(0), cols(0) @@ -82,8 +84,8 @@ CompressedSetSparsityPattern::operator = (const CompressedSetSparsityPattern &s) void -CompressedSetSparsityPattern::reinit (const unsigned int m, - const unsigned int n) +CompressedSetSparsityPattern::reinit (const size_type m, + const size_type n) { rows = m; cols = n; @@ -108,13 +110,13 @@ CompressedSetSparsityPattern::empty () const -unsigned int +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::max_entries_per_row () const { - unsigned int m = 0; - for (unsigned int i=0; i<rows; ++i) + size_type m = 0; + for (size_type i=0; i<rows; ++i) { - m = std::max (m, static_cast<unsigned int>(lines[i].entries.size())); + m = std::max (m, static_cast<size_type>(lines[i].entries.size())); } return m; @@ -123,8 +125,8 @@ CompressedSetSparsityPattern::max_entries_per_row () const bool -CompressedSetSparsityPattern::exists (const unsigned int i, - const unsigned int j) const +CompressedSetSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i<rows, ExcIndexRange(i, 0, rows)); Assert (j<cols, ExcIndexRange(j, 0, cols)); @@ -150,9 +152,9 @@ CompressedSetSparsityPattern::symmetrize () // 2. that the @p{add} function can // be called on elements that // already exist without any harm - for (unsigned int row=0; row<rows; ++row) + for (size_type row=0; row<rows; ++row) { - for (std::set<unsigned int>::const_iterator + for (std::set<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) @@ -170,11 +172,11 @@ CompressedSetSparsityPattern::print (std::ostream &out) const { AssertThrow (out, ExcIO()); - for (unsigned int row=0; row<rows; ++row) + for (size_type row=0; row<rows; ++row) { out << '[' << row; - for (std::set<unsigned int>::const_iterator + for (std::set<size_type >::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) out << ',' << *j; @@ -192,9 +194,9 @@ CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const { AssertThrow (out, ExcIO()); - for (unsigned int row=0; row<rows; ++row) + for (size_type row=0; row<rows; ++row) { - for (std::set<unsigned int>::const_iterator + for (std::set<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) // while matrix entries are usually @@ -211,16 +213,16 @@ CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::bandwidth () const { - unsigned int b=0; - for (unsigned int row=0; row<rows; ++row) + size_type b=0; + for (size_type row=0; row<rows; ++row) { - for (std::set<unsigned int>::const_iterator + for (std::set<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) - if (static_cast<unsigned int>(std::abs(static_cast<int>(row-*j))) > b) + if (static_cast<size_type>(std::abs(static_cast<int>(row-*j))) > b) b = std::abs(static_cast<signed int>(row-*j)); } @@ -229,11 +231,11 @@ CompressedSetSparsityPattern::bandwidth () const -unsigned int +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_nonzero_elements () const { - unsigned int n=0; - for (unsigned int i=0; i<rows; ++i) + size_type n=0; + for (size_type i=0; i<rows; ++i) { n += lines[i].entries.size(); } diff --git a/deal.II/source/lac/compressed_simple_sparsity_pattern.cc b/deal.II/source/lac/compressed_simple_sparsity_pattern.cc index 72e6164fa5..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 <deal.II/lac/compressed_simple_sparsity_pattern.h> #include <deal.II/base/memory_consumption.h> @@ -34,7 +36,7 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, if (n_elements <= 0) return; - const unsigned int stop_size = entries.size() + n_elements; + const size_type stop_size = entries.size() + n_elements; if (indices_are_sorted == true && n_elements > 3) { @@ -60,8 +62,8 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, // first entry is a duplicate before // actually doing something. ForwardIterator my_it = begin; - unsigned int col = *my_it; - std::vector<unsigned int>::iterator it = + size_type col = *my_it; + std::vector<size_type>::iterator it = Utilities::lower_bound(entries.begin(), entries.end(), col); while (*it == col) { @@ -90,14 +92,14 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, // resize vector by just inserting the // list - const unsigned int pos1 = it - entries.begin(); + const size_type pos1 = it - entries.begin(); Assert (pos1 <= entries.size(), ExcInternalError()); entries.insert (it, my_it, end); it = entries.begin() + pos1; - Assert (entries.size() >= (unsigned int)(it-entries.begin()), ExcInternalError()); + Assert (entries.size() >= (size_type)(it-entries.begin()), ExcInternalError()); // now merge the two lists. - std::vector<unsigned int>::iterator it2 = it + (end-my_it); + std::vector<size_type>::iterator it2 = it + (end-my_it); // as long as there are indices both in // the end of the entries list and in the @@ -125,7 +127,7 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, *it++ = *it2++; // resize and return - const unsigned int new_size = it - entries.begin(); + const size_type new_size = it - entries.begin(); Assert (new_size <= stop_size, ExcInternalError()); entries.resize (new_size); return; @@ -140,8 +142,8 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, if (stop_size > entries.capacity()) entries.reserve (stop_size); - unsigned int col = *my_it; - std::vector<unsigned int>::iterator it, it2; + size_type col = *my_it; + std::vector<size_type>::iterator it, it2; // insert the first element as for one // entry only first check the last // element (or if line is still empty) @@ -206,10 +208,10 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, } -std::size_t +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::Line::memory_consumption () const { - return entries.capacity()*sizeof(unsigned int)+sizeof(Line); + return entries.capacity()*sizeof(size_type)+sizeof(Line); } @@ -236,8 +238,8 @@ CompressedSimpleSparsityPattern (const CompressedSimpleSparsityPattern &s) -CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const unsigned int m, - const unsigned int n, +CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_type m, + const size_type n, const IndexSet &rowset_ ) : @@ -249,8 +251,17 @@ CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const unsigned } +CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const IndexSet &rowset_) + : + rows(0), + cols(0), + rowset(0) +{ + reinit (rowset_.size(), rowset_.size(), rowset_); +} + -CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const unsigned int n) +CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_type n) : rows(0), cols(0), @@ -276,8 +287,8 @@ CompressedSimpleSparsityPattern::operator = (const CompressedSimpleSparsityPatte void -CompressedSimpleSparsityPattern::reinit (const unsigned int m, - const unsigned int n, +CompressedSimpleSparsityPattern::reinit (const size_type m, + const size_type n, const IndexSet &rowset_) { rows = m; @@ -306,13 +317,13 @@ CompressedSimpleSparsityPattern::empty () const -unsigned int +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::max_entries_per_row () const { - unsigned int m = 0; - for (unsigned int i=0; i<lines.size(); ++i) + size_type m = 0; + for (size_type i=0; i<lines.size(); ++i) { - m = std::max (m, static_cast<unsigned int>(lines[i].entries.size())); + m = std::max (m, static_cast<size_type>(lines[i].entries.size())); } return m; @@ -321,14 +332,14 @@ CompressedSimpleSparsityPattern::max_entries_per_row () const bool -CompressedSimpleSparsityPattern::exists (const unsigned int i, - const unsigned int j) const +CompressedSimpleSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i<rows, ExcIndexRange(i, 0, rows)); Assert (j<cols, ExcIndexRange(j, 0, cols)); Assert( rowset.size()==0 || rowset.is_element(i), ExcInternalError()); - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? i : rowset.index_within_set(i); return std::binary_search (lines[rowindex].entries.begin(), @@ -354,12 +365,12 @@ CompressedSimpleSparsityPattern::symmetrize () // 2. that the @p{add} function can // be called on elements that // already exist without any harm - for (unsigned int row=0; row<lines.size(); ++row) + for (size_type row=0; row<lines.size(); ++row) { - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.nth_index_in_set(row); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) @@ -375,11 +386,11 @@ CompressedSimpleSparsityPattern::symmetrize () void CompressedSimpleSparsityPattern::print (std::ostream &out) const { - for (unsigned int row=0; row<lines.size(); ++row) + for (size_type row=0; row<lines.size(); ++row) { out << '[' << (rowset.size()==0 ? row : rowset.nth_index_in_set(row)); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type >::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) out << ',' << *j; @@ -395,12 +406,12 @@ CompressedSimpleSparsityPattern::print (std::ostream &out) const void CompressedSimpleSparsityPattern::print_gnuplot (std::ostream &out) const { - for (unsigned int row=0; row<lines.size(); ++row) + for (size_type row=0; row<lines.size(); ++row) { - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.nth_index_in_set(row); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type >::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) // while matrix entries are usually @@ -419,19 +430,19 @@ CompressedSimpleSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::bandwidth () const { - unsigned int b=0; - for (unsigned int row=0; row<lines.size(); ++row) + size_type b=0; + for (size_type row=0; row<lines.size(); ++row) { - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.nth_index_in_set(row); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) - if (static_cast<unsigned int>(std::abs(static_cast<int>(rowindex-*j))) > b) + if (static_cast<size_type>(std::abs(static_cast<int>(rowindex-*j))) > b) b = std::abs(static_cast<signed int>(rowindex-*j)); } @@ -440,11 +451,11 @@ CompressedSimpleSparsityPattern::bandwidth () const -unsigned int +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::n_nonzero_elements () const { - unsigned int n=0; - for (unsigned int i=0; i<lines.size(); ++i) + size_type n=0; + for (size_type i=0; i<lines.size(); ++i) { n += lines[i].entries.size(); } @@ -453,12 +464,12 @@ CompressedSimpleSparsityPattern::n_nonzero_elements () const } -std::size_t +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::memory_consumption () const { //TODO: IndexSet... - std::size_t mem = sizeof(CompressedSimpleSparsityPattern); - for (unsigned int i=0; i<lines.size(); ++i) + size_type mem = sizeof(CompressedSimpleSparsityPattern); + for (size_type i=0; i<lines.size(); ++i) mem += MemoryConsumption::memory_consumption (lines[i]); return mem; @@ -466,16 +477,16 @@ CompressedSimpleSparsityPattern::memory_consumption () const // explicit instantiations -template void CompressedSimpleSparsityPattern::Line::add_entries(unsigned int *, - unsigned int *, +template void CompressedSimpleSparsityPattern::Line::add_entries(size_type *, + size_type *, const bool); -template void CompressedSimpleSparsityPattern::Line::add_entries(const unsigned int *, - const unsigned int *, +template void CompressedSimpleSparsityPattern::Line::add_entries(const size_type *, + const size_type *, const bool); #ifndef DEAL_II_VECTOR_ITERATOR_IS_POINTER template void CompressedSimpleSparsityPattern::Line:: -add_entries(std::vector<unsigned int>::iterator, - std::vector<unsigned int>::iterator, +add_entries(std::vector<size_type>::iterator, + std::vector<size_type>::iterator, const bool); #endif diff --git a/deal.II/source/lac/compressed_sparsity_pattern.cc b/deal.II/source/lac/compressed_sparsity_pattern.cc index 391824fe61..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 <deal.II/lac/compressed_sparsity_pattern.h> @@ -151,7 +153,7 @@ CompressedSparsityPattern::Line::flush_cache () const ExcInternalError()); if (n_new_entries > entries.size()) { - std::vector<unsigned int> new_entries; + std::vector<types::global_dof_index> new_entries; new_entries.reserve (n_new_entries); unsigned int cache_position = 0; unsigned int entry_position = 0; @@ -265,7 +267,7 @@ CompressedSparsityPattern::Line::add_entries (ForwardIterator begin, ExcInternalError()); if (n_new_entries > entries.size()) { - std::vector<unsigned int> new_entries; + std::vector<types::global_dof_index> new_entries; new_entries.reserve (n_new_entries); ForwardIterator my_it = begin; unsigned int entry_position = 0; @@ -338,8 +340,8 @@ CompressedSparsityPattern (const CompressedSparsityPattern &s) -CompressedSparsityPattern::CompressedSparsityPattern (const unsigned int m, - const unsigned int n) +CompressedSparsityPattern::CompressedSparsityPattern (const size_type m, + const size_type n) : rows(0), cols(0) @@ -349,7 +351,7 @@ CompressedSparsityPattern::CompressedSparsityPattern (const unsigned int m, -CompressedSparsityPattern::CompressedSparsityPattern (const unsigned int n) +CompressedSparsityPattern::CompressedSparsityPattern (const size_type n) : rows(0), cols(0) @@ -374,8 +376,8 @@ CompressedSparsityPattern::operator = (const CompressedSparsityPattern &s) void -CompressedSparsityPattern::reinit (const unsigned int m, - const unsigned int n) +CompressedSparsityPattern::reinit (const size_type m, + const size_type n) { rows = m; cols = n; @@ -400,15 +402,15 @@ CompressedSparsityPattern::empty () const -unsigned int +CompressedSparsityPattern::size_type CompressedSparsityPattern::max_entries_per_row () const { - unsigned int m = 0; - for (unsigned int i=0; i<rows; ++i) + size_type m = 0; + for (size_type i=0; i<rows; ++i) { if (lines[i].cache_entries != 0) lines[i].flush_cache (); - m = std::max (m, static_cast<unsigned int>(lines[i].entries.size())); + m = std::max (m, static_cast<size_type>(lines[i].entries.size())); } return m; @@ -417,8 +419,8 @@ CompressedSparsityPattern::max_entries_per_row () const bool -CompressedSparsityPattern::exists (const unsigned int i, - const unsigned int j) const +CompressedSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i<rows, ExcIndexRange(i, 0, rows)); Assert (j<cols, ExcIndexRange(j, 0, cols)); @@ -448,11 +450,11 @@ CompressedSparsityPattern::symmetrize () // 2. that the @p{add} function can // be called on elements that // already exist without any harm - for (unsigned int row=0; row<rows; ++row) + for (size_type row=0; row<rows; ++row) { if (lines[row].cache_entries != 0) lines[row].flush_cache (); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) @@ -468,14 +470,14 @@ CompressedSparsityPattern::symmetrize () void CompressedSparsityPattern::print (std::ostream &out) const { - for (unsigned int row=0; row<rows; ++row) + for (size_type row=0; row<rows; ++row) { if (lines[row].cache_entries != 0) lines[row].flush_cache (); out << '[' << row; - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) out << ',' << *j; @@ -491,11 +493,11 @@ CompressedSparsityPattern::print (std::ostream &out) const void CompressedSparsityPattern::print_gnuplot (std::ostream &out) const { - for (unsigned int row=0; row<rows; ++row) + for (size_type row=0; row<rows; ++row) { if (lines[row].cache_entries != 0) lines[row].flush_cache (); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) // while matrix entries are usually @@ -511,19 +513,19 @@ CompressedSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +CompressedSparsityPattern::size_type CompressedSparsityPattern::bandwidth () const { - unsigned int b=0; - for (unsigned int row=0; row<rows; ++row) + size_type b=0; + for (size_type row=0; row<rows; ++row) { if (lines[row].cache_entries != 0) lines[row].flush_cache (); - for (std::vector<unsigned int>::const_iterator + for (std::vector<size_type>::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) - if (static_cast<unsigned int>(std::abs(static_cast<int>(row-*j))) > b) + if (static_cast<size_type>(std::abs(static_cast<int>(row-*j))) > b) b = std::abs(static_cast<signed int>(row-*j)); } @@ -532,11 +534,11 @@ CompressedSparsityPattern::bandwidth () const -unsigned int +CompressedSparsityPattern::size_type CompressedSparsityPattern::n_nonzero_elements () const { - unsigned int n=0; - for (unsigned int i=0; i<rows; ++i) + size_type n=0; + for (size_type i=0; i<rows; ++i) { if (lines[i].cache_entries != 0) lines[i].flush_cache (); @@ -548,16 +550,16 @@ CompressedSparsityPattern::n_nonzero_elements () const // explicit instantiations -template void CompressedSparsityPattern::Line::add_entries(unsigned int *, - unsigned int *, +template void CompressedSparsityPattern::Line::add_entries(size_type *, + size_type *, const bool); -template void CompressedSparsityPattern::Line::add_entries(const unsigned int *, - const unsigned int *, +template void CompressedSparsityPattern::Line::add_entries(const size_type *, + const size_type *, const bool); #ifndef DEAL_II_VECTOR_ITERATOR_IS_POINTER template void CompressedSparsityPattern::Line:: -add_entries(std::vector<unsigned int>::iterator, - std::vector<unsigned int>::iterator, +add_entries(std::vector<size_type>::iterator, + std::vector<size_type>::iterator, const bool); #endif diff --git a/deal.II/source/lac/constraint_matrix.cc b/deal.II/source/lac/constraint_matrix.cc index 3e7c63c384..099e3703d6 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 <deal.II/lac/constraint_matrix.h> #include <deal.II/lac/constraint_matrix.templates.h> @@ -54,7 +57,7 @@ const Table<2,bool> ConstraintMatrix::default_empty_table = Table<2,bool>(); bool -ConstraintMatrix::check_zero_weight (const std::pair<unsigned int, double> &p) +ConstraintMatrix::check_zero_weight (const std::pair<size_type, double> &p) { return (p.second == 0); } @@ -88,9 +91,9 @@ ConstraintMatrix::ConstraintLine::memory_consumption () const void -ConstraintMatrix::add_lines (const std::set<unsigned int> &lines) +ConstraintMatrix::add_lines (const std::set<size_type> &lines) { - for (std::set<unsigned int>::const_iterator + for (std::set<size_type>::const_iterator i = lines.begin(); i != lines.end(); ++i) add_line (*i); } @@ -100,7 +103,7 @@ ConstraintMatrix::add_lines (const std::set<unsigned int> &lines) void ConstraintMatrix::add_lines (const std::vector<bool> &lines) { - for (unsigned int i=0; i<lines.size(); ++i) + for (size_type i=0; i<lines.size(); ++i) if (lines[i] == true) add_line (i); } @@ -110,7 +113,7 @@ ConstraintMatrix::add_lines (const std::vector<bool> &lines) void ConstraintMatrix::add_lines (const IndexSet &lines) { - for (unsigned int i=0; i<lines.n_elements(); ++i) + for (size_type i=0; i<lines.n_elements(); ++i) add_line (lines.nth_index_in_set(i)); } @@ -118,8 +121,8 @@ ConstraintMatrix::add_lines (const IndexSet &lines) void ConstraintMatrix::add_entries -(const unsigned int line, - const std::vector<std::pair<unsigned int,double> > &col_val_pairs) +(const size_type line, + const std::vector<std::pair<size_type,double> > &col_val_pairs) { Assert (sorted==false, ExcMatrixIsClosed()); Assert (is_constrained(line), ExcLineInexistant(line)); @@ -132,7 +135,7 @@ ConstraintMatrix::add_entries // // in any case: skip this entry if an entry for this column already // exists, since we don't want to enter it twice - for (std::vector<std::pair<unsigned int,double> >::const_iterator + for (std::vector<std::pair<size_type,double> >::const_iterator col_val_pair = col_val_pairs.begin(); col_val_pair!=col_val_pairs.end(); ++col_val_pair) { @@ -170,10 +173,10 @@ void ConstraintMatrix::add_selected_constraints line!=constraints.lines.end(); ++line) if (filter.is_element(line->line)) { - const unsigned int row = filter.index_within_set (line->line); + const size_type row = filter.index_within_set (line->line); add_line (row); set_inhomogeneity (row, line->inhomogeneity); - for (unsigned int i=0; i<line->entries.size(); ++i) + for (size_type i=0; i<line->entries.size(); ++i) if (filter.is_element(line->entries[i].first)) add_entry (row, filter.index_within_set (line->entries[i].first), line->entries[i].second); @@ -193,9 +196,9 @@ void ConstraintMatrix::close () // update list of pointers and give the vector a sharp size since we // won't modify the size any more after this point. { - std::vector<unsigned int> new_lines (lines_cache.size(), - numbers::invalid_unsigned_int); - unsigned int counter = 0; + std::vector<size_type> new_lines (lines_cache.size(), + numbers::invalid_size_type); + size_type counter = 0; for (std::vector<ConstraintLine>::const_iterator line=lines.begin(); line!=lines.end(); ++line, ++counter) new_lines[calculate_line_index(line->line)] = counter; @@ -203,8 +206,8 @@ void ConstraintMatrix::close () } // in debug mode: check whether we really set the pointers correctly. - for (unsigned int i=0; i<lines_cache.size(); ++i) - if (lines_cache[i] != numbers::invalid_unsigned_int) + for (size_type i=0; i<lines_cache.size(); ++i) + if (lines_cache[i] != numbers::invalid_size_type) Assert (i == calculate_line_index(lines[lines_cache[i]].line), ExcInternalError()); @@ -229,7 +232,7 @@ void ConstraintMatrix::close () // Let us figure out the largest dof index. This is an upper bound for the // number of constraints because it is an approximation for the number of dofs // in our system. - unsigned int largest_idx = 0; + size_type largest_idx = 0; for (std::vector<ConstraintLine>::iterator line = lines.begin(); line!=lines.end(); ++line) { @@ -252,7 +255,7 @@ void ConstraintMatrix::close () // we sort the list so that throwing out duplicates becomes much more // efficient. also, we have to do it only once, rather than in each // iteration - unsigned int iteration = 0; + size_type iteration = 0; while (true) { bool chained_constraint_replaced = false; @@ -263,14 +266,14 @@ void ConstraintMatrix::close () #ifdef DEBUG // we need to keep track of how many replacements we do in this line, because we can // end up in a cycle A->B->C->A without the number of entries growing. - unsigned int n_replacements = 0; + size_type n_replacements = 0; #endif // loop over all entries of this line (including ones that we // have appended in this go around) and see whether they are // further constrained. ignore elements that we don't store on // the current processor - unsigned int entry = 0; + size_type entry = 0; while (entry < line->entries.size()) if (((local_lines.size() == 0) || @@ -282,8 +285,8 @@ void ConstraintMatrix::close () chained_constraint_replaced = true; // look up the chain of constraints for this entry - const unsigned int dof_index = line->entries[entry].first; - const double weight = line->entries[entry].second; + const size_type dof_index = line->entries[entry].first; + const double weight = line->entries[entry].second; Assert (dof_index != line->line, ExcMessage ("Cycle in constraints detected!")); @@ -303,7 +306,7 @@ void ConstraintMatrix::close () // of other dofs: if (constrained_line->entries.size() > 0) { - for (unsigned int i=0; i<constrained_line->entries.size(); ++i) + for (size_type i=0; i<constrained_line->entries.size(); ++i) Assert (dof_index != constrained_line->entries[i].first, ExcMessage ("Cycle in constraints detected!")); @@ -314,7 +317,7 @@ void ConstraintMatrix::close () constrained_line->entries[0].second * weight); - for (unsigned int i=1; i<constrained_line->entries.size(); ++i) + for (size_type i=1; i<constrained_line->entries.size(); ++i) line->entries .push_back (std::make_pair (constrained_line->entries[i].first, constrained_line->entries[i].second * @@ -378,8 +381,8 @@ void ConstraintMatrix::close () // references the same dofs more than once in order to find how many // non-duplicate entries we have. This lets us allocate the correct // amount of memory for the constraint entries. - unsigned int duplicates = 0; - for (unsigned int i=1; i<line->entries.size(); ++i) + size_type duplicates = 0; + for (size_type i=1; i<line->entries.size(); ++i) if (line->entries[i].first == line->entries[i-1].first) duplicates++; @@ -397,7 +400,7 @@ void ConstraintMatrix::close () // resolve the duplicates new_entries.reserve (line->entries.size() - duplicates); new_entries.push_back(line->entries[0]); - for (unsigned int j=1; j<line->entries.size(); ++j) + for (size_type j=1; j<line->entries.size(); ++j) if (line->entries[j].first == line->entries[j-1].first) { Assert (new_entries.back().first == line->entries[j].first, @@ -412,7 +415,7 @@ void ConstraintMatrix::close () // make sure there are really no duplicates left and that the // list is still sorted - for (unsigned int j=1; j<new_entries.size(); ++j) + for (size_type j=1; j<new_entries.size(); ++j) { Assert (new_entries[j].first != new_entries[j-1].first, ExcInternalError()); @@ -436,11 +439,11 @@ void ConstraintMatrix::close () // precomputed tables. in this case, the interpolation weights are // also subject to round-off double sum = 0; - for (unsigned int i=0; i<line->entries.size(); ++i) + for (size_type i=0; i<line->entries.size(); ++i) sum += line->entries[i].second; if ((sum != 1.0) && (std::fabs (sum-1.) < 1.e-13)) { - for (unsigned int i=0; i<line->entries.size(); ++i) + for (size_type i=0; i<line->entries.size(); ++i) line->entries[i].second /= sum; line->inhomogeneity /= sum; } @@ -484,7 +487,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, if (other_constraints.lines_cache.size() > lines_cache.size()) lines_cache.resize(other_constraints.lines_cache.size(), - numbers::invalid_unsigned_int); + numbers::invalid_size_type); // first action is to fold into the present object possible constraints // in the second object. we don't strictly need to do this any more since @@ -499,7 +502,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, line!=lines.end(); ++line) { tmp.clear (); - for (unsigned int i=0; i<line->entries.size(); ++i) + for (size_type i=0; i<line->entries.size(); ++i) { // if the present dof is not constrained, or if we won't take the // constraint from the other object, then simply copy it over @@ -525,8 +528,8 @@ 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<unsigned int,double>(j->first, - j->second*weight)); + tmp.push_back (std::pair<size_type,double>(j->first, + j->second*weight)); line->inhomogeneity += other_constraints.get_inhomogeneity(line->entries[i].first) * weight; @@ -574,7 +577,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, } // update the lines cache - unsigned int counter = 0; + size_type counter = 0; for (std::vector<ConstraintLine>::const_iterator line=lines.begin(); line!=lines.end(); ++line, ++counter) lines_cache[calculate_line_index(line->line)] = counter; @@ -587,13 +590,13 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, -void ConstraintMatrix::shift (const unsigned int offset) +void ConstraintMatrix::shift (const size_type offset) { //TODO: this doesn't work with IndexSets yet. [TH] AssertThrow(local_lines.size()==0, ExcNotImplemented()); lines_cache.insert (lines_cache.begin(), offset, - numbers::invalid_unsigned_int); + numbers::invalid_size_type); for (std::vector<ConstraintLine>::iterator i = lines.begin(); i != lines.end(); ++i) @@ -616,7 +619,7 @@ void ConstraintMatrix::clear () } { - std::vector<unsigned int> tmp; + std::vector<size_type> tmp; lines_cache.swap (tmp); } @@ -642,20 +645,24 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // store for each line of the matrix its new line number after // compression. If the shift is -1, this line will be condensed away +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE std::vector<int> new_line; +#else + std::vector<long long int> new_line; +#endif new_line.reserve (uncondensed.n_rows()); std::vector<ConstraintLine>::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - unsigned int n_rows = uncondensed.n_rows(); + size_type shift = 0; + size_type n_rows = uncondensed.n_rows(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -666,7 +673,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, if (next_constraint == lines.end()) // nothing more to do; finish rest of loop { - for (unsigned int i=row+1; i<n_rows; ++i) + for (size_type i=row+1; i<n_rows; ++i) new_line.push_back (i-shift); break; }; @@ -679,7 +686,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // note: in this loop we need not check whether @p{next_constraint} is a // valid iterator, since @p{next_constraint} is only evaluated so often as // there are entries in new_line[*] which tells us which constraints exist - for (unsigned int row=0; row<uncondensed.n_rows(); ++row) + for (size_type row=0; row<uncondensed.n_rows(); ++row) if (new_line[row] != -1) // line not constrained copy entries if column will not be condensed // away, distribute otherwise @@ -694,7 +701,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, while (c->line != j->column()) ++c; - for (unsigned int q=0; q!=c->entries.size(); ++q) + for (size_type q=0; q!=c->entries.size(); ++q) condensed.add (new_line[row], new_line[c->entries[q].first]); } else @@ -705,7 +712,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // for each entry: distribute if (new_line[j->column()] != -1) // column is not constrained - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[j->column()]); @@ -718,8 +725,8 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, std::vector<ConstraintLine>::const_iterator c = lines.begin(); while (c->line != j->column()) ++c; - for (unsigned int p=0; p!=c->entries.size(); ++p) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type p=0; p!=c->entries.size(); ++p) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[c->entries[p].first]); }; @@ -742,16 +749,16 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) { // regular line. loop over cols all valid cols. note that this // changes the line we are presently working on: we add additional @@ -762,20 +769,20 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const // the last old entry and stop work there, but since operating on // the newly added ones only takes two comparisons (column index // valid, distribute[column] necessarily - // ==numbers::invalid_unsigned_int), it is cheaper to not do so and + // ==numbers::invalid_size_type), it is cheaper to not do so and // run right until the end of the line for (SparsityPattern::iterator entry = sparsity.begin(row); ((entry != sparsity.end(row)) && entry->is_valid_entry()); ++entry) { - const unsigned int column = entry->column(); + const size_type column = entry->column(); - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) { // distribute entry at regular row @p{row} and irregular // column sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) sparsity.add (row, @@ -790,19 +797,19 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const for (SparsityPattern::iterator entry = sparsity.begin(row); (entry != sparsity.end(row)) && entry->is_valid_entry(); ++entry) { - const unsigned int column = entry->column(); - if (distribute[column] == numbers::invalid_unsigned_int) + const size_type column = entry->column(); + if (distribute[column] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and regular // column sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, column); else // distribute entry at irregular row @p{row} and irregular // column sparsity.get_column_numbers()[j] - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, lines[distribute[column]].entries[q].first); @@ -825,23 +832,23 @@ void ConstraintMatrix::condense (CompressedSparsityPattern &sparsity) const // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over cols. note that as we proceed to // distribute cols, the loop may get longer - for (unsigned int j=0; j<sparsity.row_length(row); ++j) + for (size_type j=0; j<sparsity.row_length(row); ++j) { - const unsigned int column = sparsity.column_number(row,j); + const size_type column = sparsity.column_number(row,j); - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) { // distribute entry at regular row @p{row} and irregular // column column. note that this changes the line we are @@ -859,17 +866,17 @@ void ConstraintMatrix::condense (CompressedSparsityPattern &sparsity) const // one to the right in the case that we add an entry up // front that did not exist before. check whether it // existed before by tracking the length of this row - unsigned int old_rowlength = sparsity.row_length(row); - for (unsigned int q=0; + size_type old_rowlength = sparsity.row_length(row); + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) { - const unsigned int + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); - const unsigned int new_rowlength = sparsity.row_length(row); + const size_type new_rowlength = sparsity.row_length(row); if ((new_col < column) && (old_rowlength != new_rowlength)) ++j; old_rowlength = new_rowlength; @@ -878,22 +885,22 @@ void ConstraintMatrix::condense (CompressedSparsityPattern &sparsity) const } else // row must be distributed - for (unsigned int j=0; j<sparsity.row_length(row); ++j) + for (size_type j=0; j<sparsity.row_length(row); ++j) { - const unsigned int column = sparsity.column_number(row,j); + const size_type column = sparsity.column_number(row,j); - if (distribute[column] == numbers::invalid_unsigned_int) + if (distribute[column] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and regular // column sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, column); else // distribute entry at irregular row @p{row} and irregular // column sparsity.get_column_numbers()[j] - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type q=0; q!=lines[distribute[sparsity.column_number(row,j)]] .entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, @@ -915,16 +922,16 @@ void ConstraintMatrix::condense (CompressedSetSparsityPattern &sparsity) const // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) { // regular line. loop over cols. note that as we proceed to // distribute cols, the loop may get longer @@ -932,16 +939,16 @@ void ConstraintMatrix::condense (CompressedSetSparsityPattern &sparsity) const for (; col_num != sparsity.row_end (row); ++col_num) { - const unsigned int column = *col_num; + const size_type column = *col_num; - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) { // row - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) { - const unsigned int + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); @@ -956,20 +963,20 @@ void ConstraintMatrix::condense (CompressedSetSparsityPattern &sparsity) const for (; col_num != sparsity.row_end (row); ++col_num) { - const unsigned int column = *col_num; + const size_type column = *col_num; - if (distribute[column] == numbers::invalid_unsigned_int) + if (distribute[column] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and regular // column sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, column); else // distribute entry at irregular row @p{row} and irregular // column sparsity.get_column_numbers()[j] - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type q=0; q!=lines[distribute[column]] .entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, @@ -992,23 +999,23 @@ void ConstraintMatrix::condense (CompressedSimpleSparsityPattern &sparsity) cons // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over cols. note that as we proceed to // distribute cols, the loop may get longer - for (unsigned int j=0; j<sparsity.row_length(row); ++j) + for (size_type j=0; j<sparsity.row_length(row); ++j) { - const unsigned int column = sparsity.column_number(row,j); + const size_type column = sparsity.column_number(row,j); - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) { // distribute entry at regular row @p{row} and irregular // column column. note that this changes the line we are @@ -1026,17 +1033,17 @@ void ConstraintMatrix::condense (CompressedSimpleSparsityPattern &sparsity) cons // one to the right in the case that we add an entry up // front that did not exist before. check whether it // existed before by tracking the length of this row - unsigned int old_rowlength = sparsity.row_length(row); - for (unsigned int q=0; + size_type old_rowlength = sparsity.row_length(row); + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) { - const unsigned int + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); - const unsigned int new_rowlength = sparsity.row_length(row); + const size_type new_rowlength = sparsity.row_length(row); if ((new_col < column) && (old_rowlength != new_rowlength)) ++j; old_rowlength = new_rowlength; @@ -1045,22 +1052,22 @@ void ConstraintMatrix::condense (CompressedSimpleSparsityPattern &sparsity) cons } else // row must be distributed - for (unsigned int j=0; j<sparsity.row_length(row); ++j) + for (size_type j=0; j<sparsity.row_length(row); ++j) { - const unsigned int column = sparsity.column_number(row,j); + const size_type column = sparsity.column_number(row,j); - if (distribute[column] == numbers::invalid_unsigned_int) + if (distribute[column] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and regular // column sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, column); else // distribute entry at irregular row @p{row} and irregular // column sparsity.get_column_numbers()[j] - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type q=0; q!=lines[distribute[sparsity.column_number(row,j)]] .entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, @@ -1086,34 +1093,34 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const const BlockIndices & index_mapping = sparsity.get_column_indices(); - const unsigned int n_blocks = sparsity.n_block_rows(); + const size_type n_blocks = sparsity.n_block_rows(); // store for each index whether it must be distributed or not. If entry // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = c; - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { // get index of this row within the blocks - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; + const size_type block_row = block_index.first; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over all columns and see whether this column // must be distributed { // to loop over all entries in this row, we have to loop over all // blocks in this blockrow and the corresponding row therein - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const SparsityPattern & block_sparsity = sparsity.block(block_row, block_col); @@ -1124,14 +1131,14 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const entry->is_valid_entry(); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col, entry->column()); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at regular row @p{row} and // irregular column global_col { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (row, lines[distribute[global_col]].entries[q].first); @@ -1143,7 +1150,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const { // row must be distributed. split the whole row into the chunks // defined by the blocks - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const SparsityPattern & block_sparsity = sparsity.block(block_row,block_col); @@ -1154,22 +1161,22 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const entry->is_valid_entry(); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, entry->column()); - if (distribute[global_col] == numbers::invalid_unsigned_int) + if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and // regular column global_col. { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); } else // distribute entry at irregular row @p{row} and // irregular column @p{global_col} { - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + 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, lines[distribute[global_col]].entries[q].first); } @@ -1196,28 +1203,28 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const const BlockIndices & index_mapping = sparsity.get_column_indices(); - const unsigned int n_blocks = sparsity.n_block_rows(); + const size_type n_blocks = sparsity.n_block_rows(); // store for each index whether it must be distributed or not. If entry // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = static_cast<signed int>(c); - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { // get index of this row within the blocks - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; - const unsigned int local_row = block_index.second; + const size_type block_row = block_index.first; + const size_type local_row = block_index.second; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over all columns and see whether this column // must be distributed. note that as we proceed to distribute cols, // the loop over cols may get longer. @@ -1230,22 +1237,22 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const // to loop over all entries in this row, we have to loop over all // blocks in this blockrow and the corresponding row therein - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const CompressedSparsityPattern & block_sparsity = sparsity.block(block_row, block_col); - for (unsigned int j=0; j<block_sparsity.row_length(local_row); ++j) + for (size_type j=0; j<block_sparsity.row_length(local_row); ++j) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col, block_sparsity.column_number(local_row,j)); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at regular row @p{row} and // irregular column global_col { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]] .entries.size(); ++q) sparsity.add (row, @@ -1258,22 +1265,22 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const { // row must be distributed. split the whole row into the chunks // defined by the blocks - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const CompressedSparsityPattern & block_sparsity = sparsity.block(block_row,block_col); - for (unsigned int j=0; j<block_sparsity.row_length(local_row); ++j) + for (size_type j=0; j<block_sparsity.row_length(local_row); ++j) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, block_sparsity.column_number(local_row,j)); - if (distribute[global_col] == numbers::invalid_unsigned_int) + if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and // regular column global_col. { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); } @@ -1281,8 +1288,8 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const // distribute entry at irregular row @p{row} and // irregular column @p{global_col} { - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + 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, lines[distribute[global_col]].entries[q].first); }; @@ -1307,28 +1314,28 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co const BlockIndices & index_mapping = sparsity.get_column_indices(); - const unsigned int n_blocks = sparsity.n_block_rows(); + const size_type n_blocks = sparsity.n_block_rows(); // store for each index whether it must be distributed or not. If entry // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = static_cast<signed int>(c); - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { // get index of this row within the blocks - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; - const unsigned int local_row = block_index.second; + const size_type block_row = block_index.first; + const size_type local_row = block_index.second; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over all columns and see whether this column // must be distributed. note that as we proceed to distribute cols, // the loop over cols may get longer. @@ -1341,7 +1348,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co // to loop over all entries in this row, we have to loop over all // blocks in this blockrow and the corresponding row therein - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const CompressedSetSparsityPattern & block_sparsity = sparsity.block(block_row, block_col); @@ -1350,14 +1357,14 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co j = block_sparsity.row_begin(local_row); j != block_sparsity.row_end(local_row); ++j) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col, *j); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at regular row @p{row} and // irregular column global_col { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]] .entries.size(); ++q) sparsity.add (row, @@ -1370,7 +1377,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co { // row must be distributed. split the whole row into the chunks // defined by the blocks - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const CompressedSetSparsityPattern & block_sparsity = sparsity.block(block_row,block_col); @@ -1379,14 +1386,14 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co j = block_sparsity.row_begin(local_row); j != block_sparsity.row_end(local_row); ++j) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, *j); - if (distribute[global_col] == numbers::invalid_unsigned_int) + if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and // regular column global_col. { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); } @@ -1394,8 +1401,8 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co // distribute entry at irregular row @p{row} and // irregular column @p{global_col} { - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + 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, lines[distribute[global_col]].entries[q].first); }; @@ -1420,28 +1427,28 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) const BlockIndices & index_mapping = sparsity.get_column_indices(); - const unsigned int n_blocks = sparsity.n_block_rows(); + const size_type n_blocks = sparsity.n_block_rows(); // store for each index whether it must be distributed or not. If entry // is numbers::invalid_unsigned_int, no distribution is necessary. // otherwise, the number states which line in the constraint matrix // handles this index - std::vector<unsigned int> distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector<size_type> distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c<lines.size(); ++c) + for (size_type c=0; c<lines.size(); ++c) distribute[lines[c].line] = static_cast<signed int>(c); - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row<n_rows; ++row) + const size_type n_rows = sparsity.n_rows(); + for (size_type row=0; row<n_rows; ++row) { // get index of this row within the blocks - const std::pair<unsigned int,unsigned int> + const std::pair<size_type,size_type> block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; - const unsigned int local_row = block_index.second; + const size_type block_row = block_index.first; + const size_type local_row = block_index.second; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over all columns and see whether this column // must be distributed. note that as we proceed to distribute cols, // the loop over cols may get longer. @@ -1454,22 +1461,22 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) // to loop over all entries in this row, we have to loop over all // blocks in this blockrow and the corresponding row therein - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const CompressedSimpleSparsityPattern & block_sparsity = sparsity.block(block_row, block_col); - for (unsigned int j=0; j<block_sparsity.row_length(local_row); ++j) + for (size_type j=0; j<block_sparsity.row_length(local_row); ++j) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col, block_sparsity.column_number(local_row,j)); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at regular row @p{row} and // irregular column global_col { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]] .entries.size(); ++q) sparsity.add (row, @@ -1482,21 +1489,22 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) { // row must be distributed. split the whole row into the chunks // defined by the blocks - for (unsigned int block_col=0; block_col<n_blocks; ++block_col) + for (size_type block_col=0; block_col<n_blocks; ++block_col) { const CompressedSimpleSparsityPattern & block_sparsity = sparsity.block(block_row,block_col); - for (unsigned int j=0; j<block_sparsity.row_length(local_row); ++j) + for (size_type j=0; j<block_sparsity.row_length(local_row); ++j) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, block_sparsity.column_number(local_row,j)); - if (distribute[global_col] == numbers::invalid_unsigned_int) + if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and // regular column global_col. - { for (unsigned int q=0; + { + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); @@ -1504,9 +1512,10 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) else // distribute entry at irregular row @p{row} and // irregular column @p{global_col} - { for (unsigned int p=0; + { + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, lines[distribute[global_col]].entries[q].first); }; @@ -1518,7 +1527,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) -bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const +bool ConstraintMatrix::is_identity_constrained (const size_type index) const { if (is_constrained(index) == false) return false; @@ -1534,15 +1543,16 @@ bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const -unsigned int ConstraintMatrix::max_constraint_indirections () const +ConstraintMatrix::size_type +ConstraintMatrix::max_constraint_indirections () const { - unsigned int return_value = 0; + size_type return_value = 0; for (std::vector<ConstraintLine>::const_iterator i=lines.begin(); i!=lines.end(); ++i) // use static cast, since typeof(size)==std::size_t, which is != - // unsigned int on AIX + // size_type on AIX return_value = std::max(return_value, - static_cast<unsigned int>(i->entries.size())); + static_cast<size_type>(i->entries.size())); return return_value; } @@ -1562,12 +1572,12 @@ bool ConstraintMatrix::has_inhomogeneities () const void ConstraintMatrix::print (std::ostream &out) const { - for (unsigned int i=0; i!=lines.size(); ++i) + for (size_type i=0; i!=lines.size(); ++i) { // output the list of constraints as pairs of dofs and their weights if (lines[i].entries.size() > 0) { - for (unsigned int j=0; j<lines[i].entries.size(); ++j) + for (size_type j=0; j<lines[i].entries.size(); ++j) out << " " << lines[i].line << " " << lines[i].entries[j].first << ": " << lines[i].entries[j].second << "\n"; @@ -1601,11 +1611,11 @@ ConstraintMatrix::write_dot (std::ostream &out) const { out << "digraph constraints {" << std::endl; - for (unsigned int i=0; i!=lines.size(); ++i) + for (size_type i=0; i!=lines.size(); ++i) { // same concept as in the previous function if (lines[i].entries.size() > 0) - for (unsigned int j=0; j<lines[i].entries.size(); ++j) + for (size_type j=0; j<lines[i].entries.size(); ++j) out << " " << lines[i].line << "->" << lines[i].entries[j].first << "; // weight: " << lines[i].entries[j].second @@ -1655,7 +1665,7 @@ ConstraintMatrix::memory_consumption () const VectorType &condensed_vector) const; \ template void ConstraintMatrix:: \ distribute_local_to_global<VectorType > (const Vector<double> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ VectorType &, \ const FullMatrix<double> &) const; \ template void ConstraintMatrix::distribute<VectorType >(const VectorType &condensed,\ @@ -1664,7 +1674,7 @@ ConstraintMatrix::memory_consumption () const #define PARALLEL_VECTOR_FUNCTIONS(VectorType) \ template void ConstraintMatrix:: \ distribute_local_to_global<VectorType > (const Vector<double> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ VectorType &, \ const FullMatrix<double> &) const @@ -1683,7 +1693,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global<MatrixType,VectorType > (const FullMatrix<double> &, \ const Vector<double> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ MatrixType &, \ VectorType &, \ bool , \ @@ -1692,7 +1702,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global<MatrixType,Vector<double> > (const FullMatrix<double> &, \ const Vector<double> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ MatrixType &, \ Vector<double> &, \ bool , \ @@ -1701,7 +1711,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global<MatrixType,VectorType > (const FullMatrix<double> &, \ const Vector<double> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ MatrixType &, \ VectorType &, \ bool , \ @@ -1710,7 +1720,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global<MatrixType,Vector<double> > (const FullMatrix<double> &, \ const Vector<double> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ MatrixType &, \ Vector<double> &, \ bool , \ @@ -1761,27 +1771,27 @@ BLOCK_MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix, TrilinosWrapp #define SPARSITY_FUNCTIONS(SparsityType) \ template void ConstraintMatrix::add_entries_local_to_global<SparsityType> (\ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ SparsityType &, \ const bool, \ const Table<2,bool> &, \ internal::bool2type<false>) const; \ template void ConstraintMatrix::add_entries_local_to_global<SparsityType> (\ - const std::vector<unsigned int> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ SparsityType &, \ const bool, \ const Table<2,bool> &) const #define BLOCK_SPARSITY_FUNCTIONS(SparsityType) \ template void ConstraintMatrix::add_entries_local_to_global<SparsityType> (\ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ SparsityType &, \ const bool, \ const Table<2,bool> &, \ internal::bool2type<true>) const; \ template void ConstraintMatrix::add_entries_local_to_global<SparsityType> (\ - const std::vector<unsigned int> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ SparsityType &, \ const bool, \ const Table<2,bool> &) const @@ -1804,8 +1814,8 @@ BLOCK_SPARSITY_FUNCTIONS(TrilinosWrappers::BlockSparsityPattern); #define ONLY_MATRIX_FUNCTIONS(MatrixType) \ template void ConstraintMatrix::distribute_local_to_global<MatrixType > (\ const FullMatrix<double> &, \ - const std::vector<unsigned int> &, \ - const std::vector<unsigned int> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ + const std::vector<ConstraintMatrix::size_type> &, \ MatrixType &) const ONLY_MATRIX_FUNCTIONS(SparseMatrix<float>); diff --git a/deal.II/source/lac/constraint_matrix.inst.in b/deal.II/source/lac/constraint_matrix.inst.in index 1a69fff4a2..6320aaa188 100644 --- a/deal.II/source/lac/constraint_matrix.inst.in +++ b/deal.II/source/lac/constraint_matrix.inst.in @@ -1,9 +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. +// +// --------------------------------------------------------------------- + for (S: REAL_SCALARS; T : DEAL_II_VEC_TEMPLATES) { template void ConstraintMatrix::condense<T<S> >(const T<S> &, T<S> &) const; template void ConstraintMatrix::condense<T<S> >(T<S> &vec) const; template void ConstraintMatrix::distribute_local_to_global<T<S> > ( - const Vector<double>&, const std::vector<unsigned int> &, T<S> &, const FullMatrix<double>&) const; + const Vector<double>&, const std::vector<types::global_dof_index> &, T<S> &, const FullMatrix<double>&) const; template void ConstraintMatrix::distribute<T<S> >(const T<S> &, T<S> &) const; template void ConstraintMatrix::set_zero<T<S> >(T<S> &) const; } @@ -14,7 +30,7 @@ for (S: REAL_SCALARS; T : DEAL_II_VEC_TEMPLATES) template void ConstraintMatrix::condense<parallel::distributed::T<S> >(const parallel::distributed::T<S> &, parallel::distributed::T<S> &) const; template void ConstraintMatrix::condense<parallel::distributed::T<S> >(parallel::distributed::T<S> &vec) const; template void ConstraintMatrix::distribute_local_to_global<parallel::distributed::T<S> > ( - const Vector<double>&, const std::vector<unsigned int> &, parallel::distributed::T<S> &, const FullMatrix<double>&) const; + const Vector<double>&, const std::vector<types::global_dof_index> &, parallel::distributed::T<S> &, const FullMatrix<double>&) const; template void ConstraintMatrix::distribute<parallel::distributed::T<S> >(const parallel::distributed::T<S> &, parallel::distributed::T<S> &) const; template void ConstraintMatrix::set_zero<parallel::distributed::T<S> >(parallel::distributed::T<S> &) const; } @@ -25,7 +41,7 @@ for (V: EXTERNAL_SEQUENTIAL_VECTORS) template void ConstraintMatrix::condense<V >(const V&, V&) const; template void ConstraintMatrix::condense<V >(V&vec) const; template void ConstraintMatrix::distribute_local_to_global<V > ( - const Vector<double>&, const std::vector<unsigned int> &, V&, const FullMatrix<double>&) const; + const Vector<double>&, const std::vector<types::global_dof_index> &, V&, const FullMatrix<double>&) const; template void ConstraintMatrix::distribute<V >(const V&, V&) const; template void ConstraintMatrix::set_zero<V >(V&) 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 <deal.II/base/logstream.h> #include <deal.II/lac/full_matrix.templates.h> diff --git a/deal.II/source/lac/full_matrix.inst.in b/deal.II/source/lac/full_matrix.inst.in index 47db43ec24..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) @@ -22,22 +26,22 @@ for (S : REAL_SCALARS) std::ostream&, const unsigned int, const unsigned int) const; template void FullMatrix<S>::copy_from<1>( - const Tensor<2,1>&, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned); + const Tensor<2,1>&, const size_type, const size_type, const size_type, const size_type, const size_type, const size_type); template void FullMatrix<S>::copy_from<2>( - const Tensor<2,2>&, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned); + const Tensor<2,2>&, const size_type, const size_type, const size_type, const size_type, const size_type, const size_type); template void FullMatrix<S>::copy_from<3>( - const Tensor<2,3>&, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned); + const Tensor<2,3>&, const size_type, const size_type, const size_type, const size_type, const size_type, const size_type); template void FullMatrix<S>::copy_to<1>( - Tensor<2,1>&, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned) const; + Tensor<2,1>&, const size_type, const size_type, const size_type, const size_type, const size_type, const size_type) const; template void FullMatrix<S>::copy_to<2>( - Tensor<2,2>&, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned) const; + Tensor<2,2>&, const size_type, const size_type, const size_type, const size_type, const size_type, const size_type) const; template void FullMatrix<S>::copy_to<3>( - Tensor<2,3>&, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned, const unsigned) const; + Tensor<2,3>&, const size_type, const size_type, const size_type, const size_type, const size_type, const size_type) const; } for (S1, S2 : REAL_SCALARS) @@ -47,7 +51,7 @@ for (S1, S2 : REAL_SCALARS) template void FullMatrix<S1>::fill<S2> ( - const FullMatrix<S2>&, unsigned, unsigned, unsigned, unsigned); + const FullMatrix<S2>&, types::global_dof_index, types::global_dof_index, types::global_dof_index, types::global_dof_index); template void FullMatrix<S1>::add<S2> (const S1, const FullMatrix<S2>&); template @@ -59,12 +63,12 @@ for (S1, S2 : REAL_SCALARS) const S1, const FullMatrix<S2>&); template void FullMatrix<S1>::add<S2> ( - const FullMatrix<S2>&, S1, unsigned, unsigned,unsigned, unsigned); + const FullMatrix<S2>&, S1, types::global_dof_index, types::global_dof_index, types::global_dof_index, types::global_dof_index); template void FullMatrix<S1>::Tadd<S2> (const S1, const FullMatrix<S2>&); template void FullMatrix<S1>::Tadd<S2> ( - const FullMatrix<S2>&, S1, unsigned, unsigned, unsigned, unsigned); + const FullMatrix<S2>&, S1, types::global_dof_index, types::global_dof_index, types::global_dof_index, types::global_dof_index); template void FullMatrix<S1>::equ<S2> (const S1, const FullMatrix<S2>&); template @@ -93,8 +97,8 @@ for (S1, S2 : REAL_SCALARS) template void FullMatrix<S1>::fill_permutation<S2> ( const FullMatrix<S2>&, - const std::vector<unsigned int>&, - const std::vector<unsigned int>&); + const std::vector<size_type>&, + const std::vector<size_type>&); template void FullMatrix<S1>::vmult<S2>( Vector<S2>&, const Vector<S2>&, bool) const; @@ -155,7 +159,7 @@ for (S1, S2 : COMPLEX_SCALARS) { template void FullMatrix<S1>::fill<S2> ( - const FullMatrix<S2>&, unsigned, unsigned, unsigned, unsigned); + const FullMatrix<S2>&, types::global_dof_index, types::global_dof_index, types::global_dof_index, types::global_dof_index); template void FullMatrix<S1>::add<S2> (const S1, const FullMatrix<S2>&); template @@ -167,12 +171,13 @@ for (S1, S2 : COMPLEX_SCALARS) const S1, const FullMatrix<S2>&); template void FullMatrix<S1>::add<S2> ( - const FullMatrix<S2>&, S1, unsigned, unsigned,unsigned, unsigned); + const FullMatrix<S2>&, S1, types::global_dof_index, types::global_dof_index, types::global_dof_index, types::global_dof_index); template void FullMatrix<S1>::Tadd<S2> (const S1, const FullMatrix<S2>&); template void FullMatrix<S1>::Tadd<S2> ( - const FullMatrix<S2>&, S1, unsigned, unsigned, unsigned, unsigned); + const FullMatrix<S2>&, S1, types::global_dof_index, types::global_dof_index, + types::global_dof_index, types::global_dof_index); template void FullMatrix<S1>::equ<S2> (const S1, const FullMatrix<S2>&); template @@ -197,8 +202,8 @@ for (S1, S2 : COMPLEX_SCALARS) template void FullMatrix<S1>::fill_permutation<S2> ( const FullMatrix<S2>&, - const std::vector<unsigned int>&, - const std::vector<unsigned int>&); + const std::vector<size_type>&, + const std::vector<size_type>&); template void FullMatrix<S1>::vmult<S2>( Vector<S2>&, const Vector<S2>&, bool) const; diff --git a/deal.II/source/lac/lapack_full_matrix.cc b/deal.II/source/lac/lapack_full_matrix.cc index f61fcbd94a..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 <deal.II/lac/lapack_full_matrix.h> #include <deal.II/lac/lapack_templates.h> @@ -26,7 +30,7 @@ DEAL_II_NAMESPACE_OPEN using namespace LAPACKSupport; template <typename number> -LAPACKFullMatrix<number>::LAPACKFullMatrix(const unsigned int n) +LAPACKFullMatrix<number>::LAPACKFullMatrix(const size_type n) : TransposeTable<number> (n,n), state(matrix) @@ -35,8 +39,8 @@ LAPACKFullMatrix<number>::LAPACKFullMatrix(const unsigned int n) template <typename number> LAPACKFullMatrix<number>::LAPACKFullMatrix( - const unsigned int m, - const unsigned int n) + const size_type m, + const size_type n) : TransposeTable<number> (m,n), state(matrix) @@ -68,8 +72,8 @@ LAPACKFullMatrix<number>::operator = (const FullMatrix<number2> &M) { Assert (this->n_rows() == M.m(), ExcDimensionMismatch(this->n_rows(), M.m())); Assert (this->n_cols() == M.n(), ExcDimensionMismatch(this->n_cols(), M.n())); - for (unsigned int i=0; i<this->n_rows(); ++i) - for (unsigned int j=0; j<this->n_cols(); ++j) + for (size_type i=0; i<this->n_rows(); ++i) + for (size_type j=0; j<this->n_cols(); ++j) (*this)(i,j) = M(i,j); state = LAPACKSupport::matrix; @@ -123,7 +127,7 @@ LAPACKFullMatrix<number>::vmult ( work.resize(std::max(mm,nn)); gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; i<wr.size(); ++i) + for (size_type i=0; i<wr.size(); ++i) work[i] *= wr[i]; // Multiply with U gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, &work[0], &one, &beta, w.val, &one); @@ -137,7 +141,7 @@ LAPACKFullMatrix<number>::vmult ( work.resize(std::max(mm,nn)); gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; i<wr.size(); ++i) + for (size_type i=0; i<wr.size(); ++i) work[i] *= wr[i]; // Multiply with V gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one); @@ -182,7 +186,7 @@ LAPACKFullMatrix<number>::Tvmult ( work.resize(std::max(mm,nn)); gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; i<wr.size(); ++i) + for (size_type i=0; i<wr.size(); ++i) work[i] *= wr[i]; // Multiply with V gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one); @@ -196,7 +200,7 @@ LAPACKFullMatrix<number>::Tvmult ( work.resize(std::max(mm,nn)); gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; i<wr.size(); ++i) + for (size_type i=0; i<wr.size(); ++i) work[i] *= wr[i]; // Multiply with U gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, &work[0], &one, &beta, w.val, &one); @@ -290,7 +294,7 @@ LAPACKFullMatrix<number>::compute_inverse_svd(const double threshold) Assert (state==LAPACKSupport::svd, ExcState(state)); const double lim = wr[0]*threshold; - for (unsigned int i=0; i<wr.size(); ++i) + for (size_type i=0; i<wr.size(); ++i) { if (wr[i] > lim) wr[i] = 1./wr[i]; @@ -414,7 +418,7 @@ LAPACKFullMatrix<number>::compute_eigenvalues( lwork = 4*nn; // no query mode #endif // resize workspace array - work.resize((unsigned int) lwork); + work.resize((size_type ) lwork); // Finally compute the eigenvalues. geev(jobvl, jobvr, &nn, values, &nn, @@ -445,7 +449,7 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric( { Assert(state == matrix, ExcState(state)); const int nn = (this->n_cols() > 0 ? this->n_cols() : 1); - Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic()); + Assert(static_cast<size_type>(nn) == this->n_rows(), ExcNotQuadratic()); wr.resize(nn); LAPACKFullMatrix<number> matrix_eigenvectors(nn, nn); @@ -460,8 +464,8 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric( const char *const uplo(&U); const char *const range(&V); const int *const dummy(&one); - std::vector<int> iwork(static_cast<unsigned int> (5*nn)); - std::vector<int> ifail(static_cast<unsigned int> (nn)); + std::vector<int> iwork(static_cast<size_type> (5*nn)); + std::vector<int> ifail(static_cast<size_type> (nn)); // Optimal workspace query: @@ -507,7 +511,7 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric( lwork = 8*nn > 1 ? 8*nn : 1; // no query mode #endif // resize workspace arrays - work.resize(static_cast<unsigned int> (lwork)); + work.resize(static_cast<size_type> (lwork)); // Finally compute the eigenvalues. syevx (jobz, range, @@ -527,11 +531,11 @@ LAPACKFullMatrix<number>::compute_eigenvalues_symmetric( eigenvalues.reinit(n_eigenpairs); eigenvectors.reinit(nn, n_eigenpairs, true); - for (unsigned int i=0; i < static_cast<unsigned int> (n_eigenpairs); ++i) + for (size_type i=0; i < static_cast<size_type> (n_eigenpairs); ++i) { eigenvalues(i) = wr[i]; - unsigned int col_begin(i*nn); - for (unsigned int j=0; j < static_cast<unsigned int> (nn); ++j) + size_type col_begin(i*nn); + for (size_type j=0; j < static_cast<size_type> (nn); ++j) { eigenvectors(j,i) = values_eigenvectors[col_begin+j]; } @@ -554,9 +558,9 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric( { Assert(state == matrix, ExcState(state)); const int nn = (this->n_cols() > 0 ? this->n_cols() : 1); - Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic()); + Assert(static_cast<size_type>(nn) == this->n_rows(), ExcNotQuadratic()); Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic()); - Assert(static_cast<unsigned int>(nn) == B.n_cols(), + Assert(static_cast<size_type>(nn) == B.n_cols(), ExcDimensionMismatch (nn, B.n_cols())); wr.resize(nn); @@ -573,8 +577,8 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric( const char *const uplo(&U); const char *const range(&V); const int *const dummy(&one); - std::vector<int> iwork(static_cast<unsigned int> (5*nn)); - std::vector<int> ifail(static_cast<unsigned int> (nn)); + std::vector<int> iwork(static_cast<size_type> (5*nn)); + std::vector<int> ifail(static_cast<size_type> (nn)); // Optimal workspace query: @@ -618,7 +622,7 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric( lwork = 8*nn > 1 ? 8*nn : 1; // no query mode #endif // resize workspace arrays - work.resize(static_cast<unsigned int> (lwork)); + work.resize(static_cast<size_type> (lwork)); // Finally compute the generalized // eigenvalues. @@ -637,12 +641,12 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric( eigenvalues.reinit(n_eigenpairs); eigenvectors.resize(n_eigenpairs); - for (unsigned int i=0; i < static_cast<unsigned int> (n_eigenpairs); ++i) + for (size_type i=0; i < static_cast<size_type> (n_eigenpairs); ++i) { eigenvalues(i) = wr[i]; - unsigned int col_begin(i*nn); + size_type col_begin(i*nn); eigenvectors[i].reinit(nn, true); - for (unsigned int j=0; j < static_cast<unsigned int> (nn); ++j) + for (size_type j=0; j < static_cast<size_type> (nn); ++j) { eigenvectors[i](j) = values_eigenvectors[col_begin+j]; } @@ -661,11 +665,11 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric ( { Assert(state == matrix, ExcState(state)); const int nn = this->n_cols(); - Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic()); + Assert(static_cast<size_type>(nn) == this->n_rows(), ExcNotQuadratic()); Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic()); - Assert(static_cast<unsigned int>(nn) == B.n_cols(), + Assert(static_cast<size_type>(nn) == B.n_cols(), ExcDimensionMismatch (nn, B.n_cols())); - Assert(eigenvectors.size() <= static_cast<unsigned int>(nn), + Assert(eigenvectors.size() <= static_cast<size_type>(nn), ExcMessage ("eigenvectors.size() > matrix.n_cols()")); wr.resize(nn); @@ -719,7 +723,7 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric ( lwork = 3*nn-1 > 1 ? 3*nn-1 : 1; // no query mode #endif // resize workspace array - work.resize((unsigned int) lwork); + work.resize((size_type) lwork); // Finally compute the generalized // eigenvalues. @@ -734,11 +738,11 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric ( if (info != 0) std::cerr << "LAPACK error in sygv" << std::endl; - for (unsigned int i=0; i < eigenvectors.size(); ++i) + for (size_type i=0; i < eigenvectors.size(); ++i) { - unsigned int col_begin(i*nn); + size_type col_begin(i*nn); eigenvectors[i].reinit(nn, true); - for (unsigned int j=0; j < static_cast<unsigned int>(nn); ++j) + for (size_type j=0; j < static_cast<size_type>(nn); ++j) { eigenvectors[i](j) = values_A[col_begin+j]; } @@ -805,9 +809,9 @@ LAPACKFullMatrix<number>::print_formatted ( width = precision+2; } - for (unsigned int i=0; i<this->n_rows(); ++i) + for (size_type i=0; i<this->n_rows(); ++i) { - for (unsigned int j=0; j<this->n_cols(); ++j) + for (size_type j=0; j<this->n_cols(); ++j) if (std::fabs(this->el(i,j)) > threshold) out << std::setw(width) << this->el(i,j) * denominator << ' '; 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 174d6c3b82..69b68c0298 100644 --- a/deal.II/source/lac/matrix_lib.cc +++ b/deal.II/source/lac/matrix_lib.cc @@ -1,23 +1,25 @@ -//--------------------------------------------------------------------------- -// $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 <deal.II/lac/matrix_lib.templates.h> #include <deal.II/lac/sparse_matrix.h> DEAL_II_NAMESPACE_OPEN -MeanValueFilter::MeanValueFilter(unsigned int component) +MeanValueFilter::MeanValueFilter(size_type component) : component(component) {} diff --git a/deal.II/source/lac/matrix_out.cc b/deal.II/source/lac/matrix_out.cc index 95a74f15d2..634d5dd7f9 100644 --- a/deal.II/source/lac/matrix_out.cc +++ b/deal.II/source/lac/matrix_out.cc @@ -1,25 +1,27 @@ -//--------------------------------------------------------------------------- -// $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 <deal.II/lac/matrix_out.h> DEAL_II_NAMESPACE_OPEN -MatrixOut::Options::Options (const bool show_absolute_values, - const unsigned int block_size, - const bool discontinuous) +MatrixOut::Options::Options (const bool show_absolute_values, + const size_type block_size, + const bool discontinuous) : show_absolute_values (show_absolute_values), block_size (block_size), 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 <deal.II/lac/parallel_vector.h> #include <deal.II/lac/parallel_vector.templates.h> 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 4701a9ff05..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 <deal.II/lac/petsc_block_sparse_matrix.h> @@ -41,8 +43,8 @@ namespace PETScWrappers void BlockSparseMatrix:: - reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns) + reinit (const size_type n_block_rows, + const size_type n_block_columns) { // first delete previous content of // the subobjects array @@ -57,8 +59,8 @@ namespace PETScWrappers this->column_block_indices.reinit (n_block_columns, 0); // and reinitialize the blocks - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { BlockType *p = new BlockType(); this->sub_objects[r][c] = p; diff --git a/deal.II/source/lac/petsc_full_matrix.cc b/deal.II/source/lac/petsc_full_matrix.cc index fb5fbcd053..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 <deal.II/lac/petsc_full_matrix.h> @@ -22,8 +24,8 @@ DEAL_II_NAMESPACE_OPEN namespace PETScWrappers { - FullMatrix::FullMatrix (const unsigned int m, - const unsigned int n) + FullMatrix::FullMatrix (const size_type m, + const size_type n) { const int ierr = MatCreateSeqDense(PETSC_COMM_SELF, m, n, PETSC_NULL, diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index 036addb339..fb96b311eb 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 <deal.II/lac/petsc_matrix_base.h> @@ -63,8 +65,7 @@ namespace PETScWrappers // iterator for an empty line (what // would it point to?) Assert (ncols != 0, ExcInternalError()); - colnum_cache.reset (new std::vector<unsigned int> (colnums, - colnums+ncols)); + colnum_cache.reset (new std::vector<size_type> (colnums, colnums+ncols)); value_cache.reset (new std::vector<PetscScalar> (values, values+ncols)); // and finally restore the matrix @@ -134,8 +135,8 @@ namespace PETScWrappers void - MatrixBase::clear_row (const unsigned int row, - const PetscScalar new_diag_value) + MatrixBase::clear_row (const size_type row, + const PetscScalar new_diag_value) { compress (); @@ -171,8 +172,8 @@ namespace PETScWrappers void - MatrixBase::clear_rows (const std::vector<unsigned int> &rows, - const PetscScalar new_diag_value) + MatrixBase::clear_rows (const std::vector<size_type> &rows, + const PetscScalar new_diag_value) { compress (); @@ -214,8 +215,8 @@ namespace PETScWrappers PetscScalar - MatrixBase::el (const unsigned int i, - const unsigned int j) const + MatrixBase::el (const size_type i, + const size_type j) const { PetscInt petsc_i = i, petsc_j = j; @@ -232,7 +233,7 @@ namespace PETScWrappers PetscScalar - MatrixBase::diag_element (const unsigned int i) const + MatrixBase::diag_element (const size_type i) const { Assert (m() == n(), ExcNotQuadratic()); @@ -267,7 +268,7 @@ namespace PETScWrappers - unsigned int + MatrixBase::size_type MatrixBase::m () const { PetscInt n_rows, n_cols; @@ -280,7 +281,7 @@ namespace PETScWrappers - unsigned int + MatrixBase::size_type MatrixBase::n () const { PetscInt n_rows, n_cols; @@ -293,7 +294,7 @@ namespace PETScWrappers - unsigned int + MatrixBase::size_type MatrixBase::local_size () const { PetscInt n_rows, n_cols; @@ -306,7 +307,7 @@ namespace PETScWrappers - std::pair<unsigned int, unsigned int> + std::pair<MatrixBase::size_type, MatrixBase::size_type> MatrixBase::local_range () const { PetscInt begin, end; @@ -320,7 +321,7 @@ namespace PETScWrappers - unsigned int + MatrixBase::size_type MatrixBase::n_nonzero_elements () const { MatInfo mat_info; @@ -328,14 +329,14 @@ namespace PETScWrappers = MatGetInfo (matrix, MAT_GLOBAL_SUM, &mat_info); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return static_cast<unsigned int>(mat_info.nz_used); + return static_cast<size_type>(mat_info.nz_used); } - unsigned int + MatrixBase::size_type MatrixBase:: - row_length (const unsigned int row) const + row_length (const size_type row) const { //TODO: this function will probably only work if compress() was called on the //matrix previously. however, we can't do this here, since it would impose @@ -428,10 +429,10 @@ namespace PETScWrappers #if DEAL_II_PETSC_VERSION_GTE(3,1,0) - PetscReal + PetscScalar MatrixBase::trace () const { - PetscReal result; + PetscScalar result; const int ierr = MatGetTrace (matrix, &result); @@ -468,16 +469,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, @@ -609,6 +610,36 @@ namespace PETScWrappers MatView (matrix, PETSC_VIEWER_STDOUT_WORLD); } + void + MatrixBase::print (std::ostream &out, + const bool alternative_output) const + { + std::pair<MatrixBase::size_type, MatrixBase::size_type> + 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 @@ -617,7 +648,7 @@ namespace PETScWrappers MatInfo info; MatGetInfo(matrix, MAT_LOCAL, &info); - return sizeof(*this) + static_cast<unsigned int>(info.memory); + return sizeof(*this) + static_cast<size_type>(info.memory); } } diff --git a/deal.II/source/lac/petsc_matrix_free.cc b/deal.II/source/lac/petsc_matrix_free.cc index 0a02fd6a27..9295ce6146 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 <deal.II/lac/petsc_matrix_free.h> 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 e56704cb8f..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 <deal.II/lac/petsc_parallel_block_sparse_matrix.h> @@ -42,8 +44,8 @@ namespace PETScWrappers void BlockSparseMatrix:: - reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns) + reinit (const size_type n_block_rows, + const size_type n_block_columns) { // first delete previous content of // the subobjects array @@ -58,12 +60,63 @@ namespace PETScWrappers this->column_block_indices.reinit (n_block_columns, 0); // and reinitialize the blocks + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) + { + BlockType *p = new BlockType(); + this->sub_objects[r][c] = p; + } + } + + void + BlockSparseMatrix:: + reinit(const std::vector<IndexSet> &rows, + const std::vector<IndexSet> &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<types::global_dof_index> row_sizes; + for (unsigned int r=0; r<bcsp.n_block_rows(); ++r) + row_sizes.push_back( bcsp.block(r,0).n_rows() ); + this->row_block_indices.reinit (row_sizes); + + std::vector<types::global_dof_index> col_sizes; + for (unsigned int c=0; c<bcsp.n_block_cols(); ++c) + col_sizes.push_back( bcsp.block(0,c).n_cols() ); + this->column_block_indices.reinit (col_sizes); + for (unsigned int r=0; r<this->n_block_rows(); ++r) for (unsigned int c=0; c<this->n_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<IndexSet> &sizes, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com) + { + reinit(sizes, sizes, bcsp, com); } diff --git a/deal.II/source/lac/petsc_parallel_block_vector.cc b/deal.II/source/lac/petsc_parallel_block_vector.cc index fc11d85a10..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 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 <deal.II/lac/petsc_parallel_block_vector.h> @@ -24,6 +26,8 @@ namespace PETScWrappers { namespace MPI { + typedef types::global_dof_index size_type; + BlockVector & BlockVector::operator = (const PETScWrappers::BlockVector &v) { @@ -35,6 +39,21 @@ namespace PETScWrappers return *this; } + + + void + BlockVector::reinit (const unsigned int num_blocks) + { + std::vector<size_type> block_sizes (num_blocks, 0); + this->block_indices.reinit (block_sizes); + if (this->components.size() != this->n_blocks()) + this->components.resize(this->n_blocks()); + + for (unsigned int i=0; i<this->n_blocks(); ++i) + 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 b90774a75f..e366b66458 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 <deal.II/lac/petsc_parallel_sparse_matrix.h> @@ -42,13 +44,13 @@ namespace PETScWrappers - SparseMatrix::SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric) : communicator (communicator) { @@ -58,13 +60,13 @@ namespace PETScWrappers - SparseMatrix::SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector<size_type> &row_lengths, + const bool is_symmetric) : communicator (communicator) { @@ -76,12 +78,12 @@ namespace PETScWrappers template <typename SparsityType> SparseMatrix:: - SparseMatrix (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector<unsigned int> &local_rows_per_process, - const std::vector<unsigned int> &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations) + SparseMatrix (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector<size_type> &local_rows_per_process, + const std::vector<size_type> &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations) : communicator (communicator) { @@ -99,16 +101,26 @@ 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, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::reinit (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric) { this->communicator = communicator; @@ -128,13 +140,13 @@ namespace PETScWrappers void - SparseMatrix::reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric) + SparseMatrix::reinit (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector<size_type> &row_lengths, + const bool is_symmetric) { this->communicator = communicator; @@ -155,12 +167,12 @@ namespace PETScWrappers template <typename SparsityType> void SparseMatrix:: - reinit (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector<unsigned int> &local_rows_per_process, - const std::vector<unsigned int> &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations) + reinit (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector<size_type> &local_rows_per_process, + const std::vector<size_type> &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations) { this->communicator = communicator; @@ -178,15 +190,35 @@ namespace PETScWrappers preset_nonzero_locations); } + template <typename SparsityType> + 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 unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric) { Assert (local_rows <= m, ExcLocalRowsTooLarge (local_rows, m)); @@ -233,12 +265,12 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector<size_type> &row_lengths, + const bool is_symmetric) { Assert (local_rows <= m, ExcLocalRowsTooLarge (local_rows, m)); @@ -251,7 +283,7 @@ namespace PETScWrappers // MatCreateMPIAIJ throws an // error. In this case use a // PETScWrappers::SparseMatrix - for (unsigned int i=0; i<row_lengths.size(); ++i) + for (size_type i=0; i<row_lengths.size(); ++i) Assert(row_lengths[i]<=local_columns, ExcIndexRange(row_lengths[i], 1, local_columns+1)); @@ -308,15 +340,181 @@ namespace PETScWrappers } + template <typename SparsityType> + 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<PetscInt> + + 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<local_row_end; ++i) + { + const PetscInt row_length = sparsity_pattern.row_length(i); + rowstart_in_window[i+1-local_row_start] + = rowstart_in_window[i-local_row_start] + row_length; + n_cols += row_length; + } + colnums_in_window.resize (n_cols+1, -1); + } + + // now copy over the information + // from the sparsity pattern. + { + PetscInt *ptr = & colnums_in_window[0]; + + for (PetscInt i=local_row_start; i<local_row_end; ++i) + { + typename SparsityType::row_iterator + row_start = sparsity_pattern.row_begin(i), + row_end = sparsity_pattern.row_end(i); + + std::copy(row_start, row_end, ptr); + ptr += row_end - row_start; + } + } + + + // then call the petsc function + // that summarily allocates these + // entries: + MatMPIAIJSetPreallocationCSR (matrix, + &rowstart_in_window[0], + &colnums_in_window[0], + 0); + } + else + { + PetscInt i=0; + MatMPIAIJSetPreallocationCSR (matrix, + &i, + &i, + 0); + + + } + compress (dealii::VectorOperation::insert); + + { + + // Tell PETSc that we are not + // planning on adding new entries + // to the matrix. Generate errors + // in debug mode. + int ierr; +#if DEAL_II_PETSC_VERSION_LT(3,0,0) +#ifdef DEBUG + ierr = MatSetOption (matrix, MAT_NEW_NONZERO_LOCATION_ERR); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#else + ierr = MatSetOption (matrix, MAT_NO_NEW_NONZERO_LOCATIONS); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#endif +#else +#ifdef DEBUG + ierr = MatSetOption (matrix, MAT_NEW_NONZERO_LOCATION_ERR, PETSC_TRUE); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#else + ierr = MatSetOption (matrix, MAT_NEW_NONZERO_LOCATIONS, PETSC_FALSE); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#endif +#endif + + // Tell PETSc to keep the + // SparsityPattern entries even if + // we delete a row with + // clear_rows() which calls + // MatZeroRows(). Otherwise one can + // not write into that row + // afterwards. +#if DEAL_II_PETSC_VERSION_LT(3,0,0) + ierr = MatSetOption (matrix, MAT_KEEP_ZEROED_ROWS); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#elif DEAL_II_PETSC_VERSION_LT(3,1,0) + ierr = MatSetOption (matrix, MAT_KEEP_ZEROED_ROWS, PETSC_TRUE); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#else + ierr = MatSetOption (matrix, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE); + AssertThrow (ierr == 0, ExcPETScError(ierr)); +#endif + + } + + } + template <typename SparsityType> void SparseMatrix:: - do_reinit (const SparsityType &sparsity_pattern, - const std::vector<unsigned int> &local_rows_per_process, - const std::vector<unsigned int> &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations) + do_reinit (const SparsityType &sparsity_pattern, + const std::vector<size_type> &local_rows_per_process, + const std::vector<size_type> &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations) { Assert (local_rows_per_process.size() == local_columns_per_process.size(), ExcDimensionMismatch (local_rows_per_process.size(), @@ -330,14 +528,14 @@ namespace PETScWrappers // and how many arent. for this, we // first have to know which areas are // ours - unsigned int local_row_start = 0; - unsigned int local_col_start = 0; + size_type local_row_start = 0; + size_type local_col_start = 0; for (unsigned int p=0; p<this_process; ++p) { local_row_start += local_rows_per_process[p]; local_col_start += local_columns_per_process[p]; } - const unsigned int + 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 +544,7 @@ namespace PETScWrappers //at least starting from 2.3.3 (tested, //see below) - const unsigned int + const size_type local_col_end = local_col_start + local_columns_per_process[this_process]; // then count the elements in- and @@ -355,10 +553,10 @@ namespace PETScWrappers row_lengths_in_window (local_row_end - local_row_start), row_lengths_out_of_window (local_row_end - local_row_start); - for (unsigned int row = local_row_start; row<local_row_end; ++row) - for (unsigned int c=0; c<sparsity_pattern.row_length(row); ++c) + for (size_type row = local_row_start; row<local_row_end; ++row) + for (size_type c=0; c<sparsity_pattern.row_length(row); ++c) { - const unsigned int column = sparsity_pattern.column_number(row,c); + const size_type column = sparsity_pattern.column_number(row,c); if ((column >= local_col_start) && (column < local_col_end)) @@ -438,10 +636,10 @@ namespace PETScWrappers rowstart_in_window (local_row_end - local_row_start + 1, 0), colnums_in_window; { - unsigned int n_cols = 0; - for (unsigned int i=local_row_start; i<local_row_end; ++i) + size_type n_cols = 0; + for (size_type i=local_row_start; i<local_row_end; ++i) { - const unsigned int row_length = sparsity_pattern.row_length(i); + const size_type row_length = sparsity_pattern.row_length(i); rowstart_in_window[i+1-local_row_start] = rowstart_in_window[i-local_row_start] + row_length; n_cols += row_length; @@ -452,9 +650,9 @@ namespace PETScWrappers // now copy over the information // from the sparsity pattern. { - PetscInt* ptr = & colnums_in_window[0]; + PetscInt *ptr = & colnums_in_window[0]; - for (unsigned int i=local_row_start; i<local_row_end; ++i) + for (size_type i=local_row_start; i<local_row_end; ++i) { typename SparsityType::row_iterator row_start = sparsity_pattern.row_begin(i), @@ -499,7 +697,7 @@ namespace PETScWrappers values (sparsity_pattern.max_entries_per_row(), 1.); - for (unsigned int i=local_row_start; i<local_row_end; ++i) + for (size_type i=local_row_start; i<local_row_end; ++i) { PetscInt petsc_i = i; MatSetValues (matrix, 1, &petsc_i, @@ -567,66 +765,79 @@ namespace PETScWrappers template SparseMatrix::SparseMatrix (const MPI_Comm &, const SparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int, const bool); template SparseMatrix::SparseMatrix (const MPI_Comm &, const CompressedSparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int, const bool); template SparseMatrix::SparseMatrix (const MPI_Comm &, const CompressedSimpleSparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int, const bool); template void SparseMatrix::reinit (const MPI_Comm &, const SparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int, const bool); template void SparseMatrix::reinit (const MPI_Comm &, const CompressedSparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int, const bool); template void SparseMatrix::reinit (const MPI_Comm &, const CompressedSimpleSparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int, const bool); + template void + SparseMatrix:: + reinit (const IndexSet &, + const IndexSet &, + const CompressedSimpleSparsityPattern &, + const MPI_Comm &); + template void SparseMatrix::do_reinit (const SparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int , const bool); template void SparseMatrix::do_reinit (const CompressedSparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, const unsigned int , const bool); template void SparseMatrix::do_reinit (const CompressedSimpleSparsityPattern &, - const std::vector<unsigned int> &, - const std::vector<unsigned int> &, + const std::vector<size_type> &, + const std::vector<size_type> &, 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 70196a4add..7c4cc997ee 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 <deal.II/lac/petsc_parallel_vector.h> @@ -41,9 +43,9 @@ namespace PETScWrappers - Vector::Vector (const MPI_Comm &communicator, - const unsigned int n, - const unsigned int local_size) + Vector::Vector (const MPI_Comm &communicator, + const size_type n, + const size_type local_size) : communicator (communicator) { @@ -52,9 +54,9 @@ namespace PETScWrappers - Vector::Vector (const MPI_Comm &communicator, + Vector::Vector (const MPI_Comm &communicator, const VectorBase &v, - const unsigned int local_size) + const size_type local_size) : communicator (communicator) { @@ -79,20 +81,45 @@ 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()); } void - Vector::reinit (const MPI_Comm &comm, - const unsigned int n, - const unsigned int local_sz, - const bool fast) + Vector::reinit (const MPI_Comm &comm, + const size_type n, + const size_type local_sz, + const bool fast) { communicator = comm; @@ -149,6 +176,14 @@ namespace PETScWrappers Vector::reinit (const MPI_Comm &comm, const IndexSet &local, const IndexSet &ghost) + { + reinit(local, ghost, comm); + } + + void + Vector::reinit (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &comm) { communicator = comm; @@ -162,11 +197,19 @@ 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) { 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 +218,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=.")); @@ -194,7 +237,7 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); // then copy: - const std::pair<unsigned int, unsigned int> + const std::pair<size_type, size_type> local_elements = local_range (); std::copy (src_array + local_elements.first, src_array + local_elements.second, @@ -214,8 +257,8 @@ namespace PETScWrappers void - Vector::create_vector (const unsigned int n, - const unsigned int local_size) + Vector::create_vector (const size_type n, + const size_type local_size) { Assert (local_size <= n, ExcIndexRange (local_size, 0, n)); ghosted = false; @@ -232,18 +275,15 @@ namespace PETScWrappers void - Vector::create_vector (const unsigned int n, - const unsigned int local_size, + Vector::create_vector (const size_type n, + const size_type local_size, const IndexSet &ghostnodes) { Assert (local_size <= n, ExcIndexRange (local_size, 0, n)); ghosted = true; ghost_indices = ghostnodes; - //64bit indices won't work yet: - Assert (sizeof(unsigned int)==sizeof(PetscInt), ExcInternalError()); - - std::vector<unsigned int> ghostindices; + std::vector<size_type> ghostindices; ghostnodes.fill_index_vector(ghostindices); const PetscInt *ptr @@ -272,7 +312,7 @@ namespace PETScWrappers ierr = VecGetOwnershipRange (vector, &begin, &end); - Assert(local_size==(unsigned int)(end-begin), ExcInternalError()); + Assert(local_size==(size_type)(end-begin), ExcInternalError()); Vec l; ierr = VecGhostGetLocalForm(vector, &l); 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 <deal.II/lac/petsc_precondition.h> 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 <deal.II/base/logstream.h> #include <deal.II/lac/petsc_solver.h> @@ -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<SolverControl *>(solver_control_x); diff --git a/deal.II/source/lac/petsc_sparse_matrix.cc b/deal.II/source/lac/petsc_sparse_matrix.cc index e77038d6cd..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 <deal.II/lac/petsc_sparse_matrix.h> @@ -37,20 +39,20 @@ namespace PETScWrappers - SparseMatrix::SparseMatrix (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric) { do_reinit (m, n, n_nonzero_per_row, is_symmetric); } - SparseMatrix::SparseMatrix (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const bool is_symmetric) { do_reinit (m, n, row_lengths, is_symmetric); } @@ -77,10 +79,10 @@ namespace PETScWrappers void - SparseMatrix::reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric) { // get rid of old matrix and generate a // new one @@ -97,10 +99,10 @@ namespace PETScWrappers void - SparseMatrix::reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric) + SparseMatrix::reinit (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const bool is_symmetric) { // get rid of old matrix and generate a // new one @@ -147,10 +149,10 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric) { // use the call sequence indicating only // a maximal number of elements per row @@ -178,10 +180,10 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &row_lengths, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const std::vector<size_type> &row_lengths, + const bool is_symmetric) { Assert (row_lengths.size() == m, ExcDimensionMismatch (row_lengths.size(), m)); @@ -195,7 +197,7 @@ namespace PETScWrappers // convert, unless we want to play dirty // tricks with conversions of pointers const std::vector<PetscInt> - 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, @@ -224,8 +226,8 @@ namespace PETScWrappers SparseMatrix::do_reinit (const SparsityType &sparsity_pattern, const bool preset_nonzero_locations) { - std::vector<unsigned int> row_lengths (sparsity_pattern.n_rows()); - for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i) + std::vector<size_type> row_lengths (sparsity_pattern.n_rows()); + for (size_type i=0; i<sparsity_pattern.n_rows(); ++i) row_lengths[i] = sparsity_pattern.row_length (i); do_reinit (sparsity_pattern.n_rows(), @@ -249,12 +251,11 @@ namespace PETScWrappers { std::vector<PetscInt> row_entries; std::vector<PetscScalar> row_values; - - for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i) + for (size_type i=0; i<sparsity_pattern.n_rows(); ++i) { row_entries.resize (row_lengths[i]); row_values.resize (row_lengths[i], 0.0); - for (unsigned int j=0; j<row_lengths[i]; ++j) + for (size_type j=0; j<row_lengths[i]; ++j) row_entries[j] = sparsity_pattern.column_number (i,j); const PetscInt int_row = i; diff --git a/deal.II/source/lac/petsc_vector.cc b/deal.II/source/lac/petsc_vector.cc index 31c9eb3427..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 <deal.II/lac/petsc_vector.h> @@ -31,7 +33,7 @@ namespace PETScWrappers - Vector::Vector (const unsigned int n) + Vector::Vector (const size_type n) { Vector::create_vector (n); } @@ -61,8 +63,8 @@ namespace PETScWrappers void - Vector::reinit (const unsigned int n, - const bool fast) + Vector::reinit (const size_type n, + const bool fast) { // only do something if the sizes // mismatch @@ -107,7 +109,7 @@ namespace PETScWrappers void - Vector::create_vector (const unsigned int n) + Vector::create_vector (const size_type n) { const int ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector); diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index 0f8deef8af..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 <deal.II/lac/petsc_vector_base.h> @@ -87,8 +89,8 @@ namespace PETScWrappers PetscScalar value; - if ( index>=static_cast<unsigned int>(begin) - && index<static_cast<unsigned int>(end) ) + if ( index>=static_cast<size_type>(begin) + && index<static_cast<size_type>(end) ) { //local entry value = *(ptr+index-begin); @@ -96,10 +98,10 @@ namespace PETScWrappers else { //ghost entry - const unsigned int ghostidx + const size_type ghostidx = vector.ghost_indices.index_within_set(index); - Assert(ghostidx+end-begin<(unsigned int)lsize, ExcInternalError()); + Assert(ghostidx+end-begin<(size_type)lsize, ExcInternalError()); value = *(ptr+ghostidx+end-begin); } @@ -123,8 +125,8 @@ namespace PETScWrappers - AssertThrow ((index >= static_cast<unsigned int>(begin)) && - (index < static_cast<unsigned int>(end)), + AssertThrow ((index >= static_cast<size_type>(begin)) && + (index < static_cast<size_type>(end)), ExcAccessToNonlocalElement (index, begin, end-1)); // old version which only work with @@ -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 - unsigned int + VectorBase::size_type VectorBase::size () const { PetscInt sz; @@ -279,7 +281,7 @@ namespace PETScWrappers - unsigned int + VectorBase::size_type VectorBase::local_size () const { PetscInt sz; @@ -291,7 +293,7 @@ namespace PETScWrappers - std::pair<unsigned int, unsigned int> + std::pair<VectorBase::size_type, VectorBase::size_type> VectorBase::local_range () const { PetscInt begin, end; @@ -305,7 +307,7 @@ namespace PETScWrappers void - VectorBase::set (const std::vector<unsigned int> &indices, + VectorBase::set (const std::vector<size_type> &indices, const std::vector<PetscScalar> &values) { Assert (indices.size() == values.size(), @@ -316,7 +318,7 @@ namespace PETScWrappers void - VectorBase::add (const std::vector<unsigned int> &indices, + VectorBase::add (const std::vector<size_type> &indices, const std::vector<PetscScalar> &values) { Assert (indices.size() == values.size(), @@ -327,7 +329,7 @@ namespace PETScWrappers void - VectorBase::add (const std::vector<unsigned int> &indices, + VectorBase::add (const std::vector<size_type> &indices, const ::dealii::Vector<PetscScalar> &values) { Assert (indices.size() == values.size(), @@ -338,9 +340,9 @@ namespace PETScWrappers void - VectorBase::add (const unsigned int n_elements, - const unsigned int *indices, - const PetscScalar *values) + VectorBase::add (const size_type n_elements, + const size_type *indices, + const PetscScalar *values) { do_set_add_operation(n_elements, indices, values, true); } @@ -409,18 +411,20 @@ namespace PETScWrappers return d*d; } - - + // @todo does not build with PETSc complex scalar types. + // :425:25: error: no match for ‘operator/’ in ‘sum / dealii::PETScWrappers::VectorBase::size()’ PetscScalar VectorBase::mean_value () const { +#ifndef PETSC_USE_COMPLEX int ierr; + // We can only use our more efficient // routine in the serial case. if (dynamic_cast<const PETScWrappers::MPI::Vector *>(this) != 0) { PetscScalar sum; - ierr = VecSum( vector, &sum); + ierr = VecSum(vector, &sum); AssertThrow (ierr == 0, ExcPETScError(ierr)); return sum/size(); } @@ -463,8 +467,17 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); 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.")); + + // Prevent compiler warning about no return value + PetscScalar dummy; + return dummy; +#endif + } VectorBase::real_type @@ -1034,10 +1047,10 @@ namespace PETScWrappers out.setf (std::ios::fixed, std::ios::floatfield); if (across) - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << val[i] << ' '; else - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << val[i] << std::endl; out << std::endl; @@ -1093,10 +1106,10 @@ namespace PETScWrappers void - VectorBase::do_set_add_operation (const unsigned int n_elements, - const unsigned int *indices, - const PetscScalar *values, - const bool add_values) + VectorBase::do_set_add_operation (const size_type n_elements, + const size_type *indices, + const PetscScalar *values, + const bool add_values) { ::dealii::VectorOperation::values action = (add_values ? ::dealii::VectorOperation::add : @@ -1117,7 +1130,7 @@ namespace PETScWrappers { #ifdef PETSC_USE_64BIT_INDICES std::vector<PetscInt> petsc_ind (n_elements); - for (unsigned int i=0; i<n_elements; ++i) + for (size_type i=0; i<n_elements; ++i) petsc_ind[i] = indices[i]; const PetscInt *petsc_indices = &petsc_ind[0]; #else 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 <deal.II/lac/precondition_block.templates.h> #include <deal.II/lac/sparse_matrix.h> 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 <deal.II/lac/precondition_block.templates.h> #include <deal.II/lac/sparse_matrix_ez.h> 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 <deal.II/lac/relaxation_block.templates.h> #include <deal.II/lac/sparse_matrix.h> 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 4640a0e50c..b821a61c71 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 <deal.II/lac/slepc_solver.h> @@ -109,8 +110,8 @@ namespace SLEPcWrappers } void - SolverBase::solve (const unsigned int n_eigenpairs, - unsigned int *n_converged) + SolverBase::solve (const size_type n_eigenpairs, + size_type *n_converged) { int ierr; @@ -157,7 +158,7 @@ namespace SLEPcWrappers // 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)); @@ -189,7 +190,7 @@ namespace SLEPcWrappers reinterpret_cast<PetscInt *>(n_converged)); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - int n_iterations = 0; + PetscInt n_iterations = 0; double residual_norm = 1e300; // @todo Investigate elaborating on some of this to act on the @@ -218,19 +219,20 @@ namespace SLEPcWrappers } void - SolverBase::get_eigenpair (const unsigned int index, - double &eigenvalues, + SolverBase::get_eigenpair (const size_type index, + PetscScalar &eigenvalues, PETScWrappers::VectorBase &eigenvectors) { AssertThrow (solver_data.get() != 0, ExcSLEPcWrappersUsageError()); // 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)); } + void SolverBase::get_eigenpair (const unsigned int index, double &real_eigenvalues, @@ -238,15 +240,22 @@ namespace SLEPcWrappers PETScWrappers::VectorBase &real_eigenvectors, PETScWrappers::VectorBase &imag_eigenvectors) { +#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), + ExcMessage ("Your PETSc/SLEPc installation was configured with scalar-type complex " + "but this function is not defined for complex types.")); +#endif } + void SolverBase::reset () { @@ -440,11 +449,11 @@ 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. - Assert (false, + Assert ((false), ExcMessage ("Your SLEPc installation does not include a copy of the " "Generalized Davidson solver. A SLEPc version > 3.1.0 is required.")); #endif @@ -473,7 +482,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. @@ -486,8 +495,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) @@ -509,7 +518,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), diff --git a/deal.II/source/lac/slepc_spectral_transformation.cc b/deal.II/source/lac/slepc_spectral_transformation.cc index 977e29876b..ff64e5d87d 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 <deal.II/lac/slepc_spectral_transformation.h> 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 <deal.II/lac/solver.h> #include <deal.II/lac/vector_memory.h> 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 <deal.II/base/logstream.h> #include <deal.II/base/parameter_handler.h> 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 <deal.II/lac/sparse_decomposition.templates.h> diff --git a/deal.II/source/lac/sparse_direct.cc b/deal.II/source/lac/sparse_direct.cc index 4df42981df..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 <deal.II/lac/sparse_direct.h> #include <deal.II/base/memory_consumption.h> @@ -108,7 +110,7 @@ sort_arrays (const SparseMatrix<number> &matrix) // column index of the second entry in a row // // ignore rows with only one or no entry - for (unsigned int row=0; row<matrix.m(); ++row) + for (size_type row=0; row<matrix.m(); ++row) { // we may have to move some elements that are left of the diagonal // but presently after the diagonal entry to the left, whereas the @@ -140,7 +142,7 @@ SparseDirectUMFPACK:: sort_arrays (const SparseMatrixEZ<number> &matrix) { //same thing for SparseMatrixEZ - for (unsigned int row=0; row<matrix.m(); ++row) + for (size_type row=0; row<matrix.m(); ++row) { long int cursor = Ap[row]; while ((cursor < Ap[row+1]-1) && @@ -165,10 +167,10 @@ sort_arrays (const BlockSparseMatrix<number> &matrix) // first. however, that means that there may be as many entries per row // in the wrong place as there are block columns. we can do the same // thing as above, but we have to do it multiple times - for (unsigned int row=0; row<matrix.m(); ++row) + for (size_type row=0; row<matrix.m(); ++row) { long int cursor = Ap[row]; - for (unsigned int block=0; block<matrix.n_block_cols(); ++block) + for (size_type block=0; block<matrix.n_block_cols(); ++block) { // find the next out-of-order element while ((cursor < Ap[row+1]-1) && @@ -204,7 +206,7 @@ factorize (const Matrix &matrix) clear (); - const unsigned int N = matrix.m(); + const size_type N = matrix.m(); // copy over the data from the matrix to the data structures UMFPACK // wants. note two things: first, UMFPACK wants compressed column storage @@ -230,9 +232,9 @@ factorize (const Matrix &matrix) // first fill row lengths array Ap[0] = 0; - for (unsigned int row=1; row<=N; ++row) + for (size_type row=1; row<=N; ++row) Ap[row] = Ap[row-1] + matrix.get_row_length(row-1); - Assert (static_cast<unsigned int>(Ap.back()) == Ai.size(), + Assert (static_cast<size_type>(Ap.back()) == Ai.size(), ExcInternalError()); // then copy over matrix elements. note that for sparse matrices, @@ -246,10 +248,10 @@ factorize (const Matrix &matrix) // loop over the elements of the matrix row by row, as suggested in the // documentation of the sparse matrix iterator class - for (unsigned int row = 0; row < matrix.m(); ++row) + 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(); @@ -261,7 +263,7 @@ factorize (const Matrix &matrix) } // at the end, we should have written all rows completely - for (unsigned int i=0; i<Ap.size()-1; ++i) + for (size_type i=0; i<Ap.size()-1; ++i) Assert (row_pointers[i] == Ap[i+1], ExcInternalError()); } @@ -291,7 +293,8 @@ factorize (const Matrix &matrix) void -SparseDirectUMFPACK::solve (Vector<double> &rhs_and_solution) const +SparseDirectUMFPACK::solve (Vector<double> &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<double> &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<double> &rhs_and_solution) const void -SparseDirectUMFPACK::solve (BlockVector<double> &rhs_and_solution) const +SparseDirectUMFPACK::solve (BlockVector<double> &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<double> 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<double> &rhs_and_solution) const template <class Matrix> void SparseDirectUMFPACK::solve (const Matrix &matrix, - Vector<double> &rhs_and_solution) + Vector<double> &rhs_and_solution, + bool transpose /*=false*/) { factorize (matrix); - solve (rhs_and_solution); + solve (rhs_and_solution, transpose); } template <class Matrix> void -SparseDirectUMFPACK::solve (const Matrix &matrix, - BlockVector<double> &rhs_and_solution) +SparseDirectUMFPACK::solve (const Matrix &matrix, + BlockVector<double> &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<double> &) const +SparseDirectUMFPACK::solve (Vector<double> &, 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<double> &) const void -SparseDirectUMFPACK::solve (BlockVector<double> &) const +SparseDirectUMFPACK::solve (BlockVector<double> &, 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<double> &) const template <class Matrix> void SparseDirectUMFPACK::solve (const Matrix &, - Vector<double> &) + Vector<double> &, + 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 <class Matrix> void SparseDirectUMFPACK::solve (const Matrix &, - BlockVector<double> &) + BlockVector<double> &, + 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<double> &, - const Vector<double> &) const + Vector<double> &dst, + const Vector<double> &src) const { - Assert(false, ExcNotImplemented()); + dst = src; + this->solve(dst, /*transpose=*/ true); +} + + + +void +SparseDirectUMFPACK::Tvmult ( + BlockVector<double> &dst, + const BlockVector<double> &src) const +{ + dst = src; + this->solve(dst, /*transpose=*/ true); } @@ -465,6 +488,7 @@ SparseDirectUMFPACK::Tvmult_add ( + #ifdef DEAL_II_WITH_MUMPS SparseDirectMUMPS::SparseDirectMUMPS () @@ -521,14 +545,14 @@ void SparseDirectMUMPS::initialize_matrix (const Matrix &matrix) irn = new int[nz]; jcn = new int[nz]; - unsigned int index = 0; + size_type index = 0; // loop over the elements of the matrix row by row, as suggested in // the documentation of the sparse matrix iterator class - for (unsigned int row = 0; row < matrix.m(); ++row) + 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 (); @@ -567,7 +591,7 @@ void SparseDirectMUMPS::initialize (const Matrix &matrix, // Object denoting a MUMPS data structure rhs = new double[n]; - for (unsigned int i = 0; i < n; ++i) + for (size_type i = 0; i < n; ++i) rhs[i] = vector (i); id.rhs = rhs; @@ -579,7 +603,7 @@ void SparseDirectMUMPS::copy_solution (Vector<double> &vector) // Copy solution into the given vector if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) { - for (unsigned int i=0; i<n; ++i) + for (size_type i=0; i<n; ++i) vector(i) = rhs[i]; delete[] rhs; @@ -625,7 +649,7 @@ void SparseDirectMUMPS::vmult (Vector<double> &dst, // Object denoting a MUMPS data structure: rhs = new double[n]; - for (unsigned int i = 0; i < n; ++i) + for (size_type i = 0; i < n; ++i) rhs[i] = src (i); id.rhs = rhs; @@ -641,17 +665,19 @@ void SparseDirectMUMPS::vmult (Vector<double> &dst, // explicit instantiations for SparseMatrixUMFPACK -#define InstantiateUMFPACK(MATRIX) \ - template \ - void SparseDirectUMFPACK::factorize (const MATRIX &); \ - template \ - void SparseDirectUMFPACK::solve (const MATRIX &, \ - Vector<double> &); \ - template \ - void SparseDirectUMFPACK::solve (const MATRIX &, \ - BlockVector<double> &); \ - template \ - void SparseDirectUMFPACK::initialize (const MATRIX &, \ +#define InstantiateUMFPACK(MATRIX) \ + template \ + void SparseDirectUMFPACK::factorize (const MATRIX &); \ + template \ + void SparseDirectUMFPACK::solve (const MATRIX &, \ + Vector<double> &, \ + bool); \ + template \ + void SparseDirectUMFPACK::solve (const MATRIX &, \ + BlockVector<double> &, \ + bool); \ + template \ + void SparseDirectUMFPACK::initialize (const MATRIX &, \ const AdditionalData); InstantiateUMFPACK(SparseMatrix<double>) @@ -663,8 +689,8 @@ InstantiateUMFPACK(BlockSparseMatrix<float>) // explicit instantiations for SparseDirectMUMPS #ifdef DEAL_II_WITH_MUMPS -#define InstantiateMUMPS(MATRIX) \ - template \ +#define InstantiateMUMPS(MATRIX) \ + template \ void SparseDirectMUMPS::initialize (const MATRIX &, const Vector<double> &); InstantiateMUMPS(SparseMatrix<double>) 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 <deal.II/lac/sparse_ilu.templates.h> 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 <deal.II/lac/sparse_matrix.templates.h> #include <deal.II/lac/block_vector.h> diff --git a/deal.II/source/lac/sparse_matrix.inst.in b/deal.II/source/lac/sparse_matrix.inst.in index a958f23424..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 @@ -32,16 +36,16 @@ for (S1, S2 : REAL_SCALARS) template void SparseMatrix<S1>::add<S2> (const S1, const SparseMatrix<S2> &); - template void SparseMatrix<S1>::add<S2> (const unsigned int, - const unsigned int, - const unsigned int *, + template void SparseMatrix<S1>::add<S2> (const size_type, + const size_type, + const size_type *, const S2 *, const bool, const bool); - template void SparseMatrix<S1>::set<S2> (const unsigned int, - const unsigned int, - const unsigned int *, + template void SparseMatrix<S1>::set<S2> (const size_type, + const size_type, + const size_type *, const S2 *, const bool); } @@ -95,13 +99,13 @@ for (S1, S2 : REAL_SCALARS) const S1) const; template void SparseMatrix<S1>:: PSOR<S2> (Vector<S2> &, - const std::vector<unsigned int>&, - const std::vector<unsigned int>&, + const std::vector<size_type>&, + const std::vector<size_type>&, const S1) const; template void SparseMatrix<S1>:: TPSOR<S2> (Vector<S2> &, - const std::vector<unsigned int>&, - const std::vector<unsigned int>&, + const std::vector<size_type>&, + const std::vector<size_type>&, const S1) const; template void SparseMatrix<S1>:: Jacobi_step<S2> (Vector<S2> &, @@ -215,13 +219,13 @@ for (S1, S2, S3: REAL_SCALARS) // const S1) const; // template void SparseMatrix<S1>:: // PSOR<S2> (Vector<S2> &, -// const std::vector<unsigned int>&, -// const std::vector<unsigned int>&, +// const std::vector<size_type>&, +// const std::vector<size_type>&, // const S1) const; // template void SparseMatrix<S1>:: // TPSOR<S2> (Vector<S2> &, -// const std::vector<unsigned int>&, -// const std::vector<unsigned int>&, +// const std::vector<size_type>&, +// const std::vector<size_type>&, // const S1) const; // template void SparseMatrix<S1>:: // SOR_step<S2> (Vector<S2> &, 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 <deal.II/lac/sparse_matrix_ez.templates.h> #include <deal.II/lac/block_vector.h> 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 <deal.II/lac/sparse_mic.templates.h> 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 <deal.II/lac/sparse_vanka.templates.h> diff --git a/deal.II/source/lac/sparsity_pattern.cc b/deal.II/source/lac/sparsity_pattern.cc index 5fa9044356..18f2c1b0de 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 <deal.II/base/vector_slice.h> #include <deal.II/base/utilities.h> @@ -32,7 +36,7 @@ DEAL_II_NAMESPACE_OPEN #ifdef DEAL_II_MSVC __declspec(selectany) // Weak extern binding due to multiple link error #endif -const unsigned int SparsityPattern::invalid_entry; +const SparsityPattern::size_type SparsityPattern::invalid_entry; @@ -70,8 +74,8 @@ SparsityPattern::SparsityPattern (const SparsityPattern &s) -SparsityPattern::SparsityPattern (const unsigned int m, - const unsigned int n, +SparsityPattern::SparsityPattern (const size_type m, + const size_type n, const unsigned int max_per_row, const bool) : @@ -87,8 +91,8 @@ SparsityPattern::SparsityPattern (const unsigned int m, -SparsityPattern::SparsityPattern (const unsigned int m, - const unsigned int n, +SparsityPattern::SparsityPattern (const size_type m, + const size_type n, const unsigned int max_per_row) : max_dim(0), @@ -103,8 +107,8 @@ SparsityPattern::SparsityPattern (const unsigned int m, -SparsityPattern::SparsityPattern (const unsigned int m, - const unsigned int n, +SparsityPattern::SparsityPattern (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths, const bool) : @@ -118,8 +122,8 @@ SparsityPattern::SparsityPattern (const unsigned int m, } -SparsityPattern::SparsityPattern (const unsigned int m, - const unsigned int n, +SparsityPattern::SparsityPattern (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths) : max_dim(0), @@ -133,7 +137,7 @@ SparsityPattern::SparsityPattern (const unsigned int m, -SparsityPattern::SparsityPattern (const unsigned int n, +SparsityPattern::SparsityPattern (const size_type n, const unsigned int max_per_row) : max_dim(0), @@ -146,7 +150,7 @@ SparsityPattern::SparsityPattern (const unsigned int n, -SparsityPattern::SparsityPattern (const unsigned int m, +SparsityPattern::SparsityPattern (const size_type m, const std::vector<unsigned int> &row_lengths, const bool) : @@ -159,7 +163,7 @@ SparsityPattern::SparsityPattern (const unsigned int m, } -SparsityPattern::SparsityPattern (const unsigned int m, +SparsityPattern::SparsityPattern (const size_type m, const std::vector<unsigned int> &row_lengths) : max_dim(0), @@ -173,8 +177,8 @@ SparsityPattern::SparsityPattern (const unsigned int m, SparsityPattern::SparsityPattern (const SparsityPattern &original, - const unsigned int max_per_row, - const unsigned int extra_off_diagonals) + const unsigned int max_per_row, + const size_type extra_off_diagonals) : max_dim(0), max_vec_len(0), @@ -188,7 +192,7 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, // now copy the entries from // the other object - for (unsigned int row=0; row<original.rows; ++row) + for (size_type row=0; row<original.rows; ++row) { // copy the elements of this row // of the other object @@ -207,12 +211,12 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, // the rest from that element onwards // which is not a side-diagonal any // more. - const unsigned int *const + const size_type *const original_row_start = &original.colnums[original.rowstart[row]] + 1; // the following requires that // @p{original} be compressed since // otherwise there might be invalid_entry's - const unsigned int *const + const size_type *const original_row_end = &original.colnums[original.rowstart[row+1]]; // find pointers before and @@ -222,7 +226,7 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, // these pointers such that no // copying is necessary (see // the @p{copy} commands) - const unsigned int *const + const size_type *const original_last_before_side_diagonals = (row > extra_off_diagonals ? Utilities::lower_bound (original_row_start, @@ -230,7 +234,7 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, row-extra_off_diagonals) : original_row_start); - const unsigned int *const + const size_type *const original_first_after_side_diagonals = (row < rows-extra_off_diagonals-1 ? std::upper_bound (original_row_start, @@ -241,7 +245,7 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, // find first free slot. the // first slot in each row is // the diagonal element - unsigned int *next_free_slot = &colnums[rowstart[row]] + 1; + size_type *next_free_slot = &colnums[rowstart[row]] + 1; // copy elements before side-diagonals next_free_slot = std::copy (original_row_start, @@ -249,10 +253,10 @@ SparsityPattern::SparsityPattern (const SparsityPattern &original, next_free_slot); // insert left and right side-diagonals - for (unsigned int i=1; i<=std::min(row,extra_off_diagonals); + for (size_type i=1; i<=std::min(row,extra_off_diagonals); ++i, ++next_free_slot) *next_free_slot = row-i; - for (unsigned int i=1; i<=std::min(extra_off_diagonals, rows-row-1); + for (size_type i=1; i<=std::min(extra_off_diagonals, rows-row-1); ++i, ++next_free_slot) *next_free_slot = row+i; @@ -301,8 +305,8 @@ SparsityPattern::operator = (const SparsityPattern &s) void -SparsityPattern::reinit (const unsigned int m, - const unsigned int n, +SparsityPattern::reinit (const size_type m, + const size_type n, const unsigned int max_per_row, const bool) { @@ -315,8 +319,8 @@ SparsityPattern::reinit (const unsigned int m, void -SparsityPattern::reinit (const unsigned int m, - const unsigned int n, +SparsityPattern::reinit (const size_type m, + const size_type n, const unsigned int max_per_row) { // simply map this function to the @@ -328,8 +332,8 @@ SparsityPattern::reinit (const unsigned int m, void -SparsityPattern::reinit (const unsigned int m, - const unsigned int n, +SparsityPattern::reinit (const size_type m, + const size_type n, const VectorSlice<const std::vector<unsigned int> > &row_lengths, const bool) { @@ -339,8 +343,8 @@ SparsityPattern::reinit (const unsigned int m, void -SparsityPattern::reinit (const unsigned int m, - const unsigned int n, +SparsityPattern::reinit (const size_type m, + const size_type n, const VectorSlice<const std::vector<unsigned int> > &row_lengths) { AssertDimension (row_lengths.size(), m); @@ -381,11 +385,12 @@ SparsityPattern::reinit (const unsigned int m, // note that the number of elements // per row is bounded by the number // of columns + // std::size_t vec_len = 0; - for (unsigned int i=0; i<m; ++i) - vec_len += std::min((store_diagonal_first_in_row ? - std::max(row_lengths[i], 1U) : - row_lengths[i]), + for (size_type i=0; i<m; ++i) + vec_len += std::min(static_cast<size_type>(store_diagonal_first_in_row ? + std::max(row_lengths[i], 1U) : + row_lengths[i]), n); // sometimes, no entries are @@ -405,13 +410,13 @@ SparsityPattern::reinit (const unsigned int m, } max_vec_len = vec_len; - colnums = new unsigned int[max_vec_len]; + colnums = new size_type[max_vec_len]; } max_row_length = (row_lengths.size() == 0 ? 0 : - std::min (*std::max_element(row_lengths.begin(), - row_lengths.end()), + std::min (static_cast<size_type>(*std::max_element(row_lengths.begin(), + row_lengths.end())), n)); if (store_diagonal_first_in_row && (max_row_length==0) && (m!=0)) @@ -454,16 +459,17 @@ SparsityPattern::reinit (const unsigned int m, } max_vec_len = vec_len; - colnums = new unsigned int[max_vec_len]; + colnums = new size_type[max_vec_len]; } // set the rowstart array rowstart[0] = 0; - for (unsigned int i=1; i<=rows; ++i) + for (size_type i=1; i<=rows; ++i) rowstart[i] = rowstart[i-1] + (store_diagonal_first_in_row ? - std::max(std::min(row_lengths[i-1],n),1U) : - std::min(row_lengths[i-1],n)); + std::max(std::min(static_cast<size_type>(row_lengths[i-1]),n), + static_cast<size_type> (1U)) : + std::min(static_cast<size_type>(row_lengths[i-1]),n)); Assert ((rowstart[rows]==vec_len) || ((vec_len == 1) && (rowstart[rows] == 0)), @@ -478,7 +484,7 @@ SparsityPattern::reinit (const unsigned int m, // special: let the first entry in // each row be the diagonal value if (store_diagonal_first_in_row) - for (unsigned int i=0; i<rows; i++) + for (size_type i=0; i<rows; i++) colnums[rowstart[i]] = i; compressed = false; @@ -495,9 +501,9 @@ SparsityPattern::compress () if (compressed) return; - unsigned int next_free_entry = 0, - next_row_start = 0, - row_length = 0; + size_type next_free_entry = 0, + next_row_start = 0, + row_length = 0; // first find out how many non-zero // elements there are, in order to @@ -506,22 +512,22 @@ SparsityPattern::compress () const std::size_t nonzero_elements = std::count_if (&colnums[rowstart[0]], &colnums[rowstart[rows]], - std::bind2nd(std::not_equal_to<unsigned int>(), invalid_entry)); + std::bind2nd(std::not_equal_to<size_type>(), invalid_entry)); // now allocate the respective memory - unsigned int *new_colnums = new unsigned int[nonzero_elements]; + size_type *new_colnums = new size_type[nonzero_elements]; // reserve temporary storage to // store the entries of one row - std::vector<unsigned int> tmp_entries (max_row_length); + std::vector<size_type> tmp_entries (max_row_length); // Traverse all rows - for (unsigned int line=0; line<rows; ++line) + for (size_type line=0; line<rows; ++line) { // copy used entries, break if // first unused entry is reached row_length = 0; - for (unsigned int j=rowstart[line]; j<rowstart[line+1]; ++j,++row_length) + for (size_type j=rowstart[line]; j<rowstart[line+1]; ++j,++row_length) if (colnums[j] != invalid_entry) tmp_entries[row_length] = colnums[j]; else @@ -545,7 +551,7 @@ SparsityPattern::compress () // insert column numbers // into the new field - for (unsigned int j=0; j<row_length; ++j) + for (size_type j=0; j<row_length; ++j) new_colnums[next_free_entry++] = tmp_entries[j]; // note new start of this and @@ -638,7 +644,7 @@ SparsityPattern::copy_from (const CSP &csp) // row or not const bool do_diag_optimize = (csp.n_rows() == csp.n_cols()); std::vector<unsigned int> row_lengths (csp.n_rows()); - for (unsigned int i=0; i<csp.n_rows(); ++i) + for (size_type i=0; i<csp.n_rows(); ++i) { row_lengths[i] = csp.row_length(i); if (do_diag_optimize && !csp.exists(i,i)) @@ -653,15 +659,15 @@ SparsityPattern::copy_from (const CSP &csp) // the diagonal element // preallocated if (n_rows() != 0 && n_cols() != 0) - for (unsigned int row = 0; row<csp.n_rows(); ++row) + for (size_type row = 0; row<csp.n_rows(); ++row) { - unsigned int *cols = &colnums[rowstart[row]] + (do_diag_optimize ? 1 : 0); + size_type *cols = &colnums[rowstart[row]] + (do_diag_optimize ? 1 : 0); typename CSP::row_iterator col_num = csp.row_begin (row), end_row = csp.row_end (row); for (; col_num != end_row; ++col_num) { - const unsigned int col = *col_num; + const size_type col = *col_num; if ((col!=row) || !do_diag_optimize) *cols++ = col; } @@ -694,9 +700,9 @@ void SparsityPattern::copy_from (const FullMatrix<number> &matrix) // diagonal entry, unless we have already // counted it std::vector<unsigned int> entries_per_row (matrix.m(), 0); - for (unsigned int row=0; row<matrix.m(); ++row) + for (size_type row=0; row<matrix.m(); ++row) { - for (unsigned int col=0; col<matrix.n(); ++col) + for (size_type col=0; col<matrix.n(); ++col) if (matrix(row,col) != 0) ++entries_per_row[row]; if ((matrix.m() == matrix.n()) @@ -710,8 +716,8 @@ void SparsityPattern::copy_from (const FullMatrix<number> &matrix) reinit (matrix.m(), matrix.n(), entries_per_row); // now set entries - for (unsigned int row=0; row<matrix.m(); ++row) - for (unsigned int col=0; col<matrix.n(); ++col) + for (size_type row=0; row<matrix.m(); ++row) + for (size_type col=0; col<matrix.n(); ++col) if (matrix(row,col) != 0) add (row,col); @@ -721,8 +727,8 @@ void SparsityPattern::copy_from (const FullMatrix<number> &matrix) void -SparsityPattern::reinit (const unsigned int m, - const unsigned int n, +SparsityPattern::reinit (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths, const bool) { @@ -732,8 +738,8 @@ SparsityPattern::reinit (const unsigned int m, void -SparsityPattern::reinit (const unsigned int m, - const unsigned int n, +SparsityPattern::reinit (const size_type m, + const size_type n, const std::vector<unsigned int> &row_lengths) { reinit(m, n, make_slice(row_lengths)); @@ -769,7 +775,7 @@ SparsityPattern::empty () const -unsigned int +SparsityPattern::size_type SparsityPattern::max_entries_per_row () const { // if compress() has not yet been @@ -782,18 +788,18 @@ SparsityPattern::max_entries_per_row () const // if compress() was called, we // use a better algorithm which // gives us a sharp bound - unsigned int m = 0; - for (unsigned int i=1; i<rows; ++i) - m = std::max (m, static_cast<unsigned int>(rowstart[i]-rowstart[i-1])); + size_type m = 0; + for (size_type i=1; i<rows; ++i) + m = std::max (m, static_cast<size_type>(rowstart[i]-rowstart[i-1])); return m; } -unsigned int -SparsityPattern::operator () (const unsigned int i, - const unsigned int j) const +SparsityPattern::size_type +SparsityPattern::operator () (const size_type i, + const size_type j) const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); Assert (i<rows, ExcIndexRange(i,0,rows)); @@ -824,13 +830,13 @@ SparsityPattern::operator () (const unsigned int i, // top of this function, so it may // not be called for noncompressed // structures. - const unsigned int *sorted_region_start = (store_diagonal_first_in_row ? - &colnums[rowstart[i]+1] : - &colnums[rowstart[i]]); - const unsigned int *const p - = Utilities::lower_bound<const unsigned int *> (sorted_region_start, - &colnums[rowstart[i+1]], - j); + const size_type *sorted_region_start = (store_diagonal_first_in_row ? + &colnums[rowstart[i]+1] : + &colnums[rowstart[i]]); + const size_type *const p + = Utilities::lower_bound<const size_type *> (sorted_region_start, + &colnums[rowstart[i+1]], + j); if ((p != &colnums[rowstart[i+1]]) && (*p == j)) return (p - &colnums[0]); else @@ -840,8 +846,8 @@ SparsityPattern::operator () (const unsigned int i, void -SparsityPattern::add (const unsigned int i, - const unsigned int j) +SparsityPattern::add (const size_type i, + const size_type j) { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); Assert (i<rows, ExcIndexRange(i,0,rows)); @@ -869,10 +875,10 @@ SparsityPattern::add (const unsigned int i, template <typename ForwardIterator> void -SparsityPattern::add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted) +SparsityPattern::add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted) { if (indices_are_sorted == true) { @@ -913,13 +919,13 @@ SparsityPattern::add_entries (const unsigned int row, bool -SparsityPattern::exists (const unsigned int i, const unsigned int j) const +SparsityPattern::exists (const size_type i, const size_type j) const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); Assert (i<rows, ExcIndexRange(i,0,rows)); Assert (j<cols, ExcIndexRange(j,0,cols)); - for (unsigned int k=rowstart[i]; k<rowstart[i+1]; k++) + for (size_type k=rowstart[i]; k<rowstart[i+1]; k++) { // entry already exists if (colnums[k] == j) return true; @@ -929,25 +935,25 @@ SparsityPattern::exists (const unsigned int i, const unsigned int j) const -unsigned int -SparsityPattern::row_position (const unsigned int i, const unsigned int j) const +SparsityPattern::size_type +SparsityPattern::row_position (const size_type i, const size_type j) const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); Assert (i<rows, ExcIndexRange(i,0,rows)); Assert (j<cols, ExcIndexRange(j,0,cols)); - for (unsigned int k=rowstart[i]; k<rowstart[i+1]; k++) + for (size_type k=rowstart[i]; k<rowstart[i+1]; k++) { // entry exists if (colnums[k] == j) return k-rowstart[i]; } - return numbers::invalid_unsigned_int; + return numbers::invalid_size_type; } -std::pair<unsigned int, unsigned int> -SparsityPattern::matrix_position (const unsigned int global_index) const +std::pair<SparsityPattern::size_type, SparsityPattern::size_type> +SparsityPattern::matrix_position (const size_type global_index) const { Assert (compressed == true, ExcNotCompressed()); Assert (global_index < n_nonzero_elements(), @@ -962,14 +968,14 @@ SparsityPattern::matrix_position (const unsigned int global_index) const // for the one-past-last row, we // can simply use a bisection // search on it - const unsigned int row + const size_type row = (std::upper_bound (&rowstart[0], &rowstart[rows], global_index) - &rowstart[0] - 1); // now, the column index is simple // since that is what the colnums // array stores: - const unsigned int col = colnums[global_index]; + const size_type col = colnums[global_index]; // so return the respective pair return std::make_pair (row,col); @@ -998,8 +1004,8 @@ SparsityPattern::symmetrize () // 2. that the @p{add} function can // be called on elements that // already exist without any harm - for (unsigned int row=0; row<rows; ++row) - for (unsigned int k=rowstart[row]; k<rowstart[row+1]; k++) + for (size_type row=0; row<rows; ++row) + for (size_type k=rowstart[row]; k<rowstart[row+1]; k++) { // check whether we are at // the end of the entries of @@ -1027,10 +1033,10 @@ SparsityPattern::print (std::ostream &out) const AssertThrow (out, ExcIO()); - for (unsigned int i=0; i<rows; ++i) + for (size_type i=0; i<rows; ++i) { out << '[' << i; - for (unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j) + for (size_type j=rowstart[i]; j<rowstart[i+1]; ++j) if (colnums[j] != invalid_entry) out << ',' << colnums[j]; out << ']' << std::endl; @@ -1048,8 +1054,8 @@ SparsityPattern::print_gnuplot (std::ostream &out) const AssertThrow (out, ExcIO()); - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j) + for (size_type i=0; i<rows; ++i) + for (size_type j=rowstart[i]; j<rowstart[i+1]; ++j) if (colnums[j] != invalid_entry) // while matrix entries are // usually written (i,j), @@ -1065,16 +1071,16 @@ SparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +SparsityPattern::size_type SparsityPattern::bandwidth () const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); - unsigned int b=0; - for (unsigned int i=0; i<rows; ++i) - for (unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j) + size_type b=0; + for (size_type i=0; i<rows; ++i) + for (size_type j=rowstart[i]; j<rowstart[i+1]; ++j) if (colnums[j] != invalid_entry) { - if (static_cast<unsigned int>(std::abs(static_cast<int>(i-colnums[j]))) > b) + if (static_cast<size_type>(std::abs(static_cast<int>(i-colnums[j]))) > b) b = std::abs(static_cast<signed int>(i-colnums[j])); } else @@ -1144,7 +1150,7 @@ SparsityPattern::block_read (std::istream &in) delete[] colnums; rowstart = new std::size_t[max_dim+1]; - colnums = new unsigned int[max_vec_len]; + colnums = new size_type[max_vec_len]; // then read data in.read (reinterpret_cast<char *>(&rowstart[0]), @@ -1166,9 +1172,9 @@ SparsityPattern::block_read (std::istream &in) std::size_t SparsityPattern::memory_consumption () const { - return (max_dim * sizeof(unsigned int) + + return (max_dim * sizeof(size_type) + sizeof(*this) + - max_vec_len * sizeof(unsigned int)); + max_vec_len * sizeof(size_type)); } @@ -1195,21 +1201,21 @@ template void SparsityPattern::copy_from<CompressedSimpleSparsityPattern> (const template void SparsityPattern::copy_from<float> (const FullMatrix<float> &); template void SparsityPattern::copy_from<double> (const FullMatrix<double> &); -template void SparsityPattern::add_entries<const unsigned int *> (const unsigned int, - const unsigned int *, - const unsigned int *, +template void SparsityPattern::add_entries<const SparsityPattern::size_type *> (const size_type , + const size_type *, + const size_type *, const bool); #ifndef DEAL_II_VECTOR_ITERATOR_IS_POINTER -template void SparsityPattern::add_entries<std::vector<unsigned int>::const_iterator> -(const unsigned int, - std::vector<unsigned int>::const_iterator, - std::vector<unsigned int>::const_iterator, +template void SparsityPattern::add_entries<std::vector<SparsityPattern::size_type>::const_iterator> +(const size_type, + std::vector<size_type>::const_iterator, + std::vector<size_type>::const_iterator, const bool); #endif -template void SparsityPattern::add_entries<std::vector<unsigned int>::iterator> -(const unsigned int, - std::vector<unsigned int>::iterator, - std::vector<unsigned int>::iterator, +template void SparsityPattern::add_entries<std::vector<SparsityPattern::size_type>::iterator> +(const size_type, + std::vector<size_type>::iterator, + std::vector<size_type>::iterator, const bool); DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/lac/sparsity_tools.cc b/deal.II/source/lac/sparsity_tools.cc index 218f348d8e..f88015c32b 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 <deal.II/base/exceptions.h> #include <deal.II/lac/exceptions.h> @@ -89,7 +93,7 @@ namespace SparsityTools int_rowstart.reserve(sparsity_pattern.n_rows()+1); std::vector<idx_t> int_colnums; int_colnums.reserve(sparsity_pattern.n_nonzero_elements()); - for (unsigned int row=0; row<sparsity_pattern.n_rows(); ++row) + for (size_type row=0; row<sparsity_pattern.n_rows(); ++row) { for (SparsityPattern::iterator col=sparsity_pattern.begin(row); col < sparsity_pattern.end(row); ++col) @@ -139,19 +143,19 @@ namespace SparsityTools { /** * Given a connectivity graph and a list of indices (where - * invalid_unsigned_int indicates that a node has not been numbered yet), + * invalid_size_type indicates that a node has not been numbered yet), * pick a valid starting index among the as-yet unnumbered one. */ - unsigned int + size_type find_unnumbered_starting_index (const SparsityPattern &sparsity, - const std::vector<unsigned int> &new_indices) + const std::vector<size_type> &new_indices) { { - unsigned int starting_point = numbers::invalid_unsigned_int; - unsigned int min_coordination = sparsity.n_rows(); - for (unsigned int row=0; row<sparsity.n_rows(); ++row) + size_type starting_point = numbers::invalid_size_type; + size_type min_coordination = sparsity.n_rows(); + for (size_type row=0; row<sparsity.n_rows(); ++row) // look over all as-yet unnumbered indices - if (new_indices[row] == numbers::invalid_unsigned_int) + if (new_indices[row] == numbers::invalid_size_type) { SparsityPattern::iterator j = sparsity.begin(row); @@ -161,7 +165,7 @@ namespace SparsityTools break; // post-condition after loop: coordination, i.e. the number of // entries in this row is now j-rowstart[row] - if (static_cast<unsigned int>(j-sparsity.begin(row)) < + if (static_cast<size_type>(j-sparsity.begin(row)) < min_coordination) { min_coordination = j-sparsity.begin(row); @@ -176,16 +180,16 @@ namespace SparsityTools // // if that should be the case, we can chose an arbitrary dof as // starting point, e.g. the first unnumbered one - if (starting_point == numbers::invalid_unsigned_int) + if (starting_point == numbers::invalid_size_type) { - for (unsigned int i=0; i<new_indices.size(); ++i) - if (new_indices[i] == numbers::invalid_unsigned_int) + for (size_type i=0; i<new_indices.size(); ++i) + if (new_indices[i] == numbers::invalid_size_type) { starting_point = i; break; } - Assert (starting_point != numbers::invalid_unsigned_int, + Assert (starting_point != numbers::invalid_size_type, ExcInternalError()); } @@ -197,8 +201,8 @@ namespace SparsityTools void reorder_Cuthill_McKee (const SparsityPattern &sparsity, - std::vector<unsigned int> &new_indices, - const std::vector<unsigned int> &starting_indices) + std::vector<size_type> &new_indices, + const std::vector<size_type> &starting_indices) { Assert (sparsity.n_rows() == sparsity.n_cols(), ExcDimensionMismatch (sparsity.n_rows(), sparsity.n_cols())); @@ -206,27 +210,27 @@ namespace SparsityTools ExcDimensionMismatch (sparsity.n_rows(), new_indices.size())); Assert (starting_indices.size() <= sparsity.n_rows(), ExcMessage ("You can't specify more starting indices than there are rows")); - for (unsigned int i=0; i<starting_indices.size(); ++i) + for (size_type i=0; i<starting_indices.size(); ++i) Assert (starting_indices[i] < sparsity.n_rows(), ExcMessage ("Invalid starting index")); // store the indices of the dofs renumbered in the last round. Default to // starting points - std::vector<unsigned int> last_round_dofs (starting_indices); + std::vector<size_type> last_round_dofs (starting_indices); // initialize the new_indices array with invalid values std::fill (new_indices.begin(), new_indices.end(), - numbers::invalid_unsigned_int); + numbers::invalid_size_type); // delete disallowed elements - for (unsigned int i=0; i<last_round_dofs.size(); ++i) - if ((last_round_dofs[i]==numbers::invalid_unsigned_int) || + for (size_type i=0; i<last_round_dofs.size(); ++i) + if ((last_round_dofs[i]==numbers::invalid_size_type) || (last_round_dofs[i]>=sparsity.n_rows())) - last_round_dofs[i] = numbers::invalid_unsigned_int; + last_round_dofs[i] = numbers::invalid_size_type; std::remove_if (last_round_dofs.begin(), last_round_dofs.end(), - std::bind2nd(std::equal_to<unsigned int>(), - numbers::invalid_unsigned_int)); + std::bind2nd(std::equal_to<size_type>(), + numbers::invalid_size_type)); // now if no valid points remain: find dof with lowest coordination number if (last_round_dofs.empty()) @@ -235,10 +239,10 @@ namespace SparsityTools new_indices)); // store next free dof index - unsigned int next_free_number = 0; + size_type next_free_number = 0; // enumerate the first round dofs - for (unsigned int i=0; i!=last_round_dofs.size(); ++i) + for (size_type i=0; i!=last_round_dofs.size(); ++i) new_indices[last_round_dofs[i]] = next_free_number++; // now do as many steps as needed to @@ -247,12 +251,12 @@ namespace SparsityTools { // store the indices of the dofs to be // renumbered in the next round - std::vector<unsigned int> next_round_dofs; + std::vector<size_type> next_round_dofs; // find all neighbors of the // dofs numbered in the last // round - for (unsigned int i=0; i<last_round_dofs.size(); ++i) + for (size_type i=0; i<last_round_dofs.size(); ++i) for (SparsityPattern::iterator j=sparsity.begin(last_round_dofs[i]); j<sparsity.end(last_round_dofs[i]); ++j) if (j->is_valid_entry() == false) @@ -264,14 +268,14 @@ namespace SparsityTools std::sort (next_round_dofs.begin(), next_round_dofs.end()); // delete multiple entries - std::vector<unsigned int>::iterator end_sorted; + std::vector<size_type>::iterator end_sorted; end_sorted = std::unique (next_round_dofs.begin(), next_round_dofs.end()); next_round_dofs.erase (end_sorted, next_round_dofs.end()); // eliminate dofs which are // already numbered for (int s=next_round_dofs.size()-1; s>=0; --s) - if (new_indices[next_round_dofs[s]] != numbers::invalid_unsigned_int) + if (new_indices[next_round_dofs[s]] != numbers::invalid_size_type) next_round_dofs.erase (next_round_dofs.begin() + s); // check whether there are @@ -288,7 +292,7 @@ namespace SparsityTools if (next_round_dofs.empty()) { if (std::find (new_indices.begin(), new_indices.end(), - numbers::invalid_unsigned_int) + numbers::invalid_size_type) == new_indices.end()) // no unnumbered @@ -327,14 +331,14 @@ namespace SparsityTools // store for each coordination // number the dofs with these // coordination number - std::multimap<unsigned int, int> dofs_by_coordination; + std::multimap<size_type, int> dofs_by_coordination; // find coordination number for // each of these dofs - for (std::vector<unsigned int>::iterator s=next_round_dofs.begin(); + for (std::vector<size_type>::iterator s=next_round_dofs.begin(); s!=next_round_dofs.end(); ++s) { - unsigned int coordination = 0; + size_type coordination = 0; for (SparsityPattern::iterator j=sparsity.begin(*s); j<sparsity.end(*s); ++j) if (j->is_valid_entry() == false) @@ -344,14 +348,14 @@ namespace SparsityTools // insert this dof at its // coordination number - const std::pair<const unsigned int, int> new_entry (coordination, *s); + const std::pair<const size_type, int> new_entry (coordination, *s); dofs_by_coordination.insert (new_entry); } // assign new DoF numbers to // the elements of the present // front: - std::multimap<unsigned int, int>::iterator i; + std::multimap<size_type, int>::iterator i; for (i = dofs_by_coordination.begin(); i!=dofs_by_coordination.end(); ++i) new_indices[i->second] = next_free_number++; @@ -366,7 +370,7 @@ namespace SparsityTools // front-marching-algorithm (which // Cuthill-McKee actually is) has // reached all points. - Assert ((std::find (new_indices.begin(), new_indices.end(), numbers::invalid_unsigned_int) + Assert ((std::find (new_indices.begin(), new_indices.end(), numbers::invalid_size_type) == new_indices.end()) && @@ -377,27 +381,27 @@ namespace SparsityTools #ifdef DEAL_II_WITH_MPI template <class CSP_t> void distribute_sparsity_pattern(CSP_t &csp, - const std::vector<unsigned int> &rows_per_cpu, + const std::vector<size_type> &rows_per_cpu, const MPI_Comm &mpi_comm, const IndexSet &myrange) { - unsigned int myid = Utilities::MPI::this_mpi_process(mpi_comm); - std::vector<unsigned int> start_index(rows_per_cpu.size()+1); + size_type myid = Utilities::MPI::this_mpi_process(mpi_comm); + std::vector<size_type> start_index(rows_per_cpu.size()+1); start_index[0]=0; - for (unsigned int i=0; i<rows_per_cpu.size(); ++i) + for (size_type i=0; i<rows_per_cpu.size(); ++i) start_index[i+1]=start_index[i]+rows_per_cpu[i]; - typedef std::map<unsigned int, std::vector<unsigned int> > map_vec_t; + typedef std::map<size_type, std::vector<size_type> > map_vec_t; map_vec_t send_data; { unsigned int dest_cpu=0; - unsigned int n_local_rel_rows = myrange.n_elements(); - for (unsigned int row_idx=0; row_idx<n_local_rel_rows; ++row_idx) + size_type n_local_rel_rows = myrange.n_elements(); + for (size_type row_idx=0; row_idx<n_local_rel_rows; ++row_idx) { - unsigned int row=myrange.nth_index_in_set(row_idx); + size_type row=myrange.nth_index_in_set(row_idx); //calculate destination CPU while (row>=start_index[dest_cpu+1]) @@ -410,21 +414,21 @@ namespace SparsityTools continue; } - unsigned int rlen = csp.row_length(row); + size_type rlen = csp.row_length(row); //skip empty lines if (!rlen) continue; //save entries - std::vector<unsigned int> &dst = send_data[dest_cpu]; + std::vector<size_type> &dst = send_data[dest_cpu]; dst.push_back(rlen); // number of entries dst.push_back(row); // row index - for (unsigned int c=0; c<rlen; ++c) + for (size_type c=0; c<rlen; ++c) { //columns - unsigned int column = csp.column_number(row, c); + size_type column = csp.column_number(row, c); dst.push_back(column); } } @@ -452,16 +456,19 @@ namespace SparsityTools for (map_vec_t::iterator it=send_data.begin(); it!=send_data.end(); ++it, ++idx) MPI_Isend(&(it->second[0]), it->second.size(), - MPI_INT, + 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<unsigned int> recv_buf; + std::vector<size_type> recv_buf; for (unsigned int index=0; index<num_receive; ++index) { MPI_Status status; @@ -472,17 +479,17 @@ namespace SparsityTools MPI_Get_count(&status, MPI_BYTE, &len); Assert( len%sizeof(unsigned int)==0, ExcInternalError()); - recv_buf.resize(len/sizeof(unsigned int)); + recv_buf.resize(len/sizeof(size_type)); MPI_Recv(&recv_buf[0], len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG, mpi_comm, &status); - std::vector<unsigned int>::const_iterator ptr = recv_buf.begin(); - std::vector<unsigned int>::const_iterator end = recv_buf.end(); + std::vector<size_type>::const_iterator ptr = recv_buf.begin(); + std::vector<size_type>::const_iterator end = recv_buf.end(); while (ptr+1<end) { - unsigned int num=*(ptr++); - unsigned int row=*(ptr++); + size_type num=*(ptr++); + size_type row=*(ptr++); for (unsigned int c=0; c<num; ++c) { csp.add(row, *ptr); @@ -490,7 +497,6 @@ namespace SparsityTools } } Assert(ptr==end, ExcInternalError()); - } } @@ -507,7 +513,7 @@ namespace SparsityTools #define SPARSITY_FUNCTIONS(SparsityType) \ template void SparsityTools::distribute_sparsity_pattern<SparsityType> (SparsityType & csp, \ - const std::vector<unsigned int> & rows_per_cpu,\ + const std::vector<size_type> & rows_per_cpu,\ const MPI_Comm & mpi_comm,\ const IndexSet & myrange) 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 <deal.II/lac/swappable_vector.templates.h> diff --git a/deal.II/source/lac/tridiagonal_matrix.cc b/deal.II/source/lac/tridiagonal_matrix.cc index ede29f74c5..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 <deal.II/lac/tridiagonal_matrix.h> #include <deal.II/lac/vector.h> @@ -21,7 +25,7 @@ using namespace LAPACKSupport; template<typename number> TridiagonalMatrix<number>::TridiagonalMatrix( - unsigned int size, + size_type size, bool symmetric) : diagonal(size, 0.), @@ -35,7 +39,7 @@ TridiagonalMatrix<number>::TridiagonalMatrix( template<typename number> void TridiagonalMatrix<number>::reinit( - unsigned int size, + size_type size, bool symmetric) { is_symmetric = symmetric; @@ -86,7 +90,7 @@ TridiagonalMatrix<number>::vmult ( // The actual loop skips the first // and last row - const unsigned int e=n()-1; + const size_type e=n()-1; // Let iterators point to the first // entry of each diagonal typename std::vector<number>::const_iterator d = diagonal.begin(); @@ -107,7 +111,7 @@ TridiagonalMatrix<number>::vmult ( ++d; ++r; // All rows with three entries - for (unsigned int i=1; i<e; ++i,++d,++r,++l) + for (size_type i=1; i<e; ++i,++d,++r,++l) w(i) += (*l) * v(i-1) + (*d) * v(i) + (*r) * v(i+1); // Last row is special again w(e) += (*l) * v(e-1) + (*d) * v(e); @@ -117,7 +121,7 @@ TridiagonalMatrix<number>::vmult ( w(0) = (*d) * v(0) + (*r) * v(1); ++d; ++r; - for (unsigned int i=1; i<e; ++i,++d,++r,++l) + for (size_type i=1; i<e; ++i,++d,++r,++l) w(i) = (*l) * v(i-1) + (*d) * v(i) + (*r) * v(i+1); w(e) = (*l) * v(e-1) + (*d) * v(e); } @@ -148,7 +152,7 @@ TridiagonalMatrix<number>::Tvmult ( if (n()==0) return; - const unsigned int e=n()-1; + const size_type e=n()-1; typename std::vector<number>::const_iterator d = diagonal.begin(); typename std::vector<number>::const_iterator r = right.begin(); typename std::vector<number>::const_iterator l = left.begin(); @@ -162,7 +166,7 @@ TridiagonalMatrix<number>::Tvmult ( w(0) += (*d) * v(0) + (*l) * v(1); ++d; ++l; - for (unsigned int i=1; i<e; ++i,++d,++r,++l) + for (size_type i=1; i<e; ++i,++d,++r,++l) w(i) += (*l) * v(i+1) + (*d) * v(i) + (*r) * v(i-1); w(e) += (*d) * v(e) + (*r) * v(e-1); } @@ -171,7 +175,7 @@ TridiagonalMatrix<number>::Tvmult ( w(0) = (*d) * v(0) + (*l) * v(1); ++d; ++l; - for (unsigned int i=1; i<e; ++i,++d,++r,++l) + for (size_type i=1; i<e; ++i,++d,++r,++l) w(i) = (*l) * v(i+1) + (*d) * v(i) + (*r) * v(i-1); w(e) = (*d) * v(e) + (*r) * v(e-1); } @@ -196,7 +200,7 @@ TridiagonalMatrix<number>::matrix_scalar_product( { Assert(state == matrix, ExcState(state)); - const unsigned int e=n()-1; + const size_type e=n()-1; typename std::vector<number>::const_iterator d = diagonal.begin(); typename std::vector<number>::const_iterator r = right.begin(); typename std::vector<number>::const_iterator l = left.begin(); @@ -208,7 +212,7 @@ TridiagonalMatrix<number>::matrix_scalar_product( number result = w(0) * ((*d) * v(0) + (*r) * v(1)); ++d; ++r; - for (unsigned int i=1; i<e; ++i,++d,++r,++l) + for (size_type i=1; i<e; ++i,++d,++r,++l) result += w(i) * ((*l) * v(i-1)+ (*d) * v(i)+ (*r) * v(i+1)); result += w(e) * ((*l) * v(e-1) + (*d) * v(e)); return result; @@ -246,7 +250,7 @@ TridiagonalMatrix<double>::compute_eigenvalues() template<typename number> number -TridiagonalMatrix<number>::eigenvalue(const unsigned int i) const +TridiagonalMatrix<number>::eigenvalue(const size_type i) const { Assert(state == eigenvalues, ExcState(state)); Assert(i<n(), ExcIndexRange(i,0,n())); diff --git a/deal.II/source/lac/trilinos_block_sparse_matrix.cc b/deal.II/source/lac/trilinos_block_sparse_matrix.cc index 9c5cffcac3..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 <deal.II/lac/trilinos_block_sparse_matrix.h> @@ -49,8 +51,8 @@ namespace TrilinosWrappers void BlockSparseMatrix:: - reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns) + reinit (const size_type n_block_rows, + const size_type n_block_columns) { // first delete previous content of // the subobjects array @@ -65,8 +67,8 @@ namespace TrilinosWrappers this->column_block_indices.reinit (n_block_columns, 0); // and reinitialize the blocks - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { BlockType *p = new BlockType(); @@ -91,7 +93,7 @@ namespace TrilinosWrappers ExcDimensionMismatch (parallel_partitioning.size(), block_sparsity_pattern.n_block_cols())); - const unsigned int n_block_rows = parallel_partitioning.size(); + const size_type n_block_rows = parallel_partitioning.size(); Assert (n_block_rows == block_sparsity_pattern.n_block_rows(), ExcDimensionMismatch (n_block_rows, @@ -111,8 +113,8 @@ namespace TrilinosWrappers // ... and then assign the correct // data to the blocks. - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { this->sub_objects[r][c]->reinit (parallel_partitioning[r], parallel_partitioning[c], @@ -130,7 +132,7 @@ namespace TrilinosWrappers const MPI_Comm &communicator) { std::vector<Epetra_Map> epetra_maps; - for (unsigned int i=0; i<block_sparsity_pattern.n_block_rows(); ++i) + for (size_type i=0; i<block_sparsity_pattern.n_block_rows(); ++i) epetra_maps.push_back (parallel_partitioning[i].make_trilinos_map(communicator, false)); @@ -146,9 +148,9 @@ namespace TrilinosWrappers reinit (const BlockSparsityType &block_sparsity_pattern) { std::vector<Epetra_Map> parallel_partitioning; - for (unsigned int i=0; i<block_sparsity_pattern.n_block_rows(); ++i) + for (size_type i=0; i<block_sparsity_pattern.n_block_rows(); ++i) parallel_partitioning.push_back - (Epetra_Map(static_cast<int>(block_sparsity_pattern.block(i,0).n_rows()), + (Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(block_sparsity_pattern.block(i,0).n_rows()), 0, Utilities::Trilinos::comm_self())); @@ -173,8 +175,8 @@ namespace TrilinosWrappers // ... and then assign the correct // data to the blocks. - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { this->sub_objects[r][c]->reinit (block_sparsity_pattern.block(r,c)); } @@ -188,7 +190,7 @@ namespace TrilinosWrappers const ::dealii::BlockSparseMatrix<double> &dealii_block_sparse_matrix, const double drop_tolerance) { - const unsigned int n_block_rows = parallel_partitioning.size(); + const size_type n_block_rows = parallel_partitioning.size(); Assert (n_block_rows == dealii_block_sparse_matrix.n_block_rows(), ExcDimensionMismatch (n_block_rows, @@ -202,8 +204,8 @@ namespace TrilinosWrappers // ... and then assign the correct // data to the blocks. - for (unsigned int r=0; r<this->n_block_rows(); ++r) - for (unsigned int c=0; c<this->n_block_cols(); ++c) + for (size_type r=0; r<this->n_block_rows(); ++r) + for (size_type c=0; c<this->n_block_cols(); ++c) { this->sub_objects[r][c]->reinit(parallel_partitioning[r], parallel_partitioning[c], @@ -239,8 +241,8 @@ namespace TrilinosWrappers #endif std::vector<Epetra_Map> parallel_partitioning; - for (unsigned int i=0; i<dealii_block_sparse_matrix.n_block_rows(); ++i) - parallel_partitioning.push_back (Epetra_Map(static_cast<int>(dealii_block_sparse_matrix.block(i,0).m()), + for (size_type i=0; i<dealii_block_sparse_matrix.n_block_rows(); ++i) + parallel_partitioning.push_back (Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(dealii_block_sparse_matrix.block(i,0).m()), 0, trilinos_communicator)); @@ -260,12 +262,12 @@ namespace TrilinosWrappers - unsigned int + BlockSparseMatrix::size_type BlockSparseMatrix::n_nonzero_elements () const { - unsigned int n_nonzero = 0; - for (unsigned int rows = 0; rows<this->n_block_rows(); ++rows) - for (unsigned int cols = 0; cols<this->n_block_cols(); ++cols) + size_type n_nonzero = 0; + for (size_type rows = 0; rows<this->n_block_rows(); ++rows) + for (size_type cols = 0; cols<this->n_block_cols(); ++cols) n_nonzero += this->block(rows,cols).n_nonzero_elements(); return n_nonzero; @@ -402,6 +404,11 @@ namespace TrilinosWrappers BlockSparseMatrix::reinit (const std::vector<Epetra_Map> &, const dealii::BlockCompressedSimpleSparsityPattern &); + template void + BlockSparseMatrix::reinit (const std::vector<IndexSet> &, + 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 2d2b8cf746..b09660c236 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 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 <deal.II/lac/trilinos_block_vector.h> @@ -23,6 +25,26 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { + namespace + { + // define a helper function that queries the size of an Epetra_Map object + // 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 +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + int n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements(); + } +#else + long long int n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements64(); + } +#endif + } + + namespace MPI { BlockVector & @@ -40,7 +62,7 @@ namespace TrilinosWrappers if (this->n_blocks() != v.n_blocks()) reinit(v.n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.block(i); collect_sizes(); @@ -56,7 +78,7 @@ namespace TrilinosWrappers Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(),v.n_blocks())); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.block(i); return *this; @@ -73,19 +95,19 @@ namespace TrilinosWrappers BlockVector::reinit (const std::vector<Epetra_Map> &input_maps, const bool fast) { - const unsigned int no_blocks = input_maps.size(); - std::vector<unsigned int> block_sizes (no_blocks); + const size_type no_blocks = input_maps.size(); + std::vector<size_type> block_sizes (no_blocks); - for (unsigned int i=0; i<no_blocks; ++i) + for (size_type i=0; i<no_blocks; ++i) { - block_sizes[i] = input_maps[i].NumGlobalElements(); + block_sizes[i] = n_global_elements(input_maps[i]); } this->block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(input_maps[i], fast); collect_sizes(); @@ -98,10 +120,10 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const bool fast) { - const unsigned int no_blocks = parallel_partitioning.size(); - std::vector<unsigned int> block_sizes (no_blocks); + const size_type no_blocks = parallel_partitioning.size(); + std::vector<size_type> block_sizes (no_blocks); - for (unsigned int i=0; i<no_blocks; ++i) + for (size_type i=0; i<no_blocks; ++i) { block_sizes[i] = parallel_partitioning[i].size(); } @@ -110,12 +132,34 @@ namespace TrilinosWrappers if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(parallel_partitioning[i], communicator, fast); collect_sizes(); } + void + BlockVector::reinit (const std::vector<IndexSet> &parallel_partitioning, + const std::vector<IndexSet> &ghost_values, + const MPI_Comm &communicator) + { + const size_type no_blocks = parallel_partitioning.size(); + std::vector<size_type> block_sizes (no_blocks); + + for (size_type i=0; i<no_blocks; ++i) + { + block_sizes[i] = parallel_partitioning[i].size(); + } + + this->block_indices.reinit (block_sizes); + if (components.size() != n_blocks()) + components.resize(n_blocks()); + + for (size_type i=0; i<n_blocks(); ++i) + components[i].reinit(parallel_partitioning[i], ghost_values[i], communicator); + + collect_sizes(); + } void @@ -126,7 +170,7 @@ namespace TrilinosWrappers if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(v.block(i), fast, false); collect_sizes(); @@ -135,14 +179,14 @@ namespace TrilinosWrappers void - BlockVector::reinit (const unsigned int num_blocks) + BlockVector::reinit (const size_type num_blocks) { - std::vector<unsigned int> block_sizes (num_blocks, 0); + std::vector<size_type> block_sizes (num_blocks, 0); this->block_indices.reinit (block_sizes); if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) components[i].clear(); collect_sizes(); @@ -166,7 +210,7 @@ namespace TrilinosWrappers components.resize(v.n_blocks()); } - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) components[i].import_nonlocal_data_for_fe(m.block(i,i), v.block(i)); collect_sizes(); @@ -179,7 +223,7 @@ namespace TrilinosWrappers const bool scientific, const bool across) const { - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) { if (across) out << 'C' << i << ':'; @@ -209,18 +253,18 @@ namespace TrilinosWrappers BlockVector::reinit (const std::vector<Epetra_Map> &input_maps, const bool fast) { - unsigned int no_blocks = input_maps.size(); - std::vector<unsigned int> block_sizes (no_blocks); + size_type no_blocks = input_maps.size(); + std::vector<size_type> block_sizes (no_blocks); - for (unsigned int i=0; i<no_blocks; ++i) - block_sizes[i] = input_maps[i].NumGlobalElements(); + for (size_type i=0; i<no_blocks; ++i) + block_sizes[i] = n_global_elements(input_maps[i]); this->block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(input_maps[i], fast); collect_sizes(); @@ -233,10 +277,10 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const bool fast) { - unsigned int no_blocks = partitioning.size(); - std::vector<unsigned int> block_sizes (no_blocks); + size_type no_blocks = partitioning.size(); + std::vector<size_type> block_sizes (no_blocks); - for (unsigned int i=0; i<no_blocks; ++i) + for (size_type i=0; i<no_blocks; ++i) block_sizes[i] = partitioning[i].size(); @@ -244,7 +288,7 @@ namespace TrilinosWrappers if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(partitioning[i], communicator, fast); collect_sizes(); @@ -253,14 +297,14 @@ namespace TrilinosWrappers void - BlockVector::reinit (const std::vector<unsigned int> &block_sizes, - const bool fast) + BlockVector::reinit (const std::vector<size_type> &block_sizes, + const bool fast) { this->block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(block_sizes[i], fast); collect_sizes(); @@ -275,21 +319,21 @@ namespace TrilinosWrappers if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i] = v.block(i); } void - BlockVector::reinit (const unsigned int num_blocks) + BlockVector::reinit (const size_type num_blocks) { - std::vector<unsigned int> block_sizes (num_blocks, 0); + std::vector<size_type> block_sizes (num_blocks, 0); block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) block(i).clear(); collect_sizes(); @@ -305,7 +349,7 @@ namespace TrilinosWrappers if (components.size() != n_blocks()) components.resize(n_blocks()); - for (unsigned int i=0; i<n_blocks(); ++i) + for (size_type i=0; i<n_blocks(); ++i) components[i].reinit(v.block(i), fast); collect_sizes(); @@ -328,13 +372,13 @@ namespace TrilinosWrappers { if (n_blocks() != v.n_blocks()) { - std::vector<unsigned int> block_sizes (v.n_blocks(), 0); + std::vector<size_type> block_sizes (v.n_blocks(), 0); block_indices.reinit (block_sizes); if (components.size() != n_blocks()) components.resize(n_blocks()); } - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) this->components[i] = v.block(i); collect_sizes(); @@ -349,7 +393,7 @@ namespace TrilinosWrappers const bool scientific, const bool across) const { - for (unsigned int i=0; i<this->n_blocks(); ++i) + for (size_type i=0; i<this->n_blocks(); ++i) { if (across) out << 'C' << i << ':'; diff --git a/deal.II/source/lac/trilinos_precondition.cc b/deal.II/source/lac/trilinos_precondition.cc index e812285533..d8342f04d2 100644 --- a/deal.II/source/lac/trilinos_precondition.cc +++ b/deal.II/source/lac/trilinos_precondition.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- #include <deal.II/lac/trilinos_precondition.h> @@ -32,6 +34,30 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { + namespace + { +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + int global_length (const Epetra_MultiVector &vector) + { + return vector.GlobalLength(); + } + + int gid(const Epetra_Map &map, unsigned int i) + { + return map.GID(i); + } +#else + long long int global_length (const Epetra_MultiVector &vector) + { + return vector.GlobalLength64(); + } + + long long int gid(const Epetra_Map &map, dealii::types::global_dof_index i) + { + return map.GID64(i); + } +#endif + } PreconditionBase::PreconditionBase() #ifdef DEAL_II_WITH_MPI @@ -509,7 +535,7 @@ namespace TrilinosWrappers PreconditionAMG:: initialize (const SparseMatrix &matrix, const AdditionalData &additional_data) { - const unsigned int n_rows = matrix.m(); + const size_type n_rows = matrix.m(); // Build the AMG preconditioner. Teuchos::ParameterList parameter_list; @@ -575,7 +601,7 @@ namespace TrilinosWrappers const Epetra_Map &domain_map = matrix.domain_partitioner(); - const unsigned int constant_modes_dimension = + const size_type constant_modes_dimension = additional_data.constant_modes.size(); Epetra_MultiVector distributed_constant_modes (domain_map, constant_modes_dimension); @@ -585,25 +611,26 @@ namespace TrilinosWrappers { const bool constant_modes_are_global = additional_data.constant_modes[0].size() == n_rows; - const unsigned int n_relevant_rows = + const size_type n_relevant_rows = constant_modes_are_global ? n_rows : additional_data.constant_modes[0].size(); - const unsigned int my_size = domain_map.NumMyElements(); + const size_type my_size = domain_map.NumMyElements(); if (constant_modes_are_global == false) Assert (n_relevant_rows == my_size, ExcDimensionMismatch(n_relevant_rows, my_size)); Assert (n_rows == - static_cast<unsigned int>(distributed_constant_modes.GlobalLength()), + static_cast<size_type>(global_length(distributed_constant_modes)), ExcDimensionMismatch(n_rows, - distributed_constant_modes.GlobalLength())); + global_length(distributed_constant_modes))); // Reshape null space as a // contiguous vector of // doubles so that Trilinos // can read from it. - for (unsigned int d=0; d<constant_modes_dimension; ++d) - for (unsigned int row=0; row<my_size; ++row) + for (size_type d=0; d<constant_modes_dimension; ++d) + for (size_type row=0; row<my_size; ++row) { - int global_row_id = constant_modes_are_global ? domain_map.GID(row) : row; + TrilinosWrappers::types::int_type global_row_id = + constant_modes_are_global ? gid(domain_map,row) : row; distributed_constant_modes[d][row] = additional_data.constant_modes[d][global_row_id]; } @@ -657,13 +684,14 @@ namespace TrilinosWrappers const ::dealii::SparsityPattern *use_this_sparsity) { preconditioner.reset(); - const unsigned int n_rows = deal_ii_sparse_matrix.m(); + const size_type n_rows = deal_ii_sparse_matrix.m(); // Init Epetra Matrix using an // equidistributed map; avoid // storing the nonzero // elements. - vector_distributor.reset (new Epetra_Map(static_cast<int>(n_rows), 0, communicator)); + vector_distributor.reset (new Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(n_rows), + 0, communicator)); if (trilinos_matrix.get() == 0) trilinos_matrix.reset (new SparseMatrix()); @@ -694,7 +722,7 @@ namespace TrilinosWrappers - std::size_t + PreconditionAMG::size_type PreconditionAMG::memory_consumption() const { unsigned int memory = sizeof(this); diff --git a/deal.II/source/lac/trilinos_solver.cc b/deal.II/source/lac/trilinos_solver.cc index 60ae66c5de..f04ca39f85 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 <deal.II/lac/trilinos_solver.h> @@ -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<Epetra_MultiVector *>(&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()); - } - - // Introduce the - // preconditioner, ... - ierr = solver.SetPrecOperator (const_cast<Epetra_Operator *> - (preconditioner.preconditioner.get())); - AssertThrow (ierr == 0, ExcTrilinosError(ierr)); + execute_solve(preconditioner); + } - // ... 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<Epetra_MultiVector *>(&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<double> &b, const PreconditionBase &preconditioner) { - int ierr; - linear_problem.reset(); // In case we call the solver with @@ -205,6 +147,39 @@ namespace TrilinosWrappers (const_cast<Epetra_CrsMatrix *>(&A.trilinos_matrix()), &ep_x, &ep_b)); + execute_solve(preconditioner); + } + + + + void + SolverBase::solve (Epetra_Operator &A, + dealii::Vector<double> &x, + const dealii::Vector<double> &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<double *>(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); @@ -247,7 +222,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 f79572e343..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 <deal.II/lac/trilinos_sparse_matrix.h> @@ -32,6 +34,80 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { + namespace + { +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + // define a helper function that queries the size of an Epetra_Map object + // 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 n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements(); + } + + int min_my_gid(const Epetra_BlockMap &map) + { + return map.MinMyGID(); + } + + int max_my_gid(const Epetra_BlockMap &map) + { + return map.MaxMyGID(); + } + + int n_global_cols(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalCols(); + } + + int global_column_index(const Epetra_CrsMatrix &matrix, int i) + { + return matrix.GCID(i); + } + + int global_row_index(const Epetra_CrsMatrix &matrix, int i) + { + return matrix.GRID(i); + } +#else + // define a helper function that queries the size of an Epetra_Map object + // 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 n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements64(); + } + + long long int min_my_gid(const Epetra_BlockMap &map) + { + return map.MinMyGID64(); + } + + long long int max_my_gid(const Epetra_BlockMap &map) + { + return map.MaxMyGID64(); + } + + long long int n_global_cols(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalCols64(); + } + + long long int global_column_index(const Epetra_CrsMatrix &matrix, int i) + { + return matrix.GCID64(i); + } + + long long int global_row_index(const Epetra_CrsMatrix &matrix, int i) + { + return matrix.GRID64(i); + } +#endif + } + + namespace SparseMatrixIterators { void @@ -55,11 +131,11 @@ namespace TrilinosWrappers // get a representation of the present // row int ncols; - int colnums = matrix->n(); + TrilinosWrappers::types::int_type colnums = matrix->n(); if (value_cache.get() == 0) { value_cache.reset (new std::vector<TrilinosScalar> (matrix->n())); - colnum_cache.reset (new std::vector<unsigned int> (matrix->n())); + colnum_cache.reset (new std::vector<size_type> (matrix->n())); } else { @@ -68,10 +144,10 @@ namespace TrilinosWrappers } int ierr = matrix->trilinos_matrix(). - ExtractGlobalRowCopy((int)this->a_row, + ExtractGlobalRowCopy((TrilinosWrappers::types::int_type)this->a_row, colnums, ncols, &((*value_cache)[0]), - reinterpret_cast<int *>(&((*colnum_cache)[0]))); + reinterpret_cast<TrilinosWrappers::types::int_type *>(&((*colnum_cache)[0]))); value_cache->resize (ncols); colnum_cache->resize (ncols); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); @@ -112,11 +188,11 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const Epetra_Map &input_map, - const unsigned int n_max_entries_per_row) + const size_type n_max_entries_per_row) : column_space_map (new Epetra_Map (input_map)), matrix (new Epetra_FECrsMatrix(Copy, *column_space_map, - int(n_max_entries_per_row), false)), + TrilinosWrappers::types::int_type(n_max_entries_per_row), false)), last_action (Zero), compressed (false) {} @@ -139,11 +215,11 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const Epetra_Map &input_row_map, const Epetra_Map &input_col_map, - const unsigned int n_max_entries_per_row) + const size_type n_max_entries_per_row) : column_space_map (new Epetra_Map (input_col_map)), matrix (new Epetra_FECrsMatrix(Copy, input_row_map, - int(n_max_entries_per_row), false)), + TrilinosWrappers::types::int_type(n_max_entries_per_row), false)), last_action (Zero), compressed (false) {} @@ -164,11 +240,11 @@ namespace TrilinosWrappers - SparseMatrix::SparseMatrix (const unsigned int m, - const unsigned int n, + SparseMatrix::SparseMatrix (const size_type m, + const size_type n, const unsigned int n_max_entries_per_row) : - column_space_map (new Epetra_Map (static_cast<int>(n), 0, + column_space_map (new Epetra_Map (static_cast<TrilinosWrappers::types::int_type>(n), 0, Utilities::Trilinos::comm_self())), // on one processor only, we know how the @@ -180,7 +256,7 @@ namespace TrilinosWrappers // information from columns is only // available when entries have been added matrix (new Epetra_FECrsMatrix(Copy, - Epetra_Map (static_cast<int>(m), 0, + Epetra_Map (static_cast<TrilinosWrappers::types::int_type>(m), 0, Utilities::Trilinos::comm_self()), *column_space_map, n_max_entries_per_row, @@ -191,14 +267,14 @@ namespace TrilinosWrappers - SparseMatrix::SparseMatrix (const unsigned int m, - const unsigned int n, + SparseMatrix::SparseMatrix (const size_type m, + const size_type n, const std::vector<unsigned int> &n_entries_per_row) : - column_space_map (new Epetra_Map (static_cast<int>(n), 0, + column_space_map (new Epetra_Map (static_cast<TrilinosWrappers::types::int_type>(n), 0, Utilities::Trilinos::comm_self())), matrix (new Epetra_FECrsMatrix(Copy, - Epetra_Map (static_cast<int>(m), 0, + Epetra_Map (static_cast<TrilinosWrappers::types::int_type>(m), 0, Utilities::Trilinos::comm_self()), *column_space_map, (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])), @@ -211,7 +287,7 @@ namespace TrilinosWrappers SparseMatrix::SparseMatrix (const IndexSet &parallel_partitioning, const MPI_Comm &communicator, - const unsigned int n_max_entries_per_row) + const unsigned int n_max_entries_per_row) : column_space_map (new Epetra_Map(parallel_partitioning. make_trilinos_map(communicator, false))), @@ -225,8 +301,8 @@ namespace TrilinosWrappers - SparseMatrix::SparseMatrix (const IndexSet &parallel_partitioning, - const MPI_Comm &communicator, + SparseMatrix::SparseMatrix (const IndexSet &parallel_partitioning, + const MPI_Comm &communicator, const std::vector<unsigned int> &n_entries_per_row) : column_space_map (new Epetra_Map(parallel_partitioning. @@ -241,10 +317,10 @@ namespace TrilinosWrappers - SparseMatrix::SparseMatrix (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator, - const unsigned int n_max_entries_per_row) + SparseMatrix::SparseMatrix (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator, + const size_type n_max_entries_per_row) : column_space_map (new Epetra_Map(col_parallel_partitioning. make_trilinos_map(communicator, false))), @@ -259,9 +335,9 @@ namespace TrilinosWrappers - SparseMatrix::SparseMatrix (const IndexSet &row_parallel_partitioning, - const IndexSet &col_parallel_partitioning, - const MPI_Comm &communicator, + SparseMatrix::SparseMatrix (const IndexSet &row_parallel_partitioning, + const IndexSet &col_parallel_partitioning, + const MPI_Comm &communicator, const std::vector<unsigned int> &n_entries_per_row) : column_space_map (new Epetra_Map(col_parallel_partitioning. @@ -337,10 +413,10 @@ namespace TrilinosWrappers void SparseMatrix::reinit (const SparsityType &sparsity_pattern) { - const Epetra_Map rows (static_cast<int>(sparsity_pattern.n_rows()), + const Epetra_Map rows (static_cast<TrilinosWrappers::types::int_type>(sparsity_pattern.n_rows()), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast<int>(sparsity_pattern.n_cols()), + const Epetra_Map columns (static_cast<TrilinosWrappers::types::int_type>(sparsity_pattern.n_cols()), 0, Utilities::Trilinos::comm_self()); @@ -364,24 +440,24 @@ 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 <typename Sparsity> - void copy_row (const Sparsity &csp, - const unsigned int row, - std::vector<int> &row_indices) + void copy_row (const Sparsity &csp, + const size_type row, + std::vector<TrilinosWrappers::types::int_type> &row_indices) { typename Sparsity::row_iterator col_num = csp.row_begin (row); - for (unsigned int col=0; col_num != csp.row_end (row); ++col_num, ++col) + for (size_type col=0; col_num != csp.row_end (row); ++col_num, ++col) row_indices[col] = *col_num; } void copy_row (const dealii::SparsityPattern &csp, - const unsigned int row, - std::vector<int> &row_indices) + const size_type row, + std::vector<TrilinosWrappers::types::int_type> &row_indices) { dealii::SparsityPattern::iterator col_num = csp.begin (row); - for (unsigned int col=0; col_num != csp.end (row); ++col_num, ++col) + for (size_type col=0; col_num != csp.end (row); ++col_num, ++col) row_indices[col] = col_num->column(); } } @@ -417,18 +493,18 @@ namespace TrilinosWrappers if (input_row_map.Comm().MyPID() == 0) { AssertDimension (sparsity_pattern.n_rows(), - static_cast<unsigned int>(input_row_map.NumGlobalElements())); + static_cast<size_type>(n_global_elements(input_row_map))); AssertDimension (sparsity_pattern.n_cols(), - static_cast<unsigned int>(input_col_map.NumGlobalElements())); + static_cast<size_type>(n_global_elements(input_col_map))); } column_space_map.reset (new Epetra_Map (input_col_map)); - const unsigned int first_row = input_row_map.MinMyGID(), - last_row = input_row_map.MaxMyGID()+1; + const size_type first_row = min_my_gid(input_row_map), + last_row = max_my_gid(input_row_map)+1; std::vector<int> n_entries_per_row(last_row-first_row); - for (unsigned int row=first_row; row<last_row; ++row) + for (size_type row=first_row; row<last_row; ++row) n_entries_per_row[row-first_row] = sparsity_pattern.row_length(row); // The deal.II notation of a Sparsity pattern corresponds to the Epetra @@ -457,9 +533,9 @@ namespace TrilinosWrappers // distributed. // now insert the indices - std::vector<int> row_indices; + std::vector<TrilinosWrappers::types::int_type> row_indices; - for (unsigned int row=first_row; row<last_row; ++row) + for (size_type row=first_row; row<last_row; ++row) { const int row_length = sparsity_pattern.row_length(row); if (row_length == 0) @@ -472,13 +548,15 @@ namespace TrilinosWrappers } // Eventually, optimize the graph structure (sort indices, make memory - // contiguous, etc). + // contiguous, etc). note that the documentation of the function indeed + // states that we first need to provide the column (domain) map and then + // the row (range) map graph->FillComplete(input_col_map, input_row_map); graph->OptimizeStorage(); // check whether we got the number of columns right. - AssertDimension (sparsity_pattern.n_cols(), - static_cast<unsigned int>(graph->NumGlobalCols())); + AssertDimension (sparsity_pattern.n_cols(),static_cast<size_type>( + n_global_cols(*graph))); // And now finally generate the matrix. matrix.reset (new Epetra_FECrsMatrix(Copy, *graph, false)); @@ -527,10 +605,10 @@ namespace TrilinosWrappers const bool copy_values, const ::dealii::SparsityPattern *use_this_sparsity) { - const Epetra_Map rows (static_cast<int>(dealii_sparse_matrix.m()), + const Epetra_Map rows (static_cast<TrilinosWrappers::types::int_type>(dealii_sparse_matrix.m()), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast<int>(dealii_sparse_matrix.n()), + const Epetra_Map columns (static_cast<TrilinosWrappers::types::int_type>(dealii_sparse_matrix.n()), 0, Utilities::Trilinos::comm_self()); reinit (rows, columns, dealii_sparse_matrix, drop_tolerance, @@ -575,13 +653,16 @@ namespace TrilinosWrappers return; } - const unsigned int n_rows = dealii_sparse_matrix.m(); + const size_type n_rows = dealii_sparse_matrix.m(); - Assert (input_row_map.NumGlobalElements() == (int)n_rows, - ExcDimensionMismatch (input_row_map.NumGlobalElements(), + Assert (static_cast<size_type>(n_global_elements(input_row_map)) == n_rows, + ExcDimensionMismatch (n_global_elements(input_row_map), + n_rows)); + Assert (n_global_elements(input_row_map) == (TrilinosWrappers::types::int_type)n_rows, + ExcDimensionMismatch (n_global_elements(input_row_map), n_rows)); - Assert (input_col_map.NumGlobalElements() == (int)dealii_sparse_matrix.n(), - ExcDimensionMismatch (input_col_map.NumGlobalElements(), + Assert (n_global_elements(input_col_map) == (TrilinosWrappers::types::int_type)dealii_sparse_matrix.n(), + ExcDimensionMismatch (n_global_elements(input_col_map), dealii_sparse_matrix.n())); const ::dealii::SparsityPattern &sparsity_pattern = @@ -602,19 +683,19 @@ namespace TrilinosWrappers // and the specified sparsity pattern might be different, need to go // through the row for both these sparsity structures simultaneously in // order to really set the correct values. - unsigned int maximum_row_length = matrix->MaxNumEntries(); - std::vector<unsigned int> row_indices (maximum_row_length); + size_type maximum_row_length = matrix->MaxNumEntries(); + std::vector<size_type> row_indices (maximum_row_length); std::vector<TrilinosScalar> values (maximum_row_length); - for (unsigned int row=0; row<n_rows; ++row) + for (size_type row=0; row<n_rows; ++row) // see if the row is locally stored on this processor - if (input_row_map.MyGID(static_cast<int>(row)) == true) + if (input_row_map.MyGID(static_cast<TrilinosWrappers::types::int_type>(row)) == true) { ::dealii::SparsityPattern::iterator select_index = sparsity_pattern.begin(row); typename ::dealii::SparseMatrix<number>::const_iterator it = dealii_sparse_matrix.begin(row); - unsigned int col = 0; + size_type col = 0; if (sparsity_pattern.n_rows() == sparsity_pattern.n_cols()) { // optimized diagonal @@ -648,7 +729,7 @@ namespace TrilinosWrappers ++select_index; ++it; } - set (row, col, reinterpret_cast<unsigned int *>(&row_indices[0]), + set (row, col, reinterpret_cast<size_type *>(&row_indices[0]), &values[0], false); } @@ -679,7 +760,7 @@ namespace TrilinosWrappers // matrices and copy the content const TrilinosScalar *in_values = input_matrix[0]; TrilinosScalar *values = (*matrix)[0]; - const unsigned int my_nonzeros = input_matrix.NumMyNonzeros(); + const size_type my_nonzeros = input_matrix.NumMyNonzeros(); std::memcpy (&values[0], &in_values[0], my_nonzeros*sizeof (TrilinosScalar)); } @@ -707,14 +788,15 @@ namespace TrilinosWrappers void - SparseMatrix::clear_row (const unsigned int row, + SparseMatrix::clear_row (const size_type row, const TrilinosScalar new_diag_value) { Assert (matrix->Filled()==true, ExcMatrixNotCompressed()); // Only do this on the rows owned // locally on this processor. - int local_row = matrix->LRID(static_cast<int>(row)); + int local_row = + matrix->LRID(static_cast<TrilinosWrappers::types::int_type>(row)); if (local_row >= 0) { TrilinosScalar *values; @@ -726,11 +808,10 @@ namespace TrilinosWrappers Assert (ierr == 0, ExcTrilinosError(ierr)); - int *diag_find = std::find(col_indices,col_indices+num_entries, - local_row); + int *diag_find = std::find(col_indices,col_indices+num_entries,local_row); int diag_index = (int)(diag_find - col_indices); - for (int j=0; j<num_entries; ++j) + for (TrilinosWrappers::types::int_type j=0; j<num_entries; ++j) if (diag_index != j || new_diag_value == 0) values[j] = 0.; @@ -743,11 +824,11 @@ namespace TrilinosWrappers void - SparseMatrix::clear_rows (const std::vector<unsigned int> &rows, - const TrilinosScalar new_diag_value) + SparseMatrix::clear_rows (const std::vector<size_type> &rows, + const TrilinosScalar new_diag_value) { compress(); - for (unsigned int row=0; row<rows.size(); ++row) + for (size_type row=0; row<rows.size(); ++row) clear_row(rows[row], new_diag_value); // This function needs to be called @@ -761,13 +842,13 @@ namespace TrilinosWrappers TrilinosScalar - SparseMatrix::operator() (const unsigned int i, - const unsigned int j) const + SparseMatrix::operator() (const size_type i, + const size_type j) const { // Extract local indices in // the matrix. - int trilinos_i = matrix->LRID(static_cast<int>(i)), - trilinos_j = matrix->LCID(static_cast<int>(j)); + int trilinos_i = matrix->LRID(static_cast<TrilinosWrappers::types::int_type>(i)), + trilinos_j = matrix->LCID(static_cast<TrilinosWrappers::types::int_type>(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -798,6 +879,7 @@ namespace TrilinosWrappers // Generate the view and make // sure that we have not generated // an error. + // TODO Check that col_indices are int and not long long int ierr = matrix->ExtractMyRowView(trilinos_i, nnz_extracted, values, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); @@ -809,8 +891,7 @@ namespace TrilinosWrappers // look for the value, and then // finally get it. - int *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + int *el_find = std::find(col_indices, col_indices + nnz_present, trilinos_j); int local_col_index = (int)(el_find - col_indices); @@ -836,12 +917,13 @@ namespace TrilinosWrappers TrilinosScalar - SparseMatrix::el (const unsigned int i, - const unsigned int j) const + SparseMatrix::el (const size_type i, + const size_type j) const { // Extract local indices in // the matrix. - int trilinos_i = matrix->LRID(static_cast<int>(i)), trilinos_j = matrix->LCID(static_cast<int>(j)); + int trilinos_i = matrix->LRID(static_cast<TrilinosWrappers::types::int_type>(i)), + trilinos_j = matrix->LCID(static_cast<TrilinosWrappers::types::int_type>(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -880,8 +962,7 @@ namespace TrilinosWrappers // Search the index where we // look for the value, and then // finally get it. - int *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + int *el_find = std::find(col_indices, col_indices + nnz_present, trilinos_j); int local_col_index = (int)(el_find - col_indices); @@ -905,7 +986,7 @@ namespace TrilinosWrappers TrilinosScalar - SparseMatrix::diag_element (const unsigned int i) const + SparseMatrix::diag_element (const size_type i) const { Assert (m() == n(), ExcNotQuadratic()); @@ -926,14 +1007,14 @@ namespace TrilinosWrappers unsigned int - SparseMatrix::row_length (const unsigned int row) const + SparseMatrix::row_length (const size_type row) const { Assert (row < m(), ExcInternalError()); // get a representation of the // present row int ncols = -1; - int local_row = matrix->LRID(static_cast<int>(row)); + int local_row = matrix->LRID(static_cast<TrilinosWrappers::types::int_type>(row)); // on the processor who owns this // row, we'll have a non-negative @@ -951,6 +1032,8 @@ namespace TrilinosWrappers namespace internals { + typedef dealii::types::global_dof_index size_type; + void perform_mmult (const SparseMatrix &inputleft, const SparseMatrix &inputright, SparseMatrix &result, @@ -1007,7 +1090,7 @@ namespace TrilinosWrappers mod_B->ExtractMyRowView (i, N_entries, new_data); inputright.trilinos_matrix().ExtractMyRowView (i, N_entries, B_data); double value = V.trilinos_vector()[0][i]; - for (int j=0; j<N_entries; ++j) + for (TrilinosWrappers::types::int_type j=0; j<N_entries; ++j) new_data[j] = value * B_data[j]; } } @@ -1046,10 +1129,17 @@ namespace TrilinosWrappers inputleft.trilinos_sparsity_pattern().ExtractMyRowView(i, num_entries, indices); Assert (num_entries >= 0, ExcInternalError()); - const unsigned int GID = inputleft.row_partitioner().GID(i); - for (int j=0; j<num_entries; ++j) +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + const size_type GID = inputleft.row_partitioner().GID(i); + for (TrilinosWrappers::types::int_type j=0; j<num_entries; ++j) sparsity_transposed.add (inputleft.col_partitioner().GID(indices[j]), GID); +#else + const size_type GID = inputleft.row_partitioner().GID64(i); + for (TrilinosWrappers::types::int_type j=0; j<num_entries; ++j) + sparsity_transposed.add (inputleft.col_partitioner().GID64(indices[j]), + GID); +#endif } sparsity_transposed.compress(); @@ -1061,10 +1151,17 @@ namespace TrilinosWrappers inputleft.trilinos_matrix().ExtractMyRowView(i, num_entries, values, indices); Assert (num_entries >= 0, ExcInternalError()); - const unsigned int GID = inputleft.row_partitioner().GID(i); - for (int j=0; j<num_entries; ++j) +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + const size_type GID = inputleft.row_partitioner().GID(i); + for (TrilinosWrappers::types::int_type j=0; j<num_entries; ++j) transposed_mat.set (inputleft.col_partitioner().GID(indices[j]), GID, values[j]); +#else + const size_type GID = inputleft.row_partitioner().GID64(i); + for (TrilinosWrappers::types::int_type j=0; j<num_entries; ++j) + transposed_mat.set (inputleft.col_partitioner().GID64(indices[j]), + GID, values[j]); +#endif } transposed_mat.compress(); ML_Operator_WrapEpetraCrsMatrix @@ -1084,11 +1181,11 @@ namespace TrilinosWrappers ML_Operator *Btmp, *Ctmp, *Ctmp2, *tptr; ML_CommInfoOP *getrow_comm; int max_per_proc; - int N_input_vector = B_->invec_leng; + TrilinosWrappers::types::int_type N_input_vector = B_->invec_leng; getrow_comm = B_->getrow->pre_comm; if ( getrow_comm != NULL) - for (int i = 0; i < getrow_comm->N_neighbors; i++) - for (int j = 0; j < getrow_comm->neighbors[i].N_send; j++) + for (TrilinosWrappers::types::int_type i = 0; i < getrow_comm->N_neighbors; i++) + for (TrilinosWrappers::types::int_type j = 0; j < getrow_comm->neighbors[i].N_send; j++) AssertThrow (getrow_comm->neighbors[i].send_list[j] < N_input_vector, ExcInternalError()); @@ -1179,7 +1276,7 @@ namespace TrilinosWrappers Assert (rhs.m() == m(), ExcDimensionMismatch (rhs.m(), m())); Assert (rhs.n() == n(), ExcDimensionMismatch (rhs.n(), n())); - const std::pair<unsigned int, unsigned int> + const std::pair<size_type, size_type> local_range = rhs.local_range(); int ierr; @@ -1199,7 +1296,7 @@ namespace TrilinosWrappers rhs.matrix->Filled() == true && this->local_range() == local_range && matrix->NumMyNonzeros() == rhs.matrix->NumMyNonzeros()) - for (unsigned int row=local_range.first; + for (size_type row=local_range.first; row < local_range.second; ++row) { Assert (matrix->NumGlobalEntries(row) == @@ -1207,7 +1304,8 @@ namespace TrilinosWrappers ExcDimensionMismatch(matrix->NumGlobalEntries(row), rhs.matrix->NumGlobalEntries(row))); - const int row_local = matrix->RowMap().LID(static_cast<int>(row)); + const TrilinosWrappers::types::int_type row_local = + matrix->RowMap().LID(static_cast<TrilinosWrappers::types::int_type>(row)); int n_entries, rhs_n_entries; TrilinosScalar *value_ptr, *rhs_value_ptr; @@ -1236,7 +1334,7 @@ namespace TrilinosWrappers AssertThrow (n_entries == rhs_n_entries, ExcDimensionMismatch (n_entries, rhs_n_entries)); - for (int i=0; i<n_entries; ++i) + for (TrilinosWrappers::types::int_type i=0; i<n_entries; ++i) { *value_ptr++ += *rhs_value_ptr++ * factor; #ifdef DEBUG @@ -1254,22 +1352,22 @@ namespace TrilinosWrappers // respective add() function. else { - unsigned int max_row_length = 0; - for (unsigned int row=local_range.first; + int max_row_length = 0; + for (size_type row=local_range.first; row < local_range.second; ++row) max_row_length - = std::max (max_row_length, - static_cast<unsigned int>(rhs.matrix->NumGlobalEntries(row))); + = std::max (max_row_length,rhs.matrix->NumGlobalEntries(row)); - std::vector<int> column_indices (max_row_length); std::vector<TrilinosScalar> values (max_row_length); if (matrix->Filled() == true && rhs.matrix->Filled() == true && this->local_range() == local_range) - for (unsigned int row=local_range.first; + for (size_type row=local_range.first; row < local_range.second; ++row) { - const int row_local = matrix->RowMap().LID(static_cast<int>(row)); + std::vector<int> column_indices (max_row_length); + const int row_local = + matrix->RowMap().LID(static_cast<TrilinosWrappers::types::int_type>(row)); int n_entries; ierr = rhs.matrix->ExtractMyRowCopy (row_local, max_row_length, @@ -1278,7 +1376,7 @@ namespace TrilinosWrappers &column_indices[0]); Assert (ierr == 0, ExcTrilinosError(ierr)); - for (int i=0; i<n_entries; ++i) + for (TrilinosWrappers::types::int_type i=0; i<n_entries; ++i) values[i] *= factor; TrilinosScalar *value_ptr = &values[0]; @@ -1289,19 +1387,25 @@ namespace TrilinosWrappers } else { - for (unsigned int row=local_range.first; + //TODO check that is normal that column_indices in the if is an + //int while the column_indices in the else is a + //TrilinosWrappers::types::int_type + std::vector<TrilinosWrappers::types::int_type> column_indices (max_row_length); + for (size_type row=local_range.first; row < local_range.second; ++row) { int n_entries; ierr = rhs.matrix->Epetra_CrsMatrix::ExtractGlobalRowCopy - ((int)row, max_row_length, n_entries, &values[0], &column_indices[0]); + ((TrilinosWrappers::types::int_type)row, max_row_length, + n_entries, &values[0], &column_indices[0]); Assert (ierr == 0, ExcTrilinosError(ierr)); - for (int i=0; i<n_entries; ++i) + for (TrilinosWrappers::types::int_type i=0; i<n_entries; ++i) values[i] *= factor; ierr = matrix->Epetra_CrsMatrix::SumIntoGlobalValues - ((int)row, n_entries, &values[0], &column_indices[0]); + ((TrilinosWrappers::types::int_type)row, n_entries, + &values[0], &column_indices[0]); Assert (ierr == 0, ExcTrilinosError(ierr)); } compress (); @@ -1362,8 +1466,9 @@ namespace TrilinosWrappers for (int i=0; i<matrix->NumMyRows(); ++i) { matrix->ExtractMyRowView (i, num_entries, values, indices); - for (int j=0; j<num_entries; ++j) - out << "(" << matrix->GRID(i) << "," << matrix->GCID(indices[j]) << ") " + for (TrilinosWrappers::types::int_type j=0; j<num_entries; ++j) + out << "(" << global_row_index(*matrix,i) << "," + << global_column_index(*matrix,indices[j]) << ") " << values[j] << std::endl; } } @@ -1373,14 +1478,13 @@ namespace TrilinosWrappers - std::size_t + SparseMatrix::size_type SparseMatrix::memory_consumption () const { - unsigned int static_memory = sizeof(this) + sizeof (*matrix) - + sizeof(*matrix->Graph().DataPtr()); - return ((sizeof(TrilinosScalar)+sizeof(int))*matrix->NumMyNonzeros() + - sizeof(int)*local_size() + - static_memory); + size_type static_memory = sizeof(this) + sizeof (*matrix) + + sizeof(*matrix->Graph().DataPtr()); + return ((sizeof(TrilinosScalar)+sizeof(TrilinosWrappers::types::int_type))* + 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 f1d858b8d2..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 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 <deal.II/lac/trilinos_sparsity_pattern.h> @@ -26,6 +28,85 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { + namespace + { + // define a helper function that queries the size of an Epetra_Map object + // 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 +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + int n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements(); + } + + int min_my_gid(const Epetra_BlockMap &map) + { + return map.MinMyGID(); + } + + int max_my_gid(const Epetra_BlockMap &map) + { + return map.MaxMyGID(); + } + + int n_global_rows(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalRows(); + } + + int n_global_cols(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalCols(); + } + + int n_global_entries(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalEntries(); + } + + int global_row_index(const Epetra_CrsGraph &graph, int i) + { + return graph.GRID(i); + } +#else + long long int n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements64(); + } + + long long int min_my_gid(const Epetra_BlockMap &map) + { + return map.MinMyGID64(); + } + + long long int max_my_gid(const Epetra_BlockMap &map) + { + return map.MaxMyGID64(); + } + + long long int n_global_rows(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalRows64(); + } + + long long int n_global_cols(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalCols64(); + } + + long long int n_global_entries(const Epetra_CrsGraph &graph) + { + return graph.NumGlobalEntries64(); + } + + long long int global_row_index(const Epetra_CrsGraph &graph, int i) + { + return graph.GRID64(i); + } +#endif + } + namespace SparsityPatternIterators { void @@ -49,13 +130,14 @@ namespace TrilinosWrappers // get a representation of the present // row int ncols; + // TODO: casting a size_type to an int, could be a problem int colnums = sparsity_pattern->n_cols(); int ierr; - ierr = sparsity_pattern->graph->ExtractGlobalRowCopy((int)this->a_row, + ierr = sparsity_pattern->graph->ExtractGlobalRowCopy((TrilinosWrappers::types::int_type)this->a_row, colnums, ncols, - (int *)&(*colnum_cache)[0]); + (TrilinosWrappers::types::int_type *)&(*colnum_cache)[0]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); // copy it into our caches if the @@ -65,8 +147,8 @@ namespace TrilinosWrappers // iterator for an empty line (what // would it point to?) Assert (ncols != 0, ExcInternalError()); - colnum_cache.reset (new std::vector<unsigned int> (colnums, - colnums+ncols)); + colnum_cache.reset (new std::vector<size_type> (colnums, + colnums+ncols)); } } @@ -86,22 +168,27 @@ namespace TrilinosWrappers : compressed (true) { - column_space_map.reset(new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); - graph.reset (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); + column_space_map.reset(new Epetra_Map (TrilinosWrappers::types::int_type(0), + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())); + graph.reset (new Epetra_FECrsGraph(View, + *column_space_map, + *column_space_map, + 0)); graph->FillComplete(); } SparsityPattern::SparsityPattern (const Epetra_Map &input_map, - const unsigned int n_entries_per_row) + const size_type n_entries_per_row) { reinit (input_map, input_map, n_entries_per_row); } - SparsityPattern::SparsityPattern (const Epetra_Map &input_map, - const std::vector<unsigned int> &n_entries_per_row) + SparsityPattern::SparsityPattern (const Epetra_Map &input_map, + const std::vector<size_type> &n_entries_per_row) { reinit (input_map, input_map, n_entries_per_row); } @@ -110,7 +197,7 @@ namespace TrilinosWrappers SparsityPattern::SparsityPattern (const Epetra_Map &input_row_map, const Epetra_Map &input_col_map, - const unsigned int n_entries_per_row) + const size_type n_entries_per_row) { reinit (input_row_map, input_col_map, n_entries_per_row); } @@ -119,25 +206,25 @@ namespace TrilinosWrappers SparsityPattern::SparsityPattern (const Epetra_Map &input_row_map, const Epetra_Map &input_col_map, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) { reinit (input_row_map, input_col_map, n_entries_per_row); } - SparsityPattern::SparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int n_entries_per_row) + SparsityPattern::SparsityPattern (const size_type m, + const size_type n, + const size_type n_entries_per_row) { reinit (m, n, n_entries_per_row); } - SparsityPattern::SparsityPattern (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &n_entries_per_row) + SparsityPattern::SparsityPattern (const size_type m, + const size_type n, + const std::vector<size_type> &n_entries_per_row) { reinit (m, n, n_entries_per_row); } @@ -148,10 +235,14 @@ namespace TrilinosWrappers SparsityPattern::SparsityPattern (const SparsityPattern &input_sparsity) : Subscriptor(), - column_space_map (new Epetra_Map(0, 0, Utilities::Trilinos::comm_self())), + column_space_map (new Epetra_Map(TrilinosWrappers::types::int_type(0), + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())), compressed (false), - graph (new Epetra_FECrsGraph(View, *column_space_map, - *column_space_map, 0)) + graph (new Epetra_FECrsGraph(View, + *column_space_map, + *column_space_map, + 0)) { Assert (input_sparsity.n_rows() == 0, ExcMessage ("Copy constructor only works for empty sparsity patterns.")); @@ -165,29 +256,31 @@ namespace TrilinosWrappers void - SparsityPattern::reinit (const Epetra_Map &input_map, - const unsigned int n_entries_per_row) + SparsityPattern::reinit (const Epetra_Map &input_map, + const size_type n_entries_per_row) { reinit (input_map, input_map, n_entries_per_row); } void - SparsityPattern::reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_entries_per_row) + SparsityPattern::reinit (const size_type m, + const size_type n, + const size_type n_entries_per_row) { - const Epetra_Map rows (static_cast<int>(m), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast<int>(n), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map rows (TrilinosWrappers::types::int_type(m), 0, + Utilities::Trilinos::comm_self()); + const Epetra_Map columns (TrilinosWrappers::types::int_type(n), 0, + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } void - SparsityPattern::reinit (const Epetra_Map &input_row_map, - const Epetra_Map &input_col_map, - const unsigned int n_entries_per_row) + SparsityPattern::reinit (const Epetra_Map &input_row_map, + const Epetra_Map &input_col_map, + const size_type n_entries_per_row) { graph.reset (); column_space_map.reset (new Epetra_Map (input_col_map)); @@ -215,7 +308,7 @@ namespace TrilinosWrappers void SparsityPattern::reinit (const Epetra_Map &input_map, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) { reinit (input_map, input_map, n_entries_per_row); } @@ -223,12 +316,14 @@ namespace TrilinosWrappers void - SparsityPattern::reinit (const unsigned int m, - const unsigned int n, - const std::vector<unsigned int> &n_entries_per_row) + SparsityPattern::reinit (const size_type m, + const size_type n, + const std::vector<size_type> &n_entries_per_row) { - const Epetra_Map rows (static_cast<int>(m), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast<int>(n), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map rows (TrilinosWrappers::types::int_type(m), 0, + Utilities::Trilinos::comm_self()); + const Epetra_Map columns (TrilinosWrappers::types::int_type(n), 0, + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -238,23 +333,23 @@ namespace TrilinosWrappers void SparsityPattern::reinit (const Epetra_Map &input_row_map, const Epetra_Map &input_col_map, - const std::vector<unsigned int> &n_entries_per_row) + const std::vector<size_type> &n_entries_per_row) { // release memory before reallocation graph.reset (); AssertDimension (n_entries_per_row.size(), - static_cast<unsigned int>(input_row_map.NumGlobalElements())); + static_cast<size_type>(n_global_elements(input_row_map))); column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; if (input_row_map.Comm().NumProc() > 1) graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, - n_entries_per_row[input_row_map.MinMyGID()], + n_entries_per_row[min_my_gid(input_row_map)], false)); else graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, - n_entries_per_row[input_row_map.MinMyGID()], + n_entries_per_row[max_my_gid(input_row_map)], false)); } @@ -275,24 +370,25 @@ namespace TrilinosWrappers { namespace { - // distinguish between compressed sparsity types that define row_begin() - // and SparsityPattern that uses begin() as iterator type + 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 template <typename Sparsity> void copy_row (const Sparsity &csp, - const unsigned int row, - std::vector<int> &row_indices) + const size_type row, + std::vector<TrilinosWrappers::types::int_type> &row_indices) { typename Sparsity::row_iterator col_num = csp.row_begin (row); - for (unsigned int col=0; col_num != csp.row_end (row); ++col_num, ++col) + for (size_type col=0; col_num != csp.row_end (row); ++col_num, ++col) row_indices[col] = *col_num; } void copy_row (const dealii::SparsityPattern &csp, - const unsigned int row, - std::vector<int> &row_indices) + const size_type row, + std::vector<TrilinosWrappers::types::int_type> &row_indices) { dealii::SparsityPattern::iterator col_num = csp.begin (row); - for (unsigned int col=0; col_num != csp.end (row); ++col_num, ++col) + for (size_type col=0; col_num != csp.end (row); ++col_num, ++col) row_indices[col] = col_num->column(); } } @@ -310,9 +406,9 @@ namespace TrilinosWrappers graph.reset (); AssertDimension (sp.n_rows(), - static_cast<unsigned int>(input_row_map.NumGlobalElements())); + static_cast<size_type>(n_global_elements(input_row_map))); AssertDimension (sp.n_cols(), - static_cast<unsigned int>(input_col_map.NumGlobalElements())); + static_cast<size_type>(n_global_elements(input_col_map))); column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; @@ -320,12 +416,14 @@ namespace TrilinosWrappers Assert (input_row_map.LinearMap() == true, ExcMessage ("This function is not efficient if the map is not contiguous.")); - const unsigned int first_row = input_row_map.MinMyGID(), - last_row = input_row_map.MaxMyGID()+1; + const size_type first_row = min_my_gid(input_row_map), + last_row = max_my_gid(input_row_map)+1; std::vector<int> n_entries_per_row(last_row - first_row); - for (unsigned int row=first_row; row<last_row; ++row) - n_entries_per_row[row-first_row] = sp.row_length(row); + // Trilinos wants the row length as an int + // this is hopefully never going to be a problem. + for (size_type row=first_row; row<last_row; ++row) + n_entries_per_row[row-first_row] = static_cast<int>(sp.row_length(row)); if (input_row_map.Comm().NumProc() > 1) graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, @@ -337,17 +435,17 @@ namespace TrilinosWrappers false)); AssertDimension (sp.n_rows(), - static_cast<unsigned int>(graph->NumGlobalRows())); + static_cast<size_type>(n_global_rows(*graph))); - std::vector<int> row_indices; + std::vector<TrilinosWrappers::types::int_type> row_indices; // Include possibility to exchange data // since CompressedSimpleSparsityPattern is // able to do so if (exchange_data==false) - for (unsigned int row=first_row; row<last_row; ++row) + for (size_type row=first_row; row<last_row; ++row) { - const int row_length = sp.row_length(row); + const TrilinosWrappers::types::int_type row_length = sp.row_length(row); if (row_length == 0) continue; @@ -357,15 +455,16 @@ namespace TrilinosWrappers &row_indices[0]); } else - for (unsigned int row=0; row<sp.n_rows(); ++row) + for (size_type row=0; row<sp.n_rows(); ++row) { - const int row_length = sp.row_length(row); + const TrilinosWrappers::types::int_type row_length = sp.row_length(row); if (row_length == 0) continue; row_indices.resize (row_length, -1); internal::copy_row(sp, row, row_indices); - graph->InsertGlobalIndices (1, reinterpret_cast<int *>(&row), + graph->InsertGlobalIndices (1, + reinterpret_cast<TrilinosWrappers::types::int_type *>(&row), row_length, &row_indices[0]); } @@ -387,8 +486,10 @@ namespace TrilinosWrappers void SparsityPattern::copy_from (const SparsityType &sp) { - const Epetra_Map rows (static_cast<int>(sp.n_rows()), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast<int>(sp.n_cols()), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map rows (TrilinosWrappers::types::int_type(sp.n_rows()), 0, + Utilities::Trilinos::comm_self()); + const Epetra_Map columns (TrilinosWrappers::types::int_type(sp.n_cols()), 0, + Utilities::Trilinos::comm_self()); reinit (rows, columns, sp); } @@ -401,7 +502,9 @@ namespace TrilinosWrappers // When we clear the matrix, reset // the pointer and generate an // empty sparsity pattern. - column_space_map.reset (new Epetra_Map (0, 0, Utilities::Trilinos::comm_self())); + column_space_map.reset (new Epetra_Map (TrilinosWrappers::types::int_type(0), + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())); graph.reset (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); graph->FillComplete(); @@ -431,12 +534,13 @@ namespace TrilinosWrappers bool - SparsityPattern::exists (const unsigned int i, - const unsigned int j) const + SparsityPattern::exists (const size_type i, + const size_type j) const { // Extract local indices in // the matrix. - int trilinos_i = graph->LRID(static_cast<int>(i)), trilinos_j = graph->LCID(static_cast<int>(j)); + int trilinos_i = graph->LRID(static_cast<TrilinosWrappers::types::int_type>(i)), + trilinos_j = graph->LCID(static_cast<TrilinosWrappers::types::int_type>(j)); // If the data is not on the // present processor, we throw @@ -457,22 +561,27 @@ namespace TrilinosWrappers { int nnz_present = graph->NumGlobalIndices(i); int nnz_extracted; - int *col_indices; + TrilinosWrappers::types::int_type *col_indices; // Generate the view and make // sure that we have not generated // an error. - int ierr = graph->ExtractGlobalRowView(trilinos_i, nnz_extracted, - col_indices); + // 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<TrilinosWrappers::types::int_type>(trilinos_i), + nnz_extracted, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); Assert (nnz_present == nnz_extracted, ExcDimensionMismatch(nnz_present, nnz_extracted)); // Search the index - int *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + TrilinosWrappers::types::int_type *el_find = + std::find(col_indices, col_indices + nnz_present, trilinos_j); - int local_col_index = (int)(el_find - col_indices); + TrilinosWrappers::types::int_type local_col_index = + (TrilinosWrappers::types::int_type)(el_find - col_indices); if (local_col_index == nnz_present) return false; @@ -481,15 +590,16 @@ namespace TrilinosWrappers { // Prepare pointers for extraction // of a view of the row. - int nnz_present = graph->NumGlobalIndices(i); + int nnz_present = graph->NumGlobalIndices( + static_cast<TrilinosWrappers::types::int_type>(i)); int nnz_extracted; int *col_indices; // Generate the view and make // sure that we have not generated // an error. - int ierr = graph->ExtractMyRowView(trilinos_i, nnz_extracted, - col_indices); + int ierr = graph->ExtractMyRowView(trilinos_i, + nnz_extracted, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); Assert (nnz_present == nnz_extracted, @@ -497,7 +607,7 @@ namespace TrilinosWrappers // Search the index int *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + static_cast<int>(trilinos_j)); int local_col_index = (int)(el_find - col_indices); @@ -511,45 +621,45 @@ namespace TrilinosWrappers - unsigned int + SparsityPattern::size_type SparsityPattern::bandwidth () const { - unsigned int local_b=0; - int global_b=0; - for (unsigned int i=0; i<local_size(); ++i) + size_type local_b=0; + TrilinosWrappers::types::int_type global_b=0; + for (int i=0; i<(int)local_size(); ++i) { int *indices; int num_entries; graph->ExtractMyRowView(i, num_entries, indices); for (unsigned int j=0; j<(unsigned int)num_entries; ++j) { - if (static_cast<unsigned int>(std::abs(static_cast<int>(i-indices[j]))) > local_b) - local_b = std::abs(static_cast<signed int>(i-indices[j])); + if (static_cast<size_type>(std::abs(static_cast<TrilinosWrappers::types::int_type>(i-indices[j]))) > local_b) + local_b = std::abs(static_cast<TrilinosWrappers::types::int_type>(i-indices[j])); } } - graph->Comm().MaxAll((int *)&local_b, &global_b, 1); - return static_cast<unsigned int>(global_b); + graph->Comm().MaxAll((TrilinosWrappers::types::int_type *)&local_b, &global_b, 1); + return static_cast<size_type>(global_b); } - unsigned int + SparsityPattern::size_type SparsityPattern::n_rows () const { - const int n_rows = graph -> NumGlobalRows(); + const TrilinosWrappers::types::int_type n_rows = n_global_rows(*graph); return n_rows; } - unsigned int + SparsityPattern::size_type SparsityPattern::n_cols () const { - int n_cols; + TrilinosWrappers::types::int_type n_cols; if (graph->Filled() == true) - n_cols = graph -> NumGlobalCols(); + n_cols = n_global_cols(*graph); else - n_cols = column_space_map->NumGlobalElements(); + n_cols = n_global_elements(*column_space_map); return n_cols; } @@ -566,24 +676,24 @@ namespace TrilinosWrappers - std::pair<unsigned int, unsigned int> + std::pair<SparsityPattern::size_type, SparsityPattern::size_type> SparsityPattern::local_range () const { - unsigned int begin, end; - begin = graph -> RowMap().MinMyGID(); - end = graph -> RowMap().MaxMyGID()+1; + size_type begin, end; + begin = min_my_gid(graph->RowMap()); + end = max_my_gid(graph->RowMap())+1; return std::make_pair (begin, end); } - unsigned int + SparsityPattern::size_type SparsityPattern::n_nonzero_elements () const { - int nnz = graph->NumGlobalEntries(); + TrilinosWrappers::types::int_type nnz = n_global_entries(*graph); - return static_cast<unsigned int>(nnz); + return static_cast<size_type>(nnz); } @@ -598,15 +708,16 @@ namespace TrilinosWrappers - unsigned int - SparsityPattern::row_length (const unsigned int row) const + SparsityPattern::size_type + SparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcInternalError()); // get a representation of the // present row - int ncols = -1; - int local_row = graph->LRID(static_cast<int>(row)); + TrilinosWrappers::types::int_type ncols = -1; + TrilinosWrappers::types::int_type local_row = + graph->LRID(static_cast<TrilinosWrappers::types::int_type>(row)); // on the processor who owns this // row, we'll have a non-negative @@ -614,7 +725,7 @@ namespace TrilinosWrappers if (local_row >= 0) ncols = graph->NumMyIndices (local_row); - return static_cast<unsigned int>(ncols); + return static_cast<size_type>(ncols); } @@ -645,7 +756,7 @@ namespace TrilinosWrappers { graph->ExtractMyRowView (i, num_entries, indices); for (int j=0; j<num_entries; ++j) - out << "(" << i << "," << indices[graph->GRID(j)] << ") " + out << "(" << i << "," << indices[global_row_index(*graph,j)] << ") " << std::endl; } } @@ -661,7 +772,7 @@ namespace TrilinosWrappers Assert (graph->Filled() == true, ExcInternalError()); for (unsigned int row=0; row<local_size(); ++row) { - signed int *indices; + int *indices; int num_entries; graph->ExtractMyRowView (row, num_entries, indices); @@ -671,8 +782,8 @@ namespace TrilinosWrappers // j horizontal, gnuplot output is // x-y, that is we have to exchange // the order of output - out << indices[graph->GRID(static_cast<int>(j))] << " " << -static_cast<signed int>(row) - << std::endl; + out << indices[global_row_index(*graph,static_cast<int>(j))] + << " " << -static_cast<signed int>(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 badd19f289..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 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 <deal.II/lac/trilinos_vector.h> @@ -28,6 +30,61 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { + namespace + { +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE + // define a helper function that queries the size of an Epetra_BlockMap object + // 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 n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements(); + } + // define a helper function that queries the pointer to internal array + // containing list of global IDs assigned to the calling processor + // 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) + { + 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 + // function necessary. + int global_length(const Epetra_FEVector &vector) + { + return vector.GlobalLength(); + } +#else + // define a helper function that queries the size of an Epetra_BlockMap object + // 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 n_global_elements (const Epetra_BlockMap &map) + { + return map.NumGlobalElements64(); + } + // define a helper function that queries the pointer to internal array + // containing list of global IDs assigned to the calling processor + // 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) + { + 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 + // function necessary. + long long int global_length(const Epetra_FEVector &vector) + { + return vector.GlobalLength64(); + } +#endif + } + namespace MPI { @@ -71,9 +128,9 @@ namespace TrilinosWrappers : VectorBase() { - AssertThrow (input_map.NumGlobalElements() == v.vector->Map().NumGlobalElements(), - ExcDimensionMismatch (input_map.NumGlobalElements(), - v.vector->Map().NumGlobalElements())); + AssertThrow (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; @@ -94,9 +151,10 @@ namespace TrilinosWrappers : VectorBase() { - AssertThrow ((int)parallel_partitioner.size() == v.vector->Map().NumGlobalElements(), + AssertThrow (parallel_partitioner.size() == + static_cast<size_type>(n_global_elements(v.vector->Map())), ExcDimensionMismatch (parallel_partitioner.size(), - v.vector->Map().NumGlobalElements())); + n_global_elements(v.vector->Map()))); last_action = Zero; @@ -106,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 () @@ -228,14 +297,15 @@ namespace TrilinosWrappers // create a vector that holds all the elements // contained in the block vector. need to // manually create an Epetra_Map. - unsigned int n_elements = 0, added_elements = 0, block_offset = 0; - for (unsigned int block=0; block<v.n_blocks(); ++block) + size_type n_elements = 0, added_elements = 0, block_offset = 0; + for (size_type block=0; block<v.n_blocks(); ++block) n_elements += v.block(block).local_size(); - std::vector<int> global_ids (n_elements, -1); - for (unsigned int block=0; block<v.n_blocks(); ++block) + std::vector<TrilinosWrappers::types::int_type> global_ids (n_elements, -1); + for (size_type block=0; block<v.n_blocks(); ++block) { - int *glob_elements = v.block(block).vector_partitioner().MyGlobalElements(); - for (unsigned int i=0; i<v.block(block).local_size(); ++i) + TrilinosWrappers::types::int_type *glob_elements = + my_global_elements(v.block(block).vector_partitioner()); + for (size_type i=0; i<v.block(block).local_size(); ++i) global_ids[added_elements++] = glob_elements[i] + block_offset; block_offset += v.block(block).size(); } @@ -255,7 +325,7 @@ namespace TrilinosWrappers TrilinosScalar *entries = (*actual_vec)[0]; block_offset = 0; - for (unsigned int block=0; block<v.n_blocks(); ++block) + for (size_type block=0; block<v.n_blocks(); ++block) { v.block(block).trilinos_vector().ExtractCopy (entries, 0); entries += v.block(block).local_size(); @@ -263,9 +333,9 @@ namespace TrilinosWrappers if (import_data == true) { - AssertThrow (static_cast<unsigned int>(actual_vec->GlobalLength()) + AssertThrow (static_cast<size_type>(global_length(*actual_vec)) == v.size(), - ExcDimensionMismatch (actual_vec->GlobalLength(), + ExcDimensionMismatch (global_length(*actual_vec), v.size())); Epetra_Import data_exchange (vector->Map(), actual_vec->Map()); @@ -279,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) @@ -373,10 +450,10 @@ namespace TrilinosWrappers - Vector::Vector (const unsigned int n) + Vector::Vector (const size_type n) { last_action = Zero; - Epetra_LocalMap map ((int)n, 0, Utilities::Trilinos::comm_self()); + Epetra_LocalMap map ((TrilinosWrappers::types::int_type)n, 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector (map)); } @@ -385,7 +462,7 @@ namespace TrilinosWrappers Vector::Vector (const Epetra_Map &input_map) { last_action = Zero; - Epetra_LocalMap map (input_map.NumGlobalElements(), + Epetra_LocalMap map (n_global_elements(input_map), input_map.IndexBase(), input_map.Comm()); vector.reset (new Epetra_FEVector(map)); @@ -397,7 +474,7 @@ namespace TrilinosWrappers const MPI_Comm &communicator) { last_action = Zero; - Epetra_LocalMap map (static_cast<int>(partitioning.size()), + Epetra_LocalMap map (static_cast<TrilinosWrappers::types::int_type>(partitioning.size()), 0, #ifdef DEAL_II_WITH_MPI Epetra_MpiComm(communicator)); @@ -413,7 +490,7 @@ namespace TrilinosWrappers Vector::Vector (const VectorBase &v) { last_action = Zero; - Epetra_LocalMap map (v.vector->Map().NumGlobalElements(), + Epetra_LocalMap map (n_global_elements(v.vector->Map()), v.vector->Map().IndexBase(), v.vector->Map().Comm()); vector.reset (new Epetra_FEVector(map)); @@ -431,12 +508,12 @@ namespace TrilinosWrappers void - Vector::reinit (const unsigned int n, - const bool fast) + Vector::reinit (const size_type n, + const bool fast) { if (size() != n) { - Epetra_LocalMap map ((int)n, 0, + Epetra_LocalMap map ((TrilinosWrappers::types::int_type)n, 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector (map)); } @@ -459,9 +536,9 @@ namespace TrilinosWrappers Vector::reinit (const Epetra_Map &input_map, const bool fast) { - if (vector->Map().NumGlobalElements() != input_map.NumGlobalElements()) + if (n_global_elements(vector->Map()) != n_global_elements(input_map)) { - Epetra_LocalMap map (input_map.NumGlobalElements(), + Epetra_LocalMap map (n_global_elements(input_map), input_map.IndexBase(), input_map.Comm()); vector.reset (new Epetra_FEVector (map)); @@ -486,10 +563,10 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const bool fast) { - if (vector->Map().NumGlobalElements() != - static_cast<int>(partitioning.size())) + if (n_global_elements(vector->Map()) != + static_cast<TrilinosWrappers::types::int_type>(partitioning.size())) { - Epetra_LocalMap map (static_cast<int>(partitioning.size()), + Epetra_LocalMap map (static_cast<TrilinosWrappers::types::int_type>(partitioning.size()), 0, #ifdef DEAL_II_WITH_MPI Epetra_MpiComm(communicator)); @@ -530,7 +607,7 @@ namespace TrilinosWrappers { if (local_range() != v.local_range()) { - Epetra_LocalMap map (v.vector->GlobalLength(), + Epetra_LocalMap map (global_length(*(v.vector)), v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); @@ -585,7 +662,7 @@ namespace TrilinosWrappers { if (size() != v.size()) { - Epetra_LocalMap map (v.vector->Map().NumGlobalElements(), + Epetra_LocalMap map (n_global_elements(v.vector->Map()), v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); @@ -602,7 +679,7 @@ namespace TrilinosWrappers { if (size() != v.size()) { - Epetra_LocalMap map (v.vector->Map().NumGlobalElements(), + Epetra_LocalMap map (n_global_elements(v.vector->Map()), v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); diff --git a/deal.II/source/lac/trilinos_vector_base.cc b/deal.II/source/lac/trilinos_vector_base.cc index 9f52cb200f..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 <deal.II/base/memory_consumption.h> #include <deal.II/lac/trilinos_vector_base.h> @@ -25,6 +27,27 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { + namespace + { +#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 + // function necessary. + int global_length(const Epetra_FEVector &vector) + { + return vector.GlobalLength(); + } +#else + // define a helper function that queries the global vector length of an + // Epetra_FEVector object by calling either the 32- or 64-bit + // function necessary. + long long int global_length(const Epetra_FEVector &vector) + { + return vector.GlobalLength64(); + } +#endif + } + namespace internal { VectorReference::operator TrilinosScalar () const @@ -40,7 +63,8 @@ namespace TrilinosWrappers // we can use []. Note that we // can only get local values. - const int local_index = vector.vector->Map().LID(static_cast<int>(index)); + const TrilinosWrappers::types::int_type local_index = + vector.vector->Map().LID(static_cast<TrilinosWrappers::types::int_type>(index)); Assert (local_index >= 0, ExcAccessToNonLocalElement (index, vector.vector->Map().MinMyGID(), @@ -152,9 +176,9 @@ namespace TrilinosWrappers // // let's hope this isn't a // particularly frequent operation - std::pair<unsigned int, unsigned int> + std::pair<size_type, size_type> local_range = this->local_range (); - for (unsigned int i=local_range.first; i<local_range.second; ++i) + for (size_type i=local_range.first; i<local_range.second; ++i) (*vector)[0][i-local_range.first] = v(i); return *this; @@ -163,11 +187,12 @@ namespace TrilinosWrappers TrilinosScalar - VectorBase::el (const unsigned int index) const + VectorBase::el (const size_type index) const { // Extract local indices in // the vector. - int trilinos_i = vector->Map().LID(static_cast<int>(index)); + TrilinosWrappers::types::int_type trilinos_i = + vector->Map().LID(static_cast<TrilinosWrappers::types::int_type>(index)); TrilinosScalar value = 0.; // If the element is not @@ -191,11 +216,12 @@ namespace TrilinosWrappers TrilinosScalar - VectorBase::operator () (const unsigned int index) const + VectorBase::operator () (const size_type index) const { // Extract local indices in // the vector. - int trilinos_i = vector->Map().LID(static_cast<int>(index)); + TrilinosWrappers::types::int_type trilinos_i = + vector->Map().LID(static_cast<TrilinosWrappers::types::int_type>(index)); TrilinosScalar value = 0.; // If the element is not present @@ -246,7 +272,7 @@ namespace TrilinosWrappers if (local_size() != v.local_size()) return false; - unsigned int i; + size_type i; for (i=0; i<local_size(); i++) if ((*(v.vector))[0][i]!=(*vector)[0][i]) return false; @@ -347,9 +373,9 @@ namespace TrilinosWrappers void VectorBase::print (const char *format) const { - Assert (vector->GlobalLength()!=0, ExcEmptyObject()); + Assert (global_length(*vector)!=0, ExcEmptyObject()); - for (unsigned int j=0; j<size(); ++j) + for (size_type j=0; j<size(); ++j) { double t = (*vector)[0][j]; @@ -389,10 +415,10 @@ namespace TrilinosWrappers out.setf (std::ios::fixed, std::ios::floatfield); if (across) - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << static_cast<double>(val[i]) << ' '; else - for (unsigned int i=0; i<size(); ++i) + for (size_type i=0; i<size(); ++i) out << static_cast<double>(val[i]) << std::endl; out << std::endl; @@ -422,7 +448,8 @@ namespace TrilinosWrappers //one index and the value per local //entry. return sizeof(*this) - + this->local_size()*( sizeof(double)+sizeof(int) ); + + this->local_size()*( sizeof(double)+ + 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 <deal.II/lac/vector.templates.h> 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 2e138a2644..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 <deal.II/lac/vector_memory.h> #include <deal.II/lac/vector.h> @@ -53,13 +55,10 @@ GrowingVectorMemory<VECTOR>::Pool::~Pool() // vectors. Actually, there should // be none, if there is no memory // leak - unsigned int n=0; for (typename std::vector<entry_type>::iterator i=data->begin(); i != data->end(); ++i) { - if (i->first == true) - ++n; delete i->second; } delete data; @@ -69,7 +68,7 @@ GrowingVectorMemory<VECTOR>::Pool::~Pool() template <typename VECTOR> inline void -GrowingVectorMemory<VECTOR>::Pool::initialize(const unsigned int size) +GrowingVectorMemory<VECTOR>::Pool::initialize(const size_type size) { if (data == 0) { @@ -88,7 +87,7 @@ GrowingVectorMemory<VECTOR>::Pool::initialize(const unsigned int size) template <typename VECTOR> inline -GrowingVectorMemory<VECTOR>::GrowingVectorMemory (const unsigned int initial_size, +GrowingVectorMemory<VECTOR>::GrowingVectorMemory (const size_type initial_size, const bool log_statistics) : 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 <deal.II/lac/vector_view.h> 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..ee5c8bc58a 100644 --- a/deal.II/source/matrix_free/CMakeLists.txt +++ b/deal.II/source/matrix_free/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/matrix_free/matrix_free.templates.h> #include <deal.II/base/utilities.h> 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..f58b0fcf63 100644 --- a/deal.II/source/meshworker/CMakeLists.txt +++ b/deal.II/source/meshworker/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/meshworker/local_results.h> #include <deal.II/meshworker/local_integrator.h> @@ -61,10 +66,46 @@ namespace MeshWorker {} + template <int dim, int spacedim, typename number> + LocalIntegrator<dim, spacedim, number>::LocalIntegrator (bool c, bool b, bool f) + : + use_cell(c), use_boundary(b), use_face(f) + {} + + template <int dim, int spacedim, typename number> LocalIntegrator<dim, spacedim, number>::~LocalIntegrator () {} + template <int dim, int spacedim, typename number> + void + LocalIntegrator<dim, spacedim, number>::cell (DoFInfo<dim, spacedim, number> &, + IntegrationInfo<dim, spacedim> &) const + { + Assert(false, ExcPureFunction()); + } + + + template <int dim, int spacedim, typename number> + void + LocalIntegrator<dim, spacedim, number>::boundary (DoFInfo<dim, spacedim, number> &, + IntegrationInfo<dim, spacedim> &) const + { + Assert(false, ExcPureFunction()); + } + + + template <int dim, int spacedim, typename number> + void + LocalIntegrator<dim, spacedim, number>::face (DoFInfo<dim, spacedim, number> &, + DoFInfo<dim, spacedim, number> &, + IntegrationInfo<dim, spacedim> &, + IntegrationInfo<dim, spacedim> &) 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 <deal.II/lac/vector.h> #include <deal.II/lac/block_vector.h> 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 <deal.II/lac/vector.h> #include <deal.II/lac/block_vector.h> 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..797b59f8ea 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) diff --git a/deal.II/source/multigrid/CMakeLists.txt b/deal.II/source/multigrid/CMakeLists.txt index 27c0307d6f..40c223f30d 100644 --- a/deal.II/source/multigrid/CMakeLists.txt +++ b/deal.II/source/multigrid/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. ## -## <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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) 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 <deal.II/lac/vector.h> #include <deal.II/lac/block_vector.h> 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 <deal.II/base/memory_consumption.h> #include <deal.II/lac/sparse_matrix.h> 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 49660106ce..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 <deal.II/base/multithread_info.h> #include <deal.II/base/logstream.h> @@ -130,8 +132,8 @@ namespace MGTools const typename DoFHandler<dim,spacedim>::cell_iterator end = dofs.end(level); typename DoFHandler<dim,spacedim>::active_cell_iterator cell; - std::vector<unsigned int> cell_indices; - std::vector<unsigned int> neighbor_indices; + std::vector<types::global_dof_index> cell_indices; + std::vector<types::global_dof_index> neighbor_indices; // We loop over cells and go from // cells to lower dimensional @@ -304,8 +306,8 @@ namespace MGTools const typename DoFHandler<dim,spacedim>::cell_iterator end = dofs.end(level); typename DoFHandler<dim,spacedim>::active_cell_iterator cell; - std::vector<unsigned int> cell_indices; - std::vector<unsigned int> neighbor_indices; + std::vector<types::global_dof_index> cell_indices; + std::vector<types::global_dof_index> neighbor_indices; // We have to translate the // couplings from components to @@ -542,7 +544,7 @@ namespace MGTools SparsityPattern &sparsity, const unsigned int level) { - const unsigned int n_dofs = dof.n_dofs(level); + const types::global_dof_index n_dofs = dof.n_dofs(level); Assert (sparsity.n_rows() == n_dofs, ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); @@ -550,7 +552,7 @@ namespace MGTools ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; - std::vector<unsigned int> dofs_on_this_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell); typename DH::cell_iterator cell = dof.begin(level), endc = dof.end(level); for (; cell!=endc; ++cell) @@ -575,7 +577,7 @@ namespace MGTools SparsityPattern &sparsity, const unsigned int level) { - const unsigned int n_dofs = dof.n_dofs(level); + const types::global_dof_index n_dofs = dof.n_dofs(level); Assert (sparsity.n_rows() == n_dofs, ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); @@ -583,12 +585,14 @@ namespace MGTools ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; - std::vector<unsigned int> dofs_on_this_cell(dofs_per_cell); - std::vector<unsigned int> dofs_on_other_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell); typename DoFHandler<dim,spacedim>::cell_iterator cell = dof.begin(level), 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<dofs_per_cell; ++i) @@ -632,11 +636,11 @@ namespace MGTools SparsityPattern &sparsity, const unsigned int level) { - Assert ((level>=1) && (level<dof.get_tria().n_levels()), - ExcIndexRange(level, 1, dof.get_tria().n_levels())); + Assert ((level>=1) && (level<dof.get_tria().n_global_levels()), + ExcIndexRange(level, 1, dof.get_tria().n_global_levels())); - const unsigned int fine_dofs = dof.n_dofs(level); - const unsigned int coarse_dofs = dof.n_dofs(level-1); + const types::global_dof_index fine_dofs = dof.n_dofs(level); + const types::global_dof_index coarse_dofs = dof.n_dofs(level-1); // Matrix maps from fine level to coarse level @@ -646,12 +650,14 @@ namespace MGTools ExcDimensionMismatch (sparsity.n_cols(), fine_dofs)); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; - std::vector<unsigned int> dofs_on_this_cell(dofs_per_cell); - std::vector<unsigned int> dofs_on_other_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell); typename DoFHandler<dim,spacedim>::cell_iterator cell = dof.begin(level), 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); // Loop over all interior neighbors for (unsigned int face = 0; @@ -694,7 +700,7 @@ namespace MGTools const Table<2,DoFTools::Coupling> &flux_mask) { const FiniteElement<dim> &fe = dof.get_fe(); - const unsigned int n_dofs = dof.n_dofs(level); + const types::global_dof_index n_dofs = dof.n_dofs(level); const unsigned int n_comp = fe.n_components(); Assert (sparsity.n_rows() == n_dofs, @@ -711,8 +717,8 @@ namespace MGTools ExcDimensionMismatch (flux_mask.n_cols(), n_comp)); const unsigned int total_dofs = fe.dofs_per_cell; - std::vector<unsigned int> dofs_on_this_cell(total_dofs); - std::vector<unsigned int> dofs_on_other_cell(total_dofs); + std::vector<types::global_dof_index> dofs_on_this_cell(total_dofs); + std::vector<types::global_dof_index> dofs_on_other_cell(total_dofs); Table<2,bool> support_on_face(total_dofs, GeometryInfo<dim>::faces_per_cell); typename DoFHandler<dim,spacedim>::cell_iterator cell = dof.begin(level), @@ -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<total_dofs; ++i) @@ -872,11 +880,11 @@ namespace MGTools const FiniteElement<dim> &fe = dof.get_fe(); const unsigned int n_comp = fe.n_components(); - Assert ((level>=1) && (level<dof.get_tria().n_levels()), - ExcIndexRange(level, 1, dof.get_tria().n_levels())); + Assert ((level>=1) && (level<dof.get_tria().n_global_levels()), + ExcIndexRange(level, 1, dof.get_tria().n_global_levels())); - const unsigned int fine_dofs = dof.n_dofs(level); - const unsigned int coarse_dofs = dof.n_dofs(level-1); + const types::global_dof_index fine_dofs = dof.n_dofs(level); + const types::global_dof_index coarse_dofs = dof.n_dofs(level-1); // Matrix maps from fine level to coarse level @@ -890,8 +898,8 @@ namespace MGTools ExcDimensionMismatch (flux_mask.n_cols(), n_comp)); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; - std::vector<unsigned int> dofs_on_this_cell(dofs_per_cell); - std::vector<unsigned int> dofs_on_other_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell); Table<2,bool> support_on_face(dofs_per_cell, GeometryInfo<dim>::faces_per_cell); typename DoFHandler<dim,spacedim>::cell_iterator cell = dof.begin(level), @@ -906,6 +914,8 @@ namespace MGTools for (; cell!=endc; ++cell) { + if (!cell->is_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // Loop over all interior neighbors for (unsigned int face = 0; @@ -944,13 +954,13 @@ namespace MGTools template <int dim, int spacedim> void count_dofs_per_component (const DoFHandler<dim,spacedim> &dof_handler, - std::vector<std::vector<unsigned int> > &result, + std::vector<std::vector<types::global_dof_index> > &result, bool only_once, std::vector<unsigned int> target_component) { const FiniteElement<dim> &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)); @@ -1046,7 +1056,7 @@ namespace MGTools template <int dim, int spacedim> void count_dofs_per_component (const DoFHandler<dim,spacedim> &dof_handler, - std::vector<std::vector<unsigned int> > &result, + std::vector<std::vector<types::global_dof_index> > &result, std::vector<unsigned int> target_component) { count_dofs_per_component (dof_handler, result, @@ -1059,12 +1069,12 @@ namespace MGTools void count_dofs_per_block ( const DH &dof_handler, - std::vector<std::vector<unsigned int> > &dofs_per_block, + std::vector<std::vector<types::global_dof_index> > &dofs_per_block, std::vector<unsigned int> target_block) { const FiniteElement<DH::dimension,DH::space_dimension> &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); @@ -1142,7 +1152,7 @@ namespace MGTools make_boundary_list( const DoFHandler<1,1> &, const FunctionMap<1>::type &, - std::vector<std::set<unsigned int> > &, + std::vector<std::set<types::global_dof_index> > &, const ComponentMask &) { Assert(false, ExcNotImplemented()); @@ -1155,7 +1165,7 @@ namespace MGTools make_boundary_list( const DoFHandler<1,2> &, const FunctionMap<1>::type &, - std::vector<std::set<unsigned int> > &, + std::vector<std::set<types::global_dof_index> > &, const ComponentMask &) { Assert(false, ExcNotImplemented()); @@ -1168,7 +1178,7 @@ namespace MGTools make_boundary_list( const DoFHandler<dim,spacedim> &dof, const typename FunctionMap<dim>::type &function_map, - std::vector<std::set<unsigned int> > &boundary_indices, + std::vector<std::set<types::global_dof_index> > &boundary_indices, const ComponentMask &component_mask) { // if for whatever reason we were @@ -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(); @@ -1186,7 +1196,7 @@ namespace MGTools AssertDimension (boundary_indices.size(), n_levels); - std::vector<unsigned int> local_dofs; + std::vector<types::global_dof_index> local_dofs; local_dofs.reserve (DoFTools::max_dofs_per_face(dof)); std::fill (local_dofs.begin (), local_dofs.end (), @@ -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<dim>::faces_per_cell; - ++face_no) - { - if (cell->at_boundary(face_no) == false) - continue; + for (unsigned int face_no = 0; face_no < GeometryInfo<dim>::faces_per_cell; + ++face_no) + { + if (cell->at_boundary(face_no) == false) + continue; - const FiniteElement<dim> &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; i<cell->get_fe().dofs_per_cell; ++i) - { - const ComponentMask &nonzero_component_array - = cell->get_fe().get_nonzero_components (i); - for (unsigned int c=0; c<n_components; ++c) - if ((nonzero_component_array[c] == true) - && - (component_mask[c] == true)) - Assert (cell->get_fe().is_primitive (i), - ExcMessage ("This function can only deal with requested boundary " - "values that correspond to primitive (scalar) base " - "elements")); - } + const FiniteElement<dim> &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; i<cell->get_fe().dofs_per_cell; ++i) + { + const ComponentMask &nonzero_component_array + = cell->get_fe().get_nonzero_components (i); + for (unsigned int c=0; c<n_components; ++c) + if ((nonzero_component_array[c] == true) + && + (component_mask[c] == true)) + Assert (cell->get_fe().is_primitive (i), + ExcMessage ("This function can only deal with requested boundary " + "values that correspond to primitive (scalar) base " + "elements")); + } - typename DoFHandler<dim,spacedim>::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<local_dofs.size(); ++i) - { - unsigned int component; - if (fe.is_primitive()) - component = fe.face_system_to_component_index(i).first; - else - { - // non-primitive - // case. make - // sure that - // this - // particular - // shape - // function - // _is_ - // primitive, - // and get at - // it's - // component. use - // usual - // trick to - // transfer - // face dof - // index to - // cell dof - // index - const unsigned int cell_i - = (dim == 1 ? - i - : - (dim == 2 ? - (i<2*fe.dofs_per_vertex ? i : i+2*fe.dofs_per_vertex) - : - (dim == 3 ? - (i<4*fe.dofs_per_vertex ? - i + typename DoFHandler<dim,spacedim>::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<local_dofs.size(); ++i) + { + unsigned int component; + if (fe.is_primitive()) + component = fe.face_system_to_component_index(i).first; + else + { + // non-primitive + // case. make + // sure that + // this + // particular + // shape + // function + // _is_ + // primitive, + // and get at + // it's + // component. use + // usual + // trick to + // transfer + // face dof + // index to + // cell dof + // index + const unsigned int cell_i + = (dim == 1 ? + i + : + (dim == 2 ? + (i<2*fe.dofs_per_vertex ? i : i+2*fe.dofs_per_vertex) : - (i<4*fe.dofs_per_vertex+4*fe.dofs_per_line ? - i+4*fe.dofs_per_vertex + (dim == 3 ? + (i<4*fe.dofs_per_vertex ? + i + : + (i<4*fe.dofs_per_vertex+4*fe.dofs_per_line ? + i+4*fe.dofs_per_vertex + : + i+4*fe.dofs_per_vertex+8*fe.dofs_per_line)) : - i+4*fe.dofs_per_vertex+8*fe.dofs_per_line)) - : - numbers::invalid_unsigned_int))); - Assert (cell_i < fe.dofs_per_cell, ExcInternalError()); - - // make sure - // that if - // this is - // not a - // primitive - // shape function, - // then all - // the - // corresponding - // components - // in the - // mask are - // not set + numbers::invalid_unsigned_int))); + Assert (cell_i < fe.dofs_per_cell, ExcInternalError()); + + // make sure + // that if + // this is + // not a + // primitive + // shape function, + // then all + // the + // corresponding + // components + // in the + // mask are + // not set // if (!fe.is_primitive(cell_i)) // for (unsigned int c=0; c<n_components; ++c) // if (fe.get_nonzero_components(cell_i)[c]) @@ -1362,18 +1372,18 @@ namespace MGTools // components. if shape function is non-primitive, then we will ignore // the result in the following anyway, otherwise there's only one // non-zero component which we will use - component = fe.get_nonzero_components(cell_i).first_selected_component(); - } + component = fe.get_nonzero_components(cell_i).first_selected_component(); + } - if (component_mask[component] == true) - boundary_indices[level].insert(local_dofs[i]); - } - } - else - for (unsigned int i=0; i<local_dofs.size(); ++i) - boundary_indices[level].insert(local_dofs[i]); - } - } + if (component_mask[component] == true) + boundary_indices[level].insert(local_dofs[i]); + } + } + else + for (unsigned int i=0; i<local_dofs.size(); ++i) + boundary_indices[level].insert(local_dofs[i]); + } + } } } @@ -1385,14 +1395,14 @@ namespace MGTools std::vector<IndexSet> &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<std::set<unsigned int> > - my_boundary_indices (dof.get_tria().n_levels()); + std::vector<std::set<types::global_dof_index> > + 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<dof.get_tria().n_levels(); ++i) + for (unsigned int i=0; i<dof.get_tria().n_global_levels(); ++i) { boundary_indices[i] = IndexSet (dof.n_dofs(i)); boundary_indices[i].add_indices (my_boundary_indices[i].begin(), @@ -1408,11 +1418,11 @@ namespace MGTools extract_inner_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler, std::vector<std::vector<bool> > &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.get_tria().n_levels(); ++l) + for (unsigned int l=0; l<mg_dof_handler.get_tria().n_global_levels(); ++l) { Assert (interface_dofs[l].size() == mg_dof_handler.n_dofs(l), ExcDimensionMismatch (interface_dofs[l].size(), @@ -1428,7 +1438,7 @@ namespace MGTools const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int dofs_per_face = fe.dofs_per_face; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<bool> cell_dofs(dofs_per_cell, false); typename DoFHandler<dim>::cell_iterator cell = mg_dof_handler.begin(), @@ -1473,18 +1483,18 @@ namespace MGTools template <int dim, int spacedim> void extract_non_interface_dofs (const DoFHandler<dim,spacedim> &mg_dof_handler, - std::vector<std::set<unsigned int> > &non_interface_dofs) + std::vector<std::set<types::global_dof_index> > &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<dim,spacedim> &fe = mg_dof_handler.get_fe(); const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int dofs_per_face = fe.dofs_per_face; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); std::vector<bool> cell_dofs(dofs_per_cell, false); std::vector<bool> cell_dofs_interface(dofs_per_cell, false); @@ -1545,14 +1555,14 @@ namespace MGTools std::vector<std::vector<bool> > &interface_dofs, std::vector<std::vector<bool> > &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<mg_dof_handler.get_tria().n_levels(); ++l) + for (unsigned int l=0; l<mg_dof_handler.get_tria().n_global_levels(); ++l) { Assert (interface_dofs[l].size() == mg_dof_handler.n_dofs(l), ExcDimensionMismatch (interface_dofs[l].size(), @@ -1574,8 +1584,8 @@ namespace MGTools const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int dofs_per_face = fe.dofs_per_face; - std::vector<unsigned int> local_dof_indices (dofs_per_cell); - std::vector<unsigned int> face_dof_indices (dofs_per_face); + std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> face_dof_indices (dofs_per_face); std::vector<bool> cell_dofs(dofs_per_cell, false); std::vector<bool> boundary_cell_dofs(dofs_per_cell, false); @@ -1641,7 +1651,7 @@ namespace MGTools template <typename number> void apply_boundary_values ( - const std::set<unsigned int> &boundary_dofs, + const std::set<types::global_dof_index> &boundary_dofs, SparseMatrix<number> &matrix, const bool preserve_symmetry, const bool /*ignore_zeros*/) @@ -1652,8 +1662,8 @@ namespace MGTools // a deprecated function, I therefore threw away the original function // and replaced it by the following, which I believe should work - std::map<unsigned int, double> boundary_values; - for (std::set<unsigned int>::const_iterator p=boundary_dofs.begin(); + std::map<types::global_dof_index, double> boundary_values; + for (std::set<types::global_dof_index>::const_iterator p=boundary_dofs.begin(); p != boundary_dofs.end(); ++p) boundary_values[*p] = 0; @@ -1668,7 +1678,7 @@ namespace MGTools template <typename number> void apply_boundary_values ( - const std::set<unsigned int> &boundary_dofs, + const std::set<types::global_dof_index> &boundary_dofs, BlockSparseMatrix<number> &matrix, const bool preserve_symmetry) { @@ -1684,8 +1694,8 @@ namespace MGTools // a deprecated function, I therefore threw away the original function // and replaced it by the following, which I believe should work - std::map<unsigned int, double> boundary_values; - for (std::set<unsigned int>::const_iterator p=boundary_dofs.begin(); + std::map<types::global_dof_index, double> boundary_values; + for (std::set<types::global_dof_index>::const_iterator p=boundary_dofs.begin(); p != boundary_dofs.end(); ++p) boundary_values[*p] = 0; @@ -1707,16 +1717,16 @@ namespace MGTools namespace MGTools { template void apply_boundary_values ( - const std::set<unsigned int> &, + const std::set<types::global_dof_index> &, SparseMatrix<float> &, const bool, const bool); template void apply_boundary_values ( - const std::set<unsigned int> &, + const std::set<types::global_dof_index> &, SparseMatrix<double> &, const bool, const bool); template void apply_boundary_values ( - const std::set<unsigned int> &, + const std::set<types::global_dof_index> &, BlockSparseMatrix<float> &, const bool); template void apply_boundary_values ( - const std::set<unsigned int> &, + const std::set<types::global_dof_index> &, BlockSparseMatrix<double> &, const bool); } diff --git a/deal.II/source/multigrid/mg_tools.inst.in b/deal.II/source/multigrid/mg_tools.inst.in index 9a0b2b8c85..8d4a68359b 100644 --- a/deal.II/source/multigrid/mg_tools.inst.in +++ b/deal.II/source/multigrid/mg_tools.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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 (PATTERN : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS; @@ -84,23 +89,23 @@ for (deal_II_dimension : DIMENSIONS) #endif template void count_dofs_per_component ( - const DoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&, + const DoFHandler<deal_II_dimension>&, std::vector<std::vector<types::global_dof_index> >&, bool, std::vector<unsigned int>); template void count_dofs_per_component ( - const DoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&, + const DoFHandler<deal_II_dimension>&, std::vector<std::vector<types::global_dof_index> >&, std::vector<unsigned int>); template void count_dofs_per_block ( - const DoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&, + const DoFHandler<deal_II_dimension>&, std::vector<std::vector<types::global_dof_index> >&, std::vector<unsigned int>); template void count_dofs_per_block ( - const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<unsigned int> >&, + const MGDoFHandler<deal_II_dimension>&, std::vector<std::vector<types::global_dof_index> >&, std::vector<unsigned int>); #if deal_II_dimension > 1 template void make_boundary_list( const DoFHandler<deal_II_dimension>&, const FunctionMap<deal_II_dimension>::type&, - std::vector<std::set<unsigned int> >&, + std::vector<std::set<types::global_dof_index> >&, const ComponentMask &); #endif @@ -122,18 +127,18 @@ for (deal_II_dimension : DIMENSIONS) template void extract_non_interface_dofs (const DoFHandler<deal_II_dimension> & mg_dof_handler, - std::vector<std::set<unsigned int> > &non_interface_dofs); + std::vector<std::set<types::global_dof_index> > &non_interface_dofs); #if deal_II_dimension < 3 template void count_dofs_per_block ( const DoFHandler<deal_II_dimension,deal_II_dimension+1>&, - std::vector<std::vector<unsigned int> >&, std::vector<unsigned int>); + std::vector<std::vector<types::global_dof_index> >&, std::vector<unsigned int>); #endif #if deal_II_dimension == 3 template void count_dofs_per_block ( const DoFHandler<1,3>&, - std::vector<std::vector<unsigned int> >&, std::vector<unsigned int>); + std::vector<std::vector<types::global_dof_index> >&, std::vector<unsigned int>); #endif \} } diff --git a/deal.II/source/multigrid/mg_transfer_block.cc b/deal.II/source/multigrid/mg_transfer_block.cc index acf82b29ea..d8dcd64ed1 100644 --- a/deal.II/source/multigrid/mg_transfer_block.cc +++ b/deal.II/source/multigrid/mg_transfer_block.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + #include <deal.II/base/logstream.h> @@ -49,7 +53,7 @@ namespace const dealii::DoFHandler<dim,spacedim> &mg_dof, MGLevelObject<BlockVector<number> > &v, const std::vector<bool> &sel, - std::vector<std::vector<unsigned int> > &ndofs) + std::vector<std::vector<types::global_dof_index> > &ndofs) { std::vector<bool> selected=sel; // Compute the number of blocks needed @@ -60,9 +64,9 @@ namespace if (ndofs.size() == 0) { - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > new_dofs(mg_dof.get_tria().n_levels(), - std::vector<unsigned int>(selected.size())); + std::vector<types::global_dof_index>(selected.size())); std::swap(ndofs, new_dofs); MGTools::count_dofs_per_block (mg_dof, ndofs); } @@ -96,7 +100,7 @@ namespace const dealii::DoFHandler<dim,spacedim> &mg_dof, MGLevelObject<dealii::Vector<number> > &v, const unsigned int selected_block, - std::vector<std::vector<unsigned int> > &ndofs) + std::vector<std::vector<types::global_dof_index> > &ndofs) { const unsigned int n_blocks = mg_dof.get_fe().n_blocks(); Assert(selected_block < n_blocks, ExcIndexRange(selected_block, 0, n_blocks)); @@ -106,9 +110,9 @@ namespace if (ndofs.size() == 0) { - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > new_dofs(mg_dof.get_tria().n_levels(), - std::vector<unsigned int>(selected.size())); + std::vector<types::global_dof_index>(selected.size())); std::swap(ndofs, new_dofs); MGTools::count_dofs_per_block (mg_dof, ndofs); } @@ -229,7 +233,7 @@ void MGTransferBlockBase::build_matrices ( // Compute the lengths of all blocks sizes.clear (); - sizes.resize(n_levels, std::vector<unsigned int>(fe.n_blocks())); + sizes.resize(n_levels, std::vector<types::global_dof_index>(fe.n_blocks())); MGTools::count_dofs_per_block(mg_dof, sizes); // Fill some index vectors @@ -238,10 +242,10 @@ void MGTransferBlockBase::build_matrices ( // Compute start indices from sizes for (unsigned int l=0; l<mg_block_start.size(); ++l) { - unsigned int k=0; + types::global_dof_index k=0; for (unsigned int i=0; i<mg_block_start[l].size(); ++i) { - const unsigned int t=mg_block_start[l][i]; + const types::global_dof_index t=mg_block_start[l][i]; mg_block_start[l][i] = k; k += t; } @@ -251,10 +255,10 @@ void MGTransferBlockBase::build_matrices ( DoFTools::count_dofs_per_block (static_cast<const DoFHandler<dim,spacedim>&>(mg_dof), block_start); - unsigned int k=0; + types::global_dof_index k=0; for (unsigned int i=0; i<block_start.size(); ++i) { - const unsigned int t=block_start[i]; + const types::global_dof_index t=block_start[i]; block_start[i] = k; k += t; } @@ -295,8 +299,8 @@ void MGTransferBlockBase::build_matrices ( // two fields which will store the // indices of the multigrid dofs // for a cell and one of its children - std::vector<unsigned int> dof_indices_parent (dofs_per_cell); - std::vector<unsigned int> dof_indices_child (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_parent (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_child (dofs_per_cell); // for each level: first build the // sparsity pattern of the matrices @@ -411,7 +415,7 @@ void MGTransferBlockBase::build_matrices ( if (mg_constrained_dofs != 0) if (mg_constrained_dofs->set_boundary_values()) { - std::vector<unsigned int> constrain_indices; + std::vector<types::global_dof_index> constrain_indices; std::vector<std::vector<bool> > constraints_per_block (n_blocks); for (int level=n_levels-2; level>=0; --level) { @@ -425,7 +429,7 @@ void MGTransferBlockBase::build_matrices ( // need to filter away. constrain_indices.resize (0); constrain_indices.resize (prolongation_matrices[level]->n(), 0); - std::set<unsigned int>::const_iterator dof + std::set<types::global_dof_index>::const_iterator dof = mg_constrained_dofs->get_boundary_indices()[level].begin(), endd = mg_constrained_dofs->get_boundary_indices()[level].end(); for (; dof != endd; ++dof) @@ -434,13 +438,13 @@ void MGTransferBlockBase::build_matrices ( unsigned int index = 0; for (unsigned int block=0; block<n_blocks; ++block) { - const unsigned int n_dofs = prolongation_matrices[level]->block(block, block).m(); + const types::global_dof_index n_dofs = prolongation_matrices[level]->block(block, block).m(); constraints_per_block[block].resize(0); constraints_per_block[block].resize(n_dofs, 0); - for (unsigned int i=0; i<n_dofs; ++i, ++index) + for (types::global_dof_index i=0; i<n_dofs; ++i, ++index) constraints_per_block[block][i] = constrain_indices[index] == 1; - for (unsigned int i=0; i<n_dofs; ++i) + for (types::global_dof_index i=0; i<n_dofs; ++i) { SparseMatrix<double>::iterator start_row = prolongation_matrices[level]->block(block, block).begin(i), @@ -474,9 +478,9 @@ void MGTransferBlockSelect<number>::build_matrices ( MGTransferBlockBase::build_matrices (dof, mg_dof); - std::vector<unsigned int> temp_copy_indices; - std::vector<unsigned int> global_dof_indices (fe.dofs_per_cell); - std::vector<unsigned int> level_dof_indices (fe.dofs_per_cell); + std::vector<types::global_dof_index> temp_copy_indices; + std::vector<types::global_dof_index> global_dof_indices (fe.dofs_per_cell); + std::vector<types::global_dof_index> level_dof_indices (fe.dofs_per_cell); for (int level=dof.get_tria().n_levels()-1; level>=0; --level) { @@ -487,7 +491,7 @@ void MGTransferBlockSelect<number>::build_matrices ( temp_copy_indices.resize (0); temp_copy_indices.resize (sizes[level][selected_block], - numbers::invalid_unsigned_int); + numbers::invalid_dof_index); // Compute coarse level right hand side // by restricting from fine level. @@ -524,16 +528,16 @@ void MGTransferBlockSelect<number>::build_matrices ( // copy_indices object. Then, insert the pairs // of global index and level index into // copy_indices. - const unsigned int n_active_dofs = + const types::global_dof_index n_active_dofs = std::count_if (temp_copy_indices.begin(), temp_copy_indices.end(), - std::bind2nd(std::not_equal_to<unsigned int>(), - numbers::invalid_unsigned_int)); + std::bind2nd(std::not_equal_to<types::global_dof_index>(), + numbers::invalid_dof_index)); copy_indices[selected_block][level].resize (n_active_dofs); - unsigned int counter = 0; - for (unsigned int i=0; i<temp_copy_indices.size(); ++i) - if (temp_copy_indices[i] != numbers::invalid_unsigned_int) + types::global_dof_index counter = 0; + for (types::global_dof_index i=0; i<temp_copy_indices.size(); ++i) + if (temp_copy_indices[i] != numbers::invalid_dof_index) copy_indices[selected_block][level][counter++] = - std::pair<unsigned int, unsigned int> (temp_copy_indices[i], i); + std::pair<types::global_dof_index, unsigned int> (temp_copy_indices[i], i); Assert (counter == n_active_dofs, ExcInternalError()); } } @@ -562,9 +566,9 @@ void MGTransferBlock<number>::build_matrices ( MGTransferBlockBase::build_matrices (dof, mg_dof); - std::vector<std::vector<unsigned int> > temp_copy_indices (n_blocks); - std::vector<unsigned int> global_dof_indices (fe.dofs_per_cell); - std::vector<unsigned int> level_dof_indices (fe.dofs_per_cell); + std::vector<std::vector<types::global_dof_index> > temp_copy_indices (n_blocks); + std::vector<types::global_dof_index> global_dof_indices (fe.dofs_per_cell); + std::vector<types::global_dof_index> level_dof_indices (fe.dofs_per_cell); for (int level=dof.get_tria().n_levels()-1; level>=0; --level) { typename DoFHandler<dim,spacedim>::active_cell_iterator @@ -577,7 +581,7 @@ void MGTransferBlock<number>::build_matrices ( { temp_copy_indices[block].resize (0); temp_copy_indices[block].resize (sizes[level][block], - numbers::invalid_unsigned_int); + numbers::invalid_dof_index); } // Compute coarse level right hand side @@ -603,17 +607,17 @@ void MGTransferBlock<number>::build_matrices ( for (unsigned int block=0; block<n_blocks; ++block) if (selected[block]) { - const unsigned int n_active_dofs = + const types::global_dof_index n_active_dofs = std::count_if (temp_copy_indices[block].begin(), temp_copy_indices[block].end(), - std::bind2nd(std::not_equal_to<unsigned int>(), - numbers::invalid_unsigned_int)); + std::bind2nd(std::not_equal_to<types::global_dof_index>(), + numbers::invalid_dof_index)); copy_indices[block][level].resize (n_active_dofs); - unsigned int counter = 0; - for (unsigned int i=0; i<temp_copy_indices[block].size(); ++i) - if (temp_copy_indices[block][i] != numbers::invalid_unsigned_int) + types::global_dof_index counter = 0; + for (types::global_dof_index i=0; i<temp_copy_indices[block].size(); ++i) + if (temp_copy_indices[block][i] != numbers::invalid_dof_index) copy_indices[block][level][counter++] = - std::pair<unsigned int, unsigned int> + std::pair<types::global_dof_index, unsigned int> (temp_copy_indices[block][i], i); Assert (counter == n_active_dofs, ExcInternalError()); } 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 74d58198ab..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 <deal.II/base/logstream.h> #include <deal.II/base/function.h> @@ -79,7 +83,7 @@ namespace MGLevelObject<BlockVector<number> > &v, const std::vector<bool> &sel, const std::vector<unsigned int> &target_comp, - std::vector<std::vector<unsigned int> > &ndofs) + std::vector<std::vector<types::global_dof_index> > &ndofs) { std::vector<bool> selected=sel; std::vector<unsigned int> target_component=target_comp; @@ -122,9 +126,9 @@ namespace if (ndofs.size() == 0) { - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > new_dofs(mg_dof.get_tria().n_levels(), - std::vector<unsigned int>(target_component.size())); + std::vector<types::global_dof_index>(target_component.size())); std::swap(ndofs, new_dofs); MGTools::count_dofs_per_block (mg_dof, ndofs, target_component); } @@ -179,7 +183,7 @@ namespace MGLevelObject<dealii::Vector<number> > &v, const ComponentMask &component_mask, const std::vector<unsigned int> &target_component, - std::vector<std::vector<unsigned int> > &ndofs) + std::vector<std::vector<types::global_dof_index> > &ndofs) { Assert (component_mask.represents_n_components(target_component.size()), ExcMessage ("The component mask does not have the correct size.")); @@ -191,9 +195,9 @@ namespace if (ndofs.size() == 0) { - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > new_dofs(mg_dof.get_tria().n_levels(), - std::vector<unsigned int>(target_component.size())); + std::vector<types::global_dof_index>(target_component.size())); std::swap(ndofs, new_dofs); MGTools::count_dofs_per_block (mg_dof, ndofs, target_component); @@ -241,7 +245,7 @@ MGTransferSelect<number>::do_copy_to_mg ( { --level; - typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT; + typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT; for (IT i=copy_to_and_from_indices[level].begin(); i != copy_to_and_from_indices[level].end(); ++i) dst[level](i->second) = src(i->first); @@ -334,10 +338,10 @@ void MGTransferComponentBase::build_matrices ( // Compute start indices from sizes for (unsigned int l=0; l<mg_component_start.size(); ++l) { - unsigned int k=0; + types::global_dof_index k=0; for (unsigned int i=0; i<mg_component_start[l].size(); ++i) { - const unsigned int t=mg_component_start[l][i]; + const types::global_dof_index t=mg_component_start[l][i]; mg_component_start[l][i] = k; k += t; } @@ -348,10 +352,10 @@ void MGTransferComponentBase::build_matrices ( DoFTools:: count_dofs_per_block (mg_dof, component_start, target_component); - unsigned int k=0; + types::global_dof_index k=0; for (unsigned int i=0; i<component_start.size(); ++i) { - const unsigned int t=component_start[i]; + const types::global_dof_index t=component_start[i]; component_start[i] = k; k += t; } @@ -391,8 +395,8 @@ void MGTransferComponentBase::build_matrices ( // two fields which will store the // indices of the multigrid dofs // for a cell and one of its children - std::vector<unsigned int> dof_indices_parent (dofs_per_cell); - std::vector<unsigned int> dof_indices_child (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_parent (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_child (dofs_per_cell); // for each level: first build the // sparsity pattern of the matrices @@ -503,9 +507,9 @@ void MGTransferComponentBase::build_matrices ( if (boundary_indices.size() != 0) { - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > dofs_per_component(mg_dof.get_tria().n_levels(), - std::vector<unsigned int>(n_components)); + std::vector<types::global_dof_index>(n_components)); MGTools::count_dofs_per_block (mg_dof, dofs_per_component, mg_target_component); for (unsigned int level=0; level<n_levels-1; ++level) @@ -517,20 +521,20 @@ void MGTransferComponentBase::build_matrices ( for (unsigned int jblock=0; jblock<n_components; ++jblock) if (iblock==jblock) { - const unsigned int n_dofs = prolongation_matrices[level]->block(iblock,jblock).m(); - for (unsigned int i=0; i<n_dofs; ++i) + const types::global_dof_index n_dofs = prolongation_matrices[level]->block(iblock,jblock).m(); + for (types::global_dof_index i=0; i<n_dofs; ++i) { SparseMatrix<double>::iterator anfang = prolongation_matrices[level]->block(iblock,jblock).begin(i), ende = prolongation_matrices[level]->block(iblock,jblock).end(i); for (; anfang != ende; ++anfang) { - const unsigned int column_number = anfang->column(); + const types::global_dof_index column_number = anfang->column(); //convert global indices into local ones const BlockIndices block_indices_coarse (dofs_per_component[level]); - const unsigned int global_j = block_indices_coarse.local_to_global(iblock, column_number); + const types::global_dof_index global_j = block_indices_coarse.local_to_global(iblock, column_number); - std::set<unsigned int>::const_iterator found_dof = + std::set<types::global_dof_index>::const_iterator found_dof = boundary_indices[level].find(global_j); const bool is_boundary_index = @@ -558,7 +562,7 @@ void MGTransferSelect<number>::build_matrices ( unsigned int mg_select, const std::vector<unsigned int> &t_component, const std::vector<unsigned int> &mg_t_component, - const std::vector<std::set<unsigned int> > &bdry_indices) + const std::vector<std::set<types::global_dof_index> > &bdry_indices) { const FiniteElement<dim> &fe = mg_dof.get_fe(); unsigned int ncomp = mg_dof.get_fe().n_components(); @@ -617,9 +621,9 @@ void MGTransferSelect<number>::build_matrices ( // use a temporary vector to create the // relation between global and level dofs - std::vector<unsigned int> temp_copy_indices; - std::vector<unsigned int> global_dof_indices (fe.dofs_per_cell); - std::vector<unsigned int> level_dof_indices (fe.dofs_per_cell); + std::vector<types::global_dof_index> temp_copy_indices; + std::vector<types::global_dof_index> global_dof_indices (fe.dofs_per_cell); + std::vector<types::global_dof_index> level_dof_indices (fe.dofs_per_cell); for (int level=dof.get_tria().n_levels()-1; level>=0; --level) { copy_to_and_from_indices[level].clear(); @@ -629,7 +633,7 @@ void MGTransferSelect<number>::build_matrices ( level_end = mg_dof.end_active(level); temp_copy_indices.resize (0); - temp_copy_indices.resize (mg_dof.n_dofs(level), numbers::invalid_unsigned_int); + temp_copy_indices.resize (mg_dof.n_dofs(level), numbers::invalid_dof_index); // Compute coarse level right hand side // by restricting from fine level. @@ -649,9 +653,9 @@ void MGTransferSelect<number>::build_matrices ( if (component_mask[component] && !interface_dofs[level][level_dof_indices[i]]) { - const unsigned int level_start + const types::global_dof_index level_start = mg_component_start[level][mg_target_component[component]]; - const unsigned int global_start + const types::global_dof_index global_start = component_start[target_component[component]]; temp_copy_indices[level_dof_indices[i]-level_start] = global_dof_indices[i] - global_start; @@ -661,16 +665,16 @@ void MGTransferSelect<number>::build_matrices ( // write indices from vector into the map from // global to level dofs - const unsigned int n_active_dofs = + const types::global_dof_index n_active_dofs = std::count_if (temp_copy_indices.begin(), temp_copy_indices.end(), - std::bind2nd(std::not_equal_to<unsigned int>(), - numbers::invalid_unsigned_int)); + std::bind2nd(std::not_equal_to<types::global_dof_index>(), + numbers::invalid_dof_index)); copy_to_and_from_indices[level].resize (n_active_dofs); - unsigned int counter = 0; - for (unsigned int i=0; i<temp_copy_indices.size(); ++i) - if (temp_copy_indices[i] != numbers::invalid_unsigned_int) + types::global_dof_index counter = 0; + for (types::global_dof_index i=0; i<temp_copy_indices.size(); ++i) + if (temp_copy_indices[i] != numbers::invalid_dof_index) copy_to_and_from_indices[level][counter++] = - std::pair<unsigned int, unsigned int> (temp_copy_indices[i], i); + std::pair<types::global_dof_index, unsigned int> (temp_copy_indices[i], i); Assert (counter == n_active_dofs, ExcInternalError()); } } diff --git a/deal.II/source/multigrid/mg_transfer_component.inst.in b/deal.II/source/multigrid/mg_transfer_component.inst.in index bd9ad33004..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) @@ -21,7 +25,7 @@ void MGTransferSelect<float>::build_matrices<deal_II_dimension> unsigned int, unsigned int, const std::vector<unsigned int>&, const std::vector<unsigned int>&, - const std::vector<std::set<unsigned int> >&); + const std::vector<std::set<types::global_dof_index> >&); template void MGTransferSelect<double>::build_matrices<deal_II_dimension> @@ -30,7 +34,7 @@ void MGTransferSelect<double>::build_matrices<deal_II_dimension> unsigned int, unsigned int, const std::vector<unsigned int>&, const std::vector<unsigned int>&, - const std::vector<std::set<unsigned int> >&); + const std::vector<std::set<types::global_dof_index> >&); template void MGTransferSelect<float>::copy_to_mg ( diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/source/multigrid/mg_transfer_prebuilt.cc index 4415dc60fd..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 <deal.II/base/logstream.h> #include <deal.II/base/function.h> @@ -34,6 +39,8 @@ #include <deal.II/multigrid/mg_transfer.h> #include <deal.II/multigrid/mg_transfer.templates.h> +#include <algorithm> + DEAL_II_NAMESPACE_OPEN @@ -85,7 +92,7 @@ template <int dim, int spacedim> void MGTransferPrebuilt<VECTOR>::build_matrices ( const DoFHandler<dim,spacedim> &mg_dof) { - const unsigned int n_levels = mg_dof.get_tria().n_levels(); + const unsigned int n_levels = mg_dof.get_tria().n_global_levels(); const unsigned int dofs_per_cell = mg_dof.get_fe().dofs_per_cell; sizes.resize(n_levels); @@ -116,8 +123,8 @@ void MGTransferPrebuilt<VECTOR>::build_matrices ( // two fields which will store the // indices of the multigrid dofs // for a cell and one of its children - std::vector<unsigned int> dof_indices_parent (dofs_per_cell); - std::vector<unsigned int> dof_indices_child (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_parent (dofs_per_cell); + std::vector<types::global_dof_index> dof_indices_child (dofs_per_cell); // for each level: first build the sparsity // pattern of the matrices and then build the @@ -139,13 +146,13 @@ void MGTransferPrebuilt<VECTOR>::build_matrices ( // element will be stored CompressedSimpleSparsityPattern csp (sizes[level+1], sizes[level]); - std::vector<unsigned int> entries (dofs_per_cell); + std::vector<types::global_dof_index> entries (dofs_per_cell); for (typename DoFHandler<dim,spacedim>::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->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain() + )) { cell->get_mg_dof_indices (dof_indices_parent); @@ -178,21 +185,23 @@ void MGTransferPrebuilt<VECTOR>::build_matrices ( } } } - + internal::MatrixSelector<VECTOR>::reinit(*prolongation_matrices[level], - *prolongation_sparsities[level], - level, - csp, - mg_dof); + *prolongation_sparsities[level], + level, + csp, + mg_dof); csp.reinit(0,0); + FullMatrix<double> prolongation; + // now actually build the matrices for (typename DoFHandler<dim,spacedim>::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); @@ -203,10 +212,16 @@ void MGTransferPrebuilt<VECTOR>::build_matrices ( // set an alias to the // prolongation matrix for // this child - const FullMatrix<double> &prolongation + 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; j<dofs_per_cell; ++j) + if (mg_constrained_dofs->is_boundary_index(level, dof_indices_parent[j])) + for (unsigned int i=0; i<dofs_per_cell; ++i) + prolongation(i,j) = 0.; + cell->child(child)->get_mg_dof_indices (dof_indices_child); // now set the entries in the @@ -219,128 +234,102 @@ void MGTransferPrebuilt<VECTOR>::build_matrices ( true); } } + prolongation_matrices[level]->compress(VectorOperation::insert); } - - // impose boundary conditions - // but only in the column of - // the prolongation matrix - if (mg_constrained_dofs != 0) - if (mg_constrained_dofs->set_boundary_values()) - { - std::vector<unsigned int> constrain_indices; - for (int level=n_levels-2; level>=0; --level) - { - if (mg_constrained_dofs->get_boundary_indices()[level].size() == 0) - continue; - - // need to delete all the columns in the - // matrix that are on the boundary. to achieve - // this, create an array as long as there are - // matrix columns, and find which columns we - // need to filter away. - constrain_indices.resize (0); - constrain_indices.resize (prolongation_matrices[level]->n(), 0); - std::set<unsigned int>::const_iterator dof - = mg_constrained_dofs->get_boundary_indices()[level].begin(), - endd = mg_constrained_dofs->get_boundary_indices()[level].end(); - for (; dof != endd; ++dof) - constrain_indices[*dof] = 1; - - const unsigned int n_dofs = prolongation_matrices[level]->m(); - for (unsigned int i=0; i<n_dofs; ++i) - { - typename internal::MatrixSelector<VECTOR>::Matrix::iterator - start_row = prolongation_matrices[level]->begin(i), - end_row = prolongation_matrices[level]->end(i); - for (; start_row != end_row; ++start_row) - { - if (constrain_indices[start_row->column()] == 1) - start_row->value() = 0; - } - } - } - } - - // to find the indices that describe the - // relation between global dofs and local - // numbering on the individual level, first - // create a temp vector where the ith level - // entry contains the respective global - // entry. this gives a neat way to find those - // indices. in a second step, actually build - // the std::vector<std::pair<uint,uint> > that - // only contains the active dofs on the - // levels. + // Now we are filling the variables copy_indices*, which are essentially + // maps from global to mgdof for each level stored as a std::vector of + // pairs. We need to split this map on each level depending on the ownership + // 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 + // the multigrid running in serial. + // Only entering on the finest level gives wrong results (why?) copy_indices.resize(n_levels); - std::vector<unsigned int> temp_copy_indices; - std::vector<unsigned int> global_dof_indices (dofs_per_cell); - std::vector<unsigned int> level_dof_indices (dofs_per_cell); - for (int level=mg_dof.get_tria().n_levels()-1; level>=0; --level) + copy_indices_from_me.resize(n_levels); + copy_indices_to_me.resize(n_levels); + IndexSet globally_relevant; + DoFTools::extract_locally_relevant_dofs(mg_dof, globally_relevant); + + std::vector<types::global_dof_index> global_dof_indices (dofs_per_cell); + std::vector<types::global_dof_index> level_dof_indices (dofs_per_cell); + // for (int level=mg_dof.get_tria().n_levels()-1; level>=0; --level) + for (unsigned int level=0; level<mg_dof.get_tria().n_levels(); ++level) { + std::vector<bool> dof_touched(globally_relevant.n_elements(), false); copy_indices[level].clear(); + copy_indices_from_me[level].clear(); + copy_indices_to_me[level].clear(); + typename DoFHandler<dim,spacedim>::active_cell_iterator level_cell = mg_dof.begin_active(level); const typename DoFHandler<dim,spacedim>::active_cell_iterator level_end = mg_dof.end_active(level); - temp_copy_indices.resize (0); - temp_copy_indices.resize (mg_dof.n_dofs(level), numbers::invalid_unsigned_int); - - // Compute coarse level right hand side - // by restricting from fine level. for (; level_cell!=level_end; ++level_cell) { if (mg_dof.get_tria().locally_owned_subdomain()!=numbers::invalid_subdomain_id - && level_cell->level_subdomain_id()!=mg_dof.get_tria().locally_owned_subdomain()) + && (level_cell->level_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 + // get the dof numbers of this cell for the global and the level-wise // numbering - level_cell->get_dof_indices(global_dof_indices); + level_cell->get_dof_indices (global_dof_indices); level_cell->get_mg_dof_indices (level_dof_indices); for (unsigned int i=0; i<dofs_per_cell; ++i) { - if (mg_constrained_dofs != 0) - { - if (!mg_constrained_dofs->at_refinement_edge(level,level_dof_indices[i])) - temp_copy_indices[level_dof_indices[i]] = global_dof_indices[i]; - } + // we need to ignore if the DoF is on a refinement edge (hanging node) + if (mg_constrained_dofs != 0 + && mg_constrained_dofs->at_refinement_edge(level, level_dof_indices[i])) + continue; + unsigned int global_idx = globally_relevant.index_within_set(global_dof_indices[i]); + //skip if we did this global dof already (on this or a coarser level) + if (dof_touched[global_idx]) + continue; + bool global_mine = mg_dof.locally_owned_dofs().is_element(global_dof_indices[i]); + bool level_mine = mg_dof.locally_owned_mg_dofs(level).is_element(level_dof_indices[i]); + + if (global_mine && level_mine) + copy_indices[level].push_back( + std::pair<unsigned int, unsigned int> (global_dof_indices[i], level_dof_indices[i])); + else if (level_mine) + copy_indices_from_me[level].push_back( + std::pair<unsigned int, unsigned int> (global_dof_indices[i], level_dof_indices[i])); + else if (global_mine) + copy_indices_to_me[level].push_back( + std::pair<unsigned int, unsigned int> (global_dof_indices[i], level_dof_indices[i])); else - temp_copy_indices[level_dof_indices[i]] = global_dof_indices[i]; + continue; + + dof_touched[global_idx] = true; } } - - // now all the active dofs got a valid entry, - // the other ones have an invalid entry. Count - // the invalid entries and then resize the - // copy_indices object. Then, insert the pairs - // of global index and level index into - // copy_indices. - const unsigned int n_active_dofs = - std::count_if (temp_copy_indices.begin(), temp_copy_indices.end(), - std::bind2nd(std::not_equal_to<unsigned int>(), - numbers::invalid_unsigned_int)); - copy_indices[level].resize (n_active_dofs); - unsigned int counter = 0; - for (unsigned int i=0; i<temp_copy_indices.size(); ++i) - if (temp_copy_indices[i] != numbers::invalid_unsigned_int) - copy_indices[level][counter++] = - std::pair<unsigned int, unsigned int> (temp_copy_indices[i], i); - Assert (counter == n_active_dofs, ExcInternalError()); } + + // If we are in debugging mode, we order the copy indices, so we get + // more reliable output for regression texts +#ifdef DEBUG + std::less<std::pair<types::global_dof_index, unsigned int> > compare; + for (unsigned int level=0; level<copy_indices.size(); ++level) + std::sort(copy_indices[level].begin(), copy_indices[level].end(), compare); + for (unsigned int level=0; level<copy_indices_from_me.size(); ++level) + std::sort(copy_indices_from_me[level].begin(), copy_indices_from_me[level].end(), compare); + for (unsigned int level=0; level<copy_indices_to_me.size(); ++level) + std::sort(copy_indices_to_me[level].begin(), copy_indices_to_me[level].end(), compare); +#endif } template <class VECTOR> void -MGTransferPrebuilt<VECTOR>::print_matrices (std::ostream& os) const +MGTransferPrebuilt<VECTOR>::print_matrices (std::ostream &os) const { - for (unsigned int level = 0;level<prolongation_matrices.size();++level) + for (unsigned int level = 0; level<prolongation_matrices.size(); ++level) { os << "Level " << level << std::endl; prolongation_matrices[level]->print(os); @@ -348,6 +337,31 @@ MGTransferPrebuilt<VECTOR>::print_matrices (std::ostream& os) const } } +template <class VECTOR> +void +MGTransferPrebuilt<VECTOR>::print_indices (std::ostream &os) const +{ + for (unsigned int level = 0; level<copy_indices.size(); ++level) + { + for (unsigned int i=0; i<copy_indices[level].size(); ++i) + os << "copy_indices[" << level + << "]\t" << copy_indices[level][i].first << '\t' << copy_indices[level][i].second << std::endl; + } + + for (unsigned int level = 0; level<copy_indices_from_me.size(); ++level) + { + for (unsigned int i=0; i<copy_indices_from_me[level].size(); ++i) + os << "copy_ifrom [" << level + << "]\t" << copy_indices_from_me[level][i].first << '\t' << copy_indices_from_me[level][i].second << std::endl; + } + for (unsigned int level = 0; level<copy_indices_to_me.size(); ++level) + { + for (unsigned int i=0; i<copy_indices_to_me[level].size(); ++i) + os << "copy_ito [" << level + << "]\t" << copy_indices_to_me[level][i].first << '\t' << copy_indices_to_me[level][i].second << std::endl; + } +} + // explicit instantiation #include "mg_transfer_prebuilt.inst" diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.inst.in b/deal.II/source/multigrid/mg_transfer_prebuilt.inst.in index 47e315f225..c72b279ae0 100644 --- a/deal.II/source/multigrid/mg_transfer_prebuilt.inst.in +++ b/deal.II/source/multigrid/mg_transfer_prebuilt.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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 (V1 : VECTORS_WITH_MATRIX) diff --git a/deal.II/source/multigrid/multigrid.cc b/deal.II/source/multigrid/multigrid.cc index b5555d7f88..2001252900 100644 --- a/deal.II/source/multigrid/multigrid.cc +++ b/deal.II/source/multigrid/multigrid.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- #include <deal.II/lac/vector.h> 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..855e2c6777 100644 --- a/deal.II/source/numerics/CMakeLists.txt +++ b/deal.II/source/numerics/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> -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/deal.II/source/numerics/data_out.cc b/deal.II/source/numerics/data_out.cc index a1172305ea..51d7a560bc 100644 --- a/deal.II/source/numerics/data_out.cc +++ b/deal.II/source/numerics/data_out.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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/work_stream.h> diff --git a/deal.II/source/numerics/data_out.inst.in b/deal.II/source/numerics/data_out.inst.in index b084eabe27..55fc701433 100644 --- a/deal.II/source/numerics/data_out.inst.in +++ b/deal.II/source/numerics/data_out.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; DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/data_out_faces.cc b/deal.II/source/numerics/data_out_faces.cc index ec0cf5e1dc..9d282370ae 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/work_stream.h> 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..a78854ada6 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/work_stream.h> 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 <deal.II/numerics/data_out_stack.h> #include <deal.II/base/quadrature_lib.h> 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/numerics/data_postprocessor.h> 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 <deal.II/base/quadrature_lib.h> #include <deal.II/base/thread_management.h> 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 <deal.II/base/parameter_handler.h> #include <deal.II/base/logstream.h> 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..46771ecc59 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 <deal.II/base/thread_management.h> #include <deal.II/base/quadrature.h> @@ -471,7 +473,7 @@ namespace internal { fe_face_values_neighbor.get_present_fe_values() .get_function_gradients (*solutions[n], - parallel_data.neighbor_psi[n]); + parallel_data.neighbor_psi[n]); // compute the jump in the gradients for (unsigned int component=0; component<n_components; ++component) @@ -1325,7 +1327,7 @@ estimate (const Mapping<1,spacedim> &mapping, for (unsigned int s=0; s<n_solution_vectors; ++s) fe_values.get_present_fe_values() .get_function_gradients (*solutions[s], - gradients_neighbor[s]); + gradients_neighbor[s]); // extract the // gradients of all the diff --git a/deal.II/source/numerics/error_estimator.inst.in b/deal.II/source/numerics/error_estimator.inst.in index 7b701a6992..34b06e672b 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) { 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 <deal.II/numerics/fe_field_function.templates.h> #include <deal.II/multigrid/mg_dof_handler.h> 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..c1c89e903a 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 <deal.II/base/memory_consumption.h> #include <deal.II/lac/vector.h> diff --git a/deal.II/source/numerics/matrix_tools.cc b/deal.II/source/numerics/matrix_tools.cc index 77fa2af43d..32119a2330 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 <deal.II/base/function.h> #include <deal.II/base/quadrature.h> @@ -195,8 +197,6 @@ namespace MatrixCreator std::vector<double> rhs_values; std::vector<dealii::Vector<double> > rhs_vector_values; - std::vector<double> old_JxW; - const Function<spacedim> *coefficient; const Function<spacedim> *rhs_function; @@ -206,7 +206,7 @@ namespace MatrixCreator struct CopyData { - std::vector<unsigned int> dof_indices; + std::vector<types::global_dof_index> dof_indices; FullMatrix<double> cell_matrix; dealii::Vector<double> cell_rhs; const ConstraintMatrix *constraints; @@ -840,7 +840,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const coefficient, const std::vector<unsigned int> &component_mapping, const MatrixCreator::internal::IteratorRange<DoFHandler<dim,spacedim> > range, @@ -885,8 +885,8 @@ namespace MatrixCreator std::vector<Vector<double> > rhs_values_system (fe_values.n_quadrature_points, Vector<double>(n_function_components)); - std::vector<unsigned int> dofs (dofs_per_cell); - std::vector<unsigned int> dofs_on_face_vector (dofs_per_face); + std::vector<types::global_dof_index> dofs (dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_face_vector (dofs_per_face); // for each dof on the cell, have a // flag whether it is on the face @@ -1082,10 +1082,10 @@ namespace MatrixCreator Threads::Mutex::ScopedLock lock (mutex); for (unsigned int i=0; i<dofs_per_cell; ++i) { - if (dof_is_on_face[i] && dof_to_boundary_mapping[dofs[i]] != numbers::invalid_unsigned_int) + if (dof_is_on_face[i] && dof_to_boundary_mapping[dofs[i]] != numbers::invalid_dof_index) { for (unsigned int j=0; j<dofs_per_cell; ++j) - if (dof_is_on_face[j] && dof_to_boundary_mapping[dofs[j]] != numbers::invalid_unsigned_int) + if (dof_is_on_face[j] && dof_to_boundary_mapping[dofs[j]] != numbers::invalid_dof_index) { Assert(numbers::is_finite(cell_matrix(i,j)), ExcNumberNotFinite()); matrix.add(dof_to_boundary_mapping[dofs[i]], @@ -1108,7 +1108,7 @@ namespace MatrixCreator SparseMatrix<double> &, const FunctionMap<3>::type &, Vector<double> &, - std::vector<unsigned int> &, + std::vector<types::global_dof_index> &, const Function<3> *const , const std::vector<unsigned int> &, const MatrixCreator::internal::IteratorRange<DoFHandler<2,3> > , @@ -1127,7 +1127,7 @@ namespace MatrixCreator SparseMatrix<double> &, const FunctionMap<3>::type &, Vector<double> &, - std::vector<unsigned int> &, + std::vector<types::global_dof_index> &, const Function<3> *const , const std::vector<unsigned int> &, const MatrixCreator::internal::IteratorRange<DoFHandler<1,3> > , @@ -1148,7 +1148,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const coefficient, std::vector<unsigned int> component_mapping) { @@ -1208,7 +1208,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const coefficient, const std::vector<unsigned int> &component_mapping, const MatrixCreator::internal::IteratorRange<DoFHandler<dim,spacedim> > range, @@ -1240,7 +1240,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const coefficient, const std::vector<unsigned int> &component_mapping, const MatrixCreator::internal::IteratorRange<hp::DoFHandler<dim,spacedim> > range, @@ -1256,8 +1256,8 @@ namespace MatrixCreator #ifdef DEBUG if (true) { - unsigned int max_element = 0; - for (std::vector<unsigned int>::const_iterator i=dof_to_boundary_mapping.begin(); + types::global_dof_index max_element = static_cast<types::global_dof_index>(0); + for (std::vector<types::global_dof_index>::const_iterator i=dof_to_boundary_mapping.begin(); i!=dof_to_boundary_mapping.end(); ++i) if ((*i != hp::DoFHandler<dim,spacedim>::invalid_dof_index) && (*i > max_element)) @@ -1276,7 +1276,7 @@ namespace MatrixCreator UpdateFlags update_flags = UpdateFlags (update_values | update_JxW_values | update_quadrature_points); - hp::FEFaceValues<dim> x_fe_values (mapping, fe_collection, q, update_flags); + hp::FEFaceValues<dim,spacedim> x_fe_values (mapping, fe_collection, q, update_flags); // two variables for the coefficient, // one for the two cases indicated in @@ -1287,8 +1287,8 @@ namespace MatrixCreator std::vector<double> rhs_values_scalar; std::vector<Vector<double> > rhs_values_system; - std::vector<unsigned int> dofs (max_dofs_per_cell); - std::vector<unsigned int> dofs_on_face_vector (max_dofs_per_face); + std::vector<types::global_dof_index> dofs (max_dofs_per_cell); + std::vector<types::global_dof_index> dofs_on_face_vector (max_dofs_per_face); // for each dof on the cell, have a // flag whether it is on the face @@ -1606,7 +1606,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &rhs, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const a, std::vector<unsigned int> component_mapping) { @@ -1624,7 +1624,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const coefficient, std::vector<unsigned int> component_mapping) { @@ -1684,7 +1684,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &boundary_functions, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const coefficient, const std::vector<unsigned int> &component_mapping, const MatrixCreator::internal::IteratorRange<hp::DoFHandler<dim,spacedim> > range, @@ -1711,7 +1711,7 @@ namespace MatrixCreator SparseMatrix<double> &matrix, const typename FunctionMap<spacedim>::type &rhs, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<spacedim> *const a, std::vector<unsigned int> component_mapping) { @@ -1973,7 +1973,7 @@ namespace MatrixTools //TODO:[WB] I don't think that the optimized storage of diagonals is needed (GK) template <typename number> void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, SparseMatrix<number> &matrix, Vector<number> &solution, Vector<number> &right_hand_side, @@ -1992,7 +1992,7 @@ namespace MatrixTools return; - const unsigned int n_dofs = matrix.m(); + const types::global_dof_index n_dofs = matrix.m(); // if a diagonal entry is zero // later, then we use another @@ -2009,13 +2009,13 @@ namespace MatrixTools } - std::map<unsigned int,double>::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); + std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(), + endd = boundary_values.end(); for (; dof != endd; ++dof) { Assert (dof->first < n_dofs, ExcInternalError()); - const unsigned int dof_number = dof->first; + const types::global_dof_index dof_number = dof->first; // for each boundary dof: // set entries of this line to zero except for the diagonal @@ -2080,7 +2080,7 @@ namespace MatrixTools q = matrix.begin(dof_number)+1; q != matrix.end(dof_number); ++q) { - const unsigned int row = q->column(); + const types::global_dof_index row = q->column(); // find the position of // element @@ -2127,7 +2127,7 @@ namespace MatrixTools template <typename number> void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, BlockSparseMatrix<number> &matrix, BlockVector<number> &solution, BlockVector<number> &right_hand_side, @@ -2157,7 +2157,7 @@ namespace MatrixTools return; - const unsigned int n_dofs = matrix.m(); + const types::global_dof_index n_dofs = matrix.m(); // if a diagonal entry is zero // later, then we use another @@ -2187,8 +2187,8 @@ namespace MatrixTools first_nonzero_diagonal_entry = 1; - std::map<unsigned int,double>::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); + std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(), + endd = boundary_values.end(); const BlockSparsityPattern & sparsity_pattern = matrix.get_sparsity_pattern(); @@ -2208,8 +2208,8 @@ namespace MatrixTools // get global index and index // in the block in which this // dof is located - const unsigned int dof_number = dof->first; - const std::pair<unsigned int,unsigned int> + const types::global_dof_index dof_number = dof->first; + const std::pair<unsigned int,types::global_dof_index> block_index = index_mapping.global_to_local (dof_number); // for each boundary dof: @@ -2322,7 +2322,7 @@ namespace MatrixTools // get the number of the column in this row in which a // nonzero entry is. this is also the row of the transpose // block which has an entry in the interesting row - const unsigned int row = q->column(); + const types::global_dof_index row = q->column(); // find the position of element (row,dof_number) in this // block (not in the transpose one). note that we have to @@ -2391,7 +2391,7 @@ namespace MatrixTools { template <typename PETScMatrix, typename PETScVector> void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, PETScMatrix &matrix, PETScVector &solution, PETScVector &right_hand_side, @@ -2409,7 +2409,7 @@ namespace MatrixTools if (boundary_values.size() == 0) return; - const std::pair<unsigned int, unsigned int> local_range + const std::pair<types::global_dof_index, types::global_dof_index> local_range = matrix.local_range(); Assert (local_range == right_hand_side.local_range(), ExcInternalError()); @@ -2421,7 +2421,7 @@ namespace MatrixTools // matrix that we can see. if we can't // find such an entry, take one PetscScalar average_nonzero_diagonal_entry = 1; - for (unsigned int i=local_range.first; i<local_range.second; ++i) + for (types::global_dof_index i=local_range.first; i<local_range.second; ++i) if (matrix.diag_element(i) != 0) { average_nonzero_diagonal_entry = std::fabs(matrix.diag_element(i)); @@ -2430,8 +2430,8 @@ namespace MatrixTools // figure out which rows of the matrix we // have to eliminate on this processor - std::vector<unsigned int> constrained_rows; - for (std::map<unsigned int,double>::const_iterator + std::vector<types::global_dof_index> constrained_rows; + for (std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2452,9 +2452,9 @@ namespace MatrixTools // treated in the other functions. matrix.clear_rows (constrained_rows, average_nonzero_diagonal_entry); - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; std::vector<PetscScalar> solution_values; - for (std::map<unsigned int,double>::const_iterator + for (std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2484,7 +2484,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, PETScWrappers::SparseMatrix &matrix, PETScWrappers::Vector &solution, PETScWrappers::Vector &right_hand_side, @@ -2499,7 +2499,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, PETScWrappers::MPI::SparseMatrix &matrix, PETScWrappers::MPI::Vector &solution, PETScWrappers::MPI::Vector &right_hand_side, @@ -2516,8 +2516,8 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, - PETScWrappers::MPI::BlockSparseMatrix &matrix, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, + PETScWrappers::MPI::BlockSparseMatrix &matrix, PETScWrappers::MPI::BlockVector &solution, PETScWrappers::MPI::BlockVector &right_hand_side, const bool eliminate_columns) @@ -2537,10 +2537,11 @@ namespace MatrixTools // into blocks for the boundary values. // To this end, generate a vector of // maps with the respective indices. - std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks); + std::vector<std::map<dealii::types::global_dof_index,double> > block_boundary_values(n_blocks); { - int offset = 0, block=0; - for (std::map<unsigned int,double>::const_iterator + int block = 0; + dealii::types::global_dof_index offset = 0; + for (std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2550,8 +2551,8 @@ namespace MatrixTools offset += matrix.block(block,0).m(); block++; } - const unsigned int index = dof->first - offset; - block_boundary_values[block].insert(std::pair<unsigned int, double> (index,dof->second)); + const types::global_dof_index index = dof->first - offset; + block_boundary_values[block].insert(std::pair<types::global_dof_index, double> (index,dof->second)); } } @@ -2571,11 +2572,11 @@ namespace MatrixTools // the whole row. for (unsigned int block_m=0; block_m<n_blocks; ++block_m) { - const std::pair<unsigned int, unsigned int> local_range + const std::pair<types::global_dof_index, types::global_dof_index> local_range = matrix.block(block_m,0).local_range(); - std::vector<unsigned int> constrained_rows; - for (std::map<unsigned int,double>::const_iterator + std::vector<types::global_dof_index> constrained_rows; + for (std::map<types::global_dof_index,double>::const_iterator dof = block_boundary_values[block_m].begin(); dof != block_boundary_values[block_m].end(); ++dof) @@ -2601,7 +2602,7 @@ namespace MatrixTools { template <typename TrilinosMatrix, typename TrilinosVector> void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosMatrix &matrix, TrilinosVector &solution, TrilinosVector &right_hand_side, @@ -2619,7 +2620,7 @@ namespace MatrixTools if (boundary_values.size() == 0) return; - const std::pair<unsigned int, unsigned int> local_range + const std::pair<types::global_dof_index, types::global_dof_index> local_range = matrix.local_range(); Assert (local_range == right_hand_side.local_range(), ExcInternalError()); @@ -2637,7 +2638,7 @@ namespace MatrixTools // matrix that we can see. if we can't // find such an entry, take one TrilinosScalar average_nonzero_diagonal_entry = 1; - for (unsigned int i=local_range.first; i<local_range.second; ++i) + for (types::global_dof_index i=local_range.first; i<local_range.second; ++i) if (matrix.diag_element(i) != 0) { average_nonzero_diagonal_entry = std::fabs(matrix.diag_element(i)); @@ -2646,8 +2647,8 @@ namespace MatrixTools // figure out which rows of the matrix we // have to eliminate on this processor - std::vector<unsigned int> constrained_rows; - for (std::map<unsigned int,double>::const_iterator + std::vector<types::global_dof_index> constrained_rows; + for (std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2664,9 +2665,9 @@ namespace MatrixTools // matrix classes in deal.II. matrix.clear_rows (constrained_rows, average_nonzero_diagonal_entry); - std::vector<unsigned int> indices; + std::vector<types::global_dof_index> indices; std::vector<TrilinosScalar> solution_values; - for (std::map<unsigned int,double>::const_iterator + for (std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2695,7 +2696,7 @@ namespace MatrixTools template <typename TrilinosMatrix, typename TrilinosBlockVector> void - apply_block_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_block_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosMatrix &matrix, TrilinosBlockVector &solution, TrilinosBlockVector &right_hand_side, @@ -2718,10 +2719,11 @@ namespace MatrixTools // into blocks for the boundary values. // To this end, generate a vector of // maps with the respective indices. - std::vector<std::map<unsigned int,double> > block_boundary_values(n_blocks); + std::vector<std::map<types::global_dof_index,double> > block_boundary_values(n_blocks); { - int offset = 0, block=0; - for (std::map<unsigned int,double>::const_iterator + int block=0; + types::global_dof_index offset = 0; + for (std::map<types::global_dof_index,double>::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2731,9 +2733,9 @@ namespace MatrixTools offset += matrix.block(block,0).m(); block++; } - const unsigned int index = dof->first - offset; + const types::global_dof_index index = dof->first - offset; block_boundary_values[block].insert( - std::pair<unsigned int, double> (index,dof->second)); + std::pair<types::global_dof_index, double> (index,dof->second)); } } @@ -2753,11 +2755,11 @@ namespace MatrixTools // the whole row. for (unsigned int block_m=0; block_m<n_blocks; ++block_m) { - const std::pair<unsigned int, unsigned int> local_range + const std::pair<types::global_dof_index, types::global_dof_index> local_range = matrix.block(block_m,0).local_range(); - std::vector<unsigned int> constrained_rows; - for (std::map<unsigned int,double>::const_iterator + std::vector<types::global_dof_index> constrained_rows; + for (std::map<types::global_dof_index,double>::const_iterator dof = block_boundary_values[block_m].begin(); dof != block_boundary_values[block_m].end(); ++dof) @@ -2777,7 +2779,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::Vector &solution, TrilinosWrappers::Vector &right_hand_side, @@ -2792,7 +2794,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::MPI::Vector &solution, TrilinosWrappers::MPI::Vector &right_hand_side, @@ -2807,8 +2809,8 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, - TrilinosWrappers::BlockSparseMatrix &matrix, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, + TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::BlockVector &solution, TrilinosWrappers::BlockVector &right_hand_side, const bool eliminate_columns) @@ -2821,8 +2823,8 @@ namespace MatrixTools void - apply_boundary_values (const std::map<unsigned int,double> &boundary_values, - TrilinosWrappers::BlockSparseMatrix &matrix, + apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, + TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::MPI::BlockVector &solution, TrilinosWrappers::MPI::BlockVector &right_hand_side, const bool eliminate_columns) @@ -2837,8 +2839,8 @@ namespace MatrixTools void - local_apply_boundary_values (const std::map<unsigned int,double> &boundary_values, - const std::vector<unsigned int> &local_dof_indices, + local_apply_boundary_values (const std::map<types::global_dof_index,double> &boundary_values, + const std::vector<types::global_dof_index> &local_dof_indices, FullMatrix<double> &local_matrix, Vector<double> &local_rhs, const bool eliminate_columns) @@ -2885,7 +2887,7 @@ namespace MatrixTools const unsigned int n_local_dofs = local_dof_indices.size(); for (unsigned int i=0; i<n_local_dofs; ++i) { - const std::map<unsigned int, double>::const_iterator + const std::map<types::global_dof_index, double>::const_iterator boundary_value = boundary_values.find (local_dof_indices[i]); if (boundary_value != boundary_values.end()) { @@ -2959,14 +2961,14 @@ namespace MatrixTools { template void - apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values<double> (const std::map<types::global_dof_index,double> &boundary_values, SparseMatrix<double> &matrix, Vector<double> &solution, Vector<double> &right_hand_side, const bool eliminate_columns); template void - apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values<float> (const std::map<types::global_dof_index,double> &boundary_values, SparseMatrix<float> &matrix, Vector<float> &solution, Vector<float> &right_hand_side, @@ -2974,14 +2976,14 @@ namespace MatrixTools template void - apply_boundary_values<double> (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values<double> (const std::map<types::global_dof_index,double> &boundary_values, BlockSparseMatrix<double> &matrix, BlockVector<double> &solution, BlockVector<double> &right_hand_side, const bool eliminate_columns); template void - apply_boundary_values<float> (const std::map<unsigned int,double> &boundary_values, + apply_boundary_values<float> (const std::map<types::global_dof_index,double> &boundary_values, BlockSparseMatrix<float> &matrix, BlockVector<float> &solution, BlockVector<float> &right_hand_side, diff --git a/deal.II/source/numerics/matrix_tools.inst.in b/deal.II/source/numerics/matrix_tools.inst.in index 07c6301155..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 @@ -93,7 +97,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS SparseMatrix<double> &matrix, const FunctionMap<deal_II_space_dimension>::type &rhs, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<deal_II_space_dimension> * const a, std::vector<unsigned int>); @@ -105,12 +109,33 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS SparseMatrix<double> &matrix, const FunctionMap<deal_II_space_dimension>::type &rhs, Vector<double> &rhs_vector, - std::vector<unsigned int> &dof_to_boundary_mapping, + std::vector<types::global_dof_index> &dof_to_boundary_mapping, const Function<deal_II_space_dimension> * const a, std::vector<unsigned int>); + template + void + MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_space_dimension> + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension>&, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension>&, + const hp::QCollection<deal_II_dimension-1>&, + SparseMatrix<double>&, + const FunctionMap<deal_II_space_dimension>::type&, + Vector<double>&, + std::vector<types::global_dof_index>&, + const Function<deal_II_space_dimension> * const, + std::vector<unsigned int>); - + template + void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension,deal_II_space_dimension> + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension>&, + const hp::QCollection<deal_II_dimension-1>&, + SparseMatrix<double>&, + const FunctionMap<deal_II_space_dimension>::type&, + Vector<double>&, + std::vector<types::global_dof_index>&, + const Function<deal_II_space_dimension> * const, + std::vector<unsigned int>); #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<deal_II_dimension> - (const hp::MappingCollection<deal_II_dimension> &mapping, - const hp::DoFHandler<deal_II_dimension> &dof, + void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_space_dimension> + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension> &mapping, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, SparseMatrix<double> &matrix, - const Function<deal_II_dimension> * const coefficient, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); + template - void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::DoFHandler<deal_II_dimension> &dof, + void MatrixCreator::create_mass_matrix<deal_II_dimension,double,deal_II_space_dimension> + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension> &mapping, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, SparseMatrix<double> &matrix, - const Function<deal_II_dimension> * const coefficient, + const Function<deal_II_space_dimension> &rhs, + Vector<double> &rhs_vector, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::MappingCollection<deal_II_dimension> &mapping, - const hp::DoFHandler<deal_II_dimension> &dof, + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension> &mapping, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, - SparseMatrix<double> &matrix, - const Function<deal_II_dimension> &rhs, + SparseMatrix<float> &matrix, + const Function<deal_II_space_dimension> &rhs, Vector<double> &rhs_vector, - const Function<deal_II_dimension> * const coefficient, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::DoFHandler<deal_II_dimension> &dof, + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, - SparseMatrix<double> &matrix, - const Function<deal_II_dimension> &rhs, + SparseMatrix<float> &matrix, + const Function<deal_II_space_dimension> &rhs, Vector<double> &rhs_vector, - const Function<deal_II_dimension> * const coefficient, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); +#endif +#if deal_II_dimension == deal_II_space_dimension + + template void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::MappingCollection<deal_II_dimension> &mapping, - const hp::DoFHandler<deal_II_dimension> &dof, + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, - SparseMatrix<float> &matrix, - const Function<deal_II_dimension> * const coefficient, + SparseMatrix<double> &matrix, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::DoFHandler<deal_II_dimension> &dof, + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, - SparseMatrix<float> &matrix, - const Function<deal_II_dimension> * const coefficient, + SparseMatrix<double> &matrix, + const Function<deal_II_space_dimension> &rhs, + Vector<double> &rhs_vector, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::MappingCollection<deal_II_dimension> &mapping, - const hp::DoFHandler<deal_II_dimension> &dof, + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension> &mapping, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, SparseMatrix<float> &matrix, - const Function<deal_II_dimension> &rhs, - Vector<double> &rhs_vector, - const Function<deal_II_dimension> * const coefficient, + const Function<deal_II_space_dimension> * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix<deal_II_dimension> - (const hp::DoFHandler<deal_II_dimension> &dof, + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &dof, const hp::QCollection<deal_II_dimension> &q, SparseMatrix<float> &matrix, - const Function<deal_II_dimension> &rhs, - Vector<double> &rhs_vector, - const Function<deal_II_dimension> * const coefficient, - const ConstraintMatrix &constraints); - - -#if deal_II_dimension != 1 - - - - template - void - MatrixCreator::create_boundary_mass_matrix<deal_II_dimension> - (const hp::MappingCollection<deal_II_dimension>&, - const hp::DoFHandler<deal_II_dimension>&, - const hp::QCollection<deal_II_dimension-1>&, - SparseMatrix<double>&, - const FunctionMap<deal_II_dimension>::type&, - Vector<double>&, - std::vector<unsigned int>&, - const Function<deal_II_dimension> * const, - std::vector<unsigned int>); - - template - void MatrixCreator::create_boundary_mass_matrix<deal_II_dimension> - (const hp::DoFHandler<deal_II_dimension>&, - const hp::QCollection<deal_II_dimension-1>&, - SparseMatrix<double>&, - const FunctionMap<deal_II_dimension>::type&, - Vector<double>&, - std::vector<unsigned int>&, - const Function<deal_II_dimension> * const, - std::vector<unsigned int>); - -#endif - + const Function<deal_II_space_dimension> * 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 57d6262b7d..c7b849693b 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 <deal.II/lac/vector.h> #include <deal.II/lac/block_vector.h> @@ -39,7 +43,7 @@ namespace internal PointGeometryData<dim> ::PointGeometryData (const Point <dim> &new_requested_location, const std::vector <Point <dim> > &new_locations, - const std::vector <int> &new_sol_indices) + const std::vector <types::global_dof_index> &new_sol_indices) { requested_location = new_requested_location; support_point_locations = new_locations; @@ -268,9 +272,9 @@ void PointValueHistory<dim> } - std::vector<unsigned int> + std::vector<types::global_dof_index> local_dof_indices (dof_handler->get_fe ().dofs_per_cell); - std::vector <int> new_solution_indices; + std::vector <types::global_dof_index> new_solution_indices; current_cell->get_dof_indices (local_dof_indices); // there is an implicit assumption here // that all the closest support point to @@ -411,11 +415,11 @@ void PointValueHistory<dim> } } - std::vector<unsigned int> local_dof_indices (dof_handler->get_fe ().dofs_per_cell); + std::vector<types::global_dof_index> local_dof_indices (dof_handler->get_fe ().dofs_per_cell); for (unsigned int point = 0; point < locations.size (); point++) { current_cell[point]->get_dof_indices (local_dof_indices); - std::vector <int> new_solution_indices; + std::vector<types::global_dof_index> new_solution_indices; for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++) { 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 d10e394da6..0a40a40830 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 <deal.II/base/memory_consumption.h> #include <deal.II/grid/tria.h> @@ -76,7 +78,7 @@ void SolutionTransfer<dim, VECTOR, DH>::prepare_for_pure_refinement() n_dofs_old=dof_handler->n_dofs(); // efficient reallocation of indices_on_cell - std::vector<std::vector<unsigned int> > (n_active_cells) + std::vector<std::vector<types::global_dof_index> > (n_active_cells) .swap(indices_on_cell); typename DH::active_cell_iterator cell = dof_handler->begin_active(), @@ -291,7 +293,7 @@ prepare_for_coarsening_and_refinement(const std::vector<VECTOR> &all_in) // allocate the needed memory. initialize // the following arrays in an efficient // way, without copying much - std::vector<std::vector<unsigned int> > + std::vector<std::vector<types::global_dof_index> > (n_cells_to_stay_or_refine) .swap(indices_on_cell); @@ -498,7 +500,7 @@ interpolate (const std::vector<VECTOR> &all_in, " at the same time!")); Vector<typename VECTOR::value_type> local_values; - std::vector<unsigned int> dofs; + std::vector<types::global_dof_index> dofs; typename std::map<std::pair<unsigned int, unsigned int>, Pointerstruct>::const_iterator pointerstruct, @@ -516,7 +518,7 @@ interpolate (const std::vector<VECTOR> &all_in, if (pointerstruct!=cell_map_end) { - const std::vector<unsigned int> *const indexptr + const std::vector<types::global_dof_index> *const indexptr =pointerstruct->second.indices_ptr; const std::vector<Vector<typename VECTOR::value_type> > *const valuesptr diff --git a/deal.II/source/numerics/solution_transfer.inst.in b/deal.II/source/numerics/solution_transfer.inst.in index 5d8ec479d6..fe64874d34 100644 --- a/deal.II/source/numerics/solution_transfer.inst.in +++ b/deal.II/source/numerics/solution_transfer.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $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) { diff --git a/deal.II/source/numerics/solution_transfer_inst2.cc b/deal.II/source/numerics/solution_transfer_inst2.cc index e903f04353..09c0cde103 100644 --- a/deal.II/source/numerics/solution_transfer_inst2.cc +++ b/deal.II/source/numerics/solution_transfer_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 solution_transfer.cc // to get the memory consumption below 1.5gb with gcc (if compiling with PETSc and Trilinos). 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 <deal.II/numerics/time_dependent.h> #include <deal.II/base/memory_consumption.h> @@ -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 index af44a3a505..fe9539c1d0 100644 --- a/deal.II/source/numerics/vector_tools.cc +++ b/deal.II/source/numerics/vector_tools.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 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 <deal.II/numerics/vector_tools.templates.h> diff --git a/deal.II/source/numerics/vector_tools.inst.in b/deal.II/source/numerics/vector_tools.inst.in index d4f394f95c..7d0327b866 100644 --- a/deal.II/source/numerics/vector_tools.inst.in +++ b/deal.II/source/numerics/vector_tools.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $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 (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { @@ -113,6 +118,29 @@ for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimens const bool, const Quadrature<deal_II_dimension-1> &, const bool); + + template + void project + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension> &, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &, + const ConstraintMatrix &, + const hp::QCollection<deal_II_dimension> &, + const Function<deal_II_space_dimension> &, + VEC &, + const bool, + const hp::QCollection<deal_II_dimension-1> &, + const bool); + + template + void project + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &, + const ConstraintMatrix &, + const hp::QCollection<deal_II_dimension> &, + const Function<deal_II_space_dimension> &, + VEC &, + const bool, + const hp::QCollection<deal_II_dimension-1> &, + const bool); \} #endif } @@ -293,7 +321,7 @@ for (deal_II_dimension : DIMENSIONS) const MGDoFHandler<deal_II_dimension> &, const types::boundary_id, const Function<deal_II_dimension> &, - std::map<unsigned int,double> &, + std::map<types::global_dof_index,double> &, const ComponentMask &); \} } @@ -308,7 +336,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; (const Mapping<deal_II_dimension,deal_II_space_dimension> &, const DH<deal_II_dimension,deal_II_space_dimension> &, const FunctionMap<deal_II_space_dimension>::type &, - std::map<unsigned int,double> &, + std::map<types::global_dof_index,double> &, const ComponentMask &); template @@ -317,7 +345,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; const DH<deal_II_dimension,deal_II_space_dimension> &, const types::boundary_id, const Function<deal_II_space_dimension> &, - std::map<unsigned int,double> &, + std::map<types::global_dof_index,double> &, const ComponentMask &); template @@ -325,14 +353,14 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; const DH<deal_II_dimension,deal_II_space_dimension> &, const types::boundary_id, const Function<deal_II_space_dimension> &, - std::map<unsigned int,double> &, + std::map<types::global_dof_index,double> &, const ComponentMask &); template void interpolate_boundary_values (const DH<deal_II_dimension,deal_II_space_dimension> &, const FunctionMap<deal_II_space_dimension>::type &, - std::map<unsigned int,double> &, + std::map<types::global_dof_index,double> &, const ComponentMask &); template @@ -399,8 +427,28 @@ 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 namespace VectorTools \{ + +#if deal_II_dimension <= deal_II_space_dimension + template + void project_boundary_values<deal_II_dimension,deal_II_space_dimension> + (const hp::MappingCollection<deal_II_dimension,deal_II_space_dimension> &, + const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &, + const FunctionMap<deal_II_space_dimension>::type &, + const hp::QCollection<deal_II_dimension-1>&, + std::map<types::global_dof_index,double>&, + std::vector<unsigned int>); + + template + void project_boundary_values<deal_II_dimension,deal_II_space_dimension> + (const hp::DoFHandler<deal_II_dimension,deal_II_space_dimension> &, + const FunctionMap<deal_II_space_dimension>::type &, + const hp::QCollection<deal_II_dimension-1>&, + std::map<types::global_dof_index,double>&, + std::vector<unsigned int>); +#endif + +#if deal_II_dimension == deal_II_space_dimension template void create_right_hand_side<deal_II_dimension> (const hp::MappingCollection<deal_II_dimension> &, @@ -513,38 +561,22 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS -#if deal_II_dimension > 1 template void project_boundary_values<deal_II_dimension> (const Mapping<deal_II_dimension> &, const DoFHandler<deal_II_dimension> &, const FunctionMap<deal_II_dimension>::type &, const Quadrature<deal_II_dimension-1>&, - std::map<unsigned int,double>&, std::vector<unsigned int>); -#endif + std::map<types::global_dof_index,double>&, std::vector<unsigned int>); template void project_boundary_values<deal_II_dimension> (const DoFHandler<deal_II_dimension> &, const FunctionMap<deal_II_dimension>::type &, const Quadrature<deal_II_dimension-1>&, - std::map<unsigned int,double>&, std::vector<unsigned int>); - - - template - void project_boundary_values<deal_II_dimension> - (const Mapping<deal_II_dimension> &, - const DoFHandler<deal_II_dimension> &, - const FunctionMap<deal_II_dimension>::type &, - const Quadrature<deal_II_dimension-1>&, - ConstraintMatrix&, std::vector<unsigned int>); + std::map<types::global_dof_index,double>&, + std::vector<unsigned int>); - template - void project_boundary_values<deal_II_dimension> - (const DoFHandler<deal_II_dimension> &, - const FunctionMap<deal_II_dimension>::type &, - const Quadrature<deal_II_dimension-1>&, - ConstraintMatrix&, std::vector<unsigned int>); #if deal_II_dimension != 1 @@ -595,8 +627,8 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS ConstraintMatrix &constraints, const Mapping<deal_II_dimension> &mapping); #endif - \} #endif + \} }