-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
-## ##
-# 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:
#
# 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)
INCLUDE(setup_finalize)
-###########################################################################
-# #
-# Compilation and installation: #
-# #
-###########################################################################
+########################################################################
+# #
+# Compilation and installation: #
+# #
+########################################################################
MESSAGE(STATUS "")
MESSAGE(STATUS "Configuring done. Proceed to target definitions now.")
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:
#
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.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Export information about bundled library locations and do the actual
enum xtime_clock_types
{
- TIME_UTC=1
+ TIME_UTC_=1
// TIME_TAI,
// TIME_MONOTONIC,
// TIME_PROCESS,
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;
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
SET(src_boost_serialization
basic_archive.cpp
<< "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;
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);
{
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);
}
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);
{
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);
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
}
-#####
+## ---------------------------------------------------------------------
+## $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_USE_MT_POSIX)
SET(src_boost_thread
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;
}
BOOST_VERIFY(!pthread_yield());
# else
xtime xt;
- xtime_get(&xt, TIME_UTC);
+ xtime_get(&xt, TIME_UTC_);
sleep(xt);
# endif
}
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) *
{
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)
{
{
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;
{
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;
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) *
{
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)
{
{
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;
{
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;
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Remove -Wall and -pedantic from CMAKE_CXX_FLAGS (in directory scope) to
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Remove -Wall and -pedantic from CMAKE_CXX_FLAGS (in directory scope) to
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
SET(src_amd
amd_1.cc
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Logic copied from the distributed UMFPACK Makefile.
+++ /dev/null
-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
-#####
+## ---------------------------------------------------------------------
+## $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.
##
-#####
+## ---------------------------------------------------------------------
-###########################################################################
-# #
-# Check for various compiler features: #
-# #
-###########################################################################
+########################################################################
+# #
+# Check for various compiler features: #
+# #
+########################################################################
#
# This file sets up:
"
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
-###########################################################################
-# #
-# Platform and CPU specific tests: #
-# #
-###########################################################################
+########################################################################
+# #
+# Platform and CPU specific tests: #
+# #
+########################################################################
#
# This file sets up
#
# 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)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Check for various C++ language features
#
-###########################################################################
-# #
-# C++11 Support: #
-# #
-###########################################################################
+########################################################################
+# #
+# C++11 Support: #
+# #
+########################################################################
#
# See if there is a compiler flag to enable C++11 features
ENDIF()
-###########################################################################
-# #
-# Check for various C++ features: #
-# #
-###########################################################################
+########################################################################
+# #
+# Check for various C++ features: #
+# #
+########################################################################
CHECK_CXX_SOURCE_COMPILES(
"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# This file sets up:
#
-###########################################################################
-# #
-# POSIX and Linux specific tests: #
-# #
-###########################################################################
+########################################################################
+# #
+# POSIX and Linux specific tests: #
+# #
+########################################################################
#
# Check for various posix (and linux) specific header files and symbols
#
# 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")
#
#
# 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")
#
# - 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")
-#####
+## ---------------------------------------------------------------------
+## $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.
##
-#####
+## ---------------------------------------------------------------------
-###########################################################################
-# #
-# Check for various compiler bugs: #
-# #
-###########################################################################
+########################################################################
+# #
+# Check for various compiler bugs: #
+# #
+########################################################################
#
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 <mpi.h>
- 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
explicit X(T) {}
};
void f(X) {}
- int main() { f(1) };
+ int main() { f(1); }
"
DEAL_II_EXPLICIT_CONSTRUCTOR_BUG
)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
)
-###########################################################################
-# #
-# 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
)
-###########################################################################
-# #
-# 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
)
-###########################################################################
-# #
-# Configure and install the old Makefile configuration: #
-# #
-###########################################################################
+########################################################################
+# #
+# Configure and install the old Makefile configuration: #
+# #
+########################################################################
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
-##########################################################################
-## ##
-## The deal.II project configuration file ##
-## ##
-##########################################################################
+########################################################################
+## ##
+## The deal.II project configuration file ##
+## ##
+########################################################################
#
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@")
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
#
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the lapack library:
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()
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()
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# 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)
#
# 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)
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()
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})
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# 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"
)
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:
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...)
#
# 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)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the umfpack library:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
-# Configuration for the netcdf library:
+# Configuration for the metis library:
#
MACRO(FEATURE_METIS_FIND_EXTERNAL var)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the petsc library:
# 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:
#
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)
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})
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the trilinos library:
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
#
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...
# 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")
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the ARPACK library:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the boost library:
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for functionparser
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the hdf5 library:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the MUMPS library:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the netcdf library:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the p4est and sc libraries:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the SLEPC library:
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Configuration for the zlib library:
-#####
+## ---------------------------------------------------------------------
+## $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 small macro used for (string-)appending a string "${flags}" to a
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Check for a compiler bug.
-#####
+## ---------------------------------------------------------------------
+## $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 bool is "true" (in a cmake fashion...), set variable to "yes",
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# This macro is used for the feature configuration in deal.II
#
-###########################################################################
-# #
-# Helper Macros: #
-# #
-###########################################################################
+########################################################################
+# #
+# Helper Macros: #
+# #
+########################################################################
#
# Some black magic to have substitution in command names:
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)
#
-#####
+## ---------------------------------------------------------------------
+## $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 small wrapper around
-#####
+## ---------------------------------------------------------------------
+## $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 small wrapper around ADD_DEPENDENCIES to add the specified dependencies
-#####
+## ---------------------------------------------------------------------
+## $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 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
#
)
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# This file implements the DEAL_II_INITIALIZE_VARIABLES macro, which is
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.")
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# This file implements the DEAL_II_INVOKE_AUTOPILOT macro, which is
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# This file implements the DEAL_II_SETUP_TARGET macro, which is
#
# 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.
#
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Tests whether it is possible to compile and link a dummy program with a
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Tests whether the cxx compiler understands a 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}
--- /dev/null
+## ---------------------------------------------------------------------
+## $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()
-#####
+## ---------------------------------------------------------------------
+## $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 macro for the inst.in file expansion
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# A small wrapper around FIND_PACKAGE.
-#####
+## ---------------------------------------------------------------------
+## $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 small macro to test whether a given list contains an element.
-#####
+## ---------------------------------------------------------------------
+## $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 small macro used in the platform checks to remove the right most flag in
-#####
+## ---------------------------------------------------------------------
+## $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 small macro used in the platform checks to easily add a flag to
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Replace all occurences of "${flag}" with "${replacement}" in the string
-#####
+## ---------------------------------------------------------------------
+## $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 'variable' is empty it will be set to 'value'
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Remove all occurences of "${flag}" in the string variable.
--- /dev/null
+## ---------------------------------------------------------------------
+## $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()
-#####
+## ---------------------------------------------------------------------
+## $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 small macro used for converting a list into a space
-#####
+## ---------------------------------------------------------------------
+## $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 small macro used for converting a cmake list into a space
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the ARPACK library
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the HDF5 library
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
${HDF5_INCLUDE_DIR}
)
SET(HDF5_LIBRARIES
- ${HDF5_LIBRARY}
${HDF5_HL_LIBRARY}
+ ${HDF5_LIBRARY}
+ ${MPI_C_LIBRARIES} # for good measure
)
#
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the (serial) METIS library
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
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})
#
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the MUMPS library
# (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
# 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
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}
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the NETCDF C and C++ libraries
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}
${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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the P4EST 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}
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the petsc library
# PETSC_VERSION_SUBMINOR
# PETSC_VERSION_PATCH
# PETSC_WITH_MPIUNI
+# PETSC_WITH_64BIT_INDICES
#
INCLUDE(FindPackageHandleStandardArgs)
FIND_FILE(PETSC_PETSCVARIABLES
NAMES petscvariables
HINTS
- ${PETSC_DIR}
${PETSC_DIR}/${PETSC_ARCH}
+ ${PETSC_DIR}
PATH_SUFFIXES conf
)
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}})
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}
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"
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the SCALAPACK library
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}
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the SLEPC library
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}
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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the Threading Building Blocks library
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)
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"
)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the Trilinos library
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)
#
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}
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"
)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Try to find the UMFPACK library
# now.
#
FIND_PACKAGE(LAPACK)
+FIND_PACKAGE(METIS)
#
# Two macros to make life easier:
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
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
${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"
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc)
IF(NOT CMAKE_CROSSCOMPILING)
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)
-//---------------------------- 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
-//---------------------------- 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
-//----------------------------------------------------------------------
-// $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 <deal.II/base/config.h>
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;
std::cout << "dealii-feature: LibZ=yes" << std::endl;
#endif
+#ifdef DEAL_II_WITH_64BIT_INDICES
+ std::cout << "dealii-feature: 64bit_indices=yes" <<std::endl;
+#endif
}
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Setup cached variables (prior to the PROJECT(deal.II) call)
#
# 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
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:
)
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
)
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)
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
# 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})
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)
# 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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Setup default compiler flags: This file sets up sensible default compiler
# 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
#
-###########################################################################
-# #
-# 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()
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)
#
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# General setup for GCC and compilers sufficiently close to GCC
# 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:
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
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: #
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")
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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# General setup for the Intel C++ Compiler
# 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:
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: #
#
# 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")
-#####
+## ---------------------------------------------------------------------
+## $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: Timo Heister
-##
-#####
+## ---------------------------------------------------------------------
#
# General setup for the Microsoft Visual Studio C++ Compiler (Windows)
+++ /dev/null
-#####
-##
-## 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.
-##
-## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de>
-##
-#####
-
-#
-# 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()
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
# Set up deal.II specific definitions
# *) 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")
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}")
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
)
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:
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()
-#####
+## ---------------------------------------------------------------------
+## $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 all external (cmake) macros that we will use:
INCLUDE(CheckCXXCompilerFlag)
INCLUDE(CheckCXXSourceCompiles)
-INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckCXXSourceRuns)
INCLUDE(CheckCXXSymbolExists)
INCLUDE(CheckIncludeFileCXX)
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
-###########################################################################
-# #
-# Finalize the configuration: #
-# #
-###########################################################################
+########################################################################
+# #
+# Finalize the configuration: #
+# #
+########################################################################
#
# Hide some cmake specific cached variables. This is annoying...
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")
)
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")
ELSE()
_both("# ${_var} set up with bundled packages\n")
ENDIF()
+ ELSE()
+ _both("# ${_var} = ${${_var}}\n")
ENDIF()
ELSE()
# FEATURE is disabled
-#####
+## ---------------------------------------------------------------------
+## $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_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)
+
+## ---------------------------------------------------------------------
+## $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/
-#---------------------------------------------------------------------------
-# $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
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
-#####
+## ---------------------------------------------------------------------
+## $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 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 <matthias.maier@iwr.uni-heidelberg.de>
-##
-#####
+## ---------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#PROJECT(mesh_converter)
-#####
+## ---------------------------------------------------------------------
+## $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.
##
-## <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>
-##
-#####
+## ---------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#PROJECT(parameter_gui)
-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.
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QtGui>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QtGui>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QApplication>
#include <QSplashScreen>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QtGui>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QtGui>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QtGui>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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 <QtGui>
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
--- /dev/null
+## ---------------------------------------------------------------------
+## $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()
--- /dev/null
+#include <deal.II/grid/tria.h>
+#include <sched.h>
+
+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));
+}
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
#
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:
#
Step-29 tutorial program.
<li><em>Fahad Alrashed:</em>
- work in PETScWrappers.
+ work in PETScWrappers, various other fixes.
<li><em>Michael Anderson:</em>
Linear complexity grid reordering algorithm in 2d and 3d.
<li><em>Chih-Che Chueh:</em>
Step-43 tutorial program.
+ <li><em>Denis Davydov:</em>
+ FEValuesExtractors::Tensor and associated functionality, various other changes.
+
<li><em>Kevin Dugan:</em>
Fixes in VectorTools::interpolate.
Eulerian mappings.
<li><em>Martin Steigemann:</em>
- 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.
<li><em>Franz-Theo Suttmeier:</em>
Initial parts of the linear algebra libraries.
Packaging and configuration issues.
<li><em>Bruno Turcksin:</em>
- Extending deal.ii for 64-bit integer support.
+ Extending deal.ii for 64-bit integer support, various other changes.
<li><em>Kainan Wang:</em>
Extending deal.ii for 64-bit integer support.
-
+
<li><em>Yaqi Wang:</em>
The step-28 tutorial program;
<li><em>Joshua White:</em>
Arbitrary order Eulerian mappings.
+ <li><em>Christian Wülker:</em>
+ GridOut::write_svg.
+
<li><em>Toby D. Young:</em>
Interfaces to SLEPc; many changes in the interfaces to PETSc;
MUMPS interface;
# "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"
# )
# "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."
+# )
+#
+#
###########################################################################
# 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:
#
# 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 "")
+#
+#
#
<li><a href="#config.h.in"><code>./include/deal.II/base/config.h.in</code></a>
<li><a href="#source"><code>./source/CMakeLists.txt</code></a>
<li><a href="#projectconfig"><code>./cmake/config/CMakeLists.txt</code></a>
- <li>TODO
</ul>
</td>
</tr>
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}}"
)
# 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
<li>
For internal use, for setting necessary linker flags for the deal.II library:
<ul>
- <li> <code>CMAKE_SHARED_LINKER_FLAGS</code>
- <li> <code>DEAL_II_SHARED_LINKER_FLAGS_DEBUG</code>
- <li> <code>DEAL_II_SHARED_LINKER_FLAGS_RELEASE</code>
+ <li> <code>DEAL_II_LINKER_FLAGS</code>
+ <li> <code>DEAL_II_LINKER_FLAGS_DEBUG</code>
+ <li> <code>DEAL_II_LINKER_FLAGS_RELEASE</code>
</ul>
<li>
two macros:
<pre>
+ #
+ # 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
)
#
# A list of instantiations that must be expanded:
#
- SET(inst_in_files
+ SET(_inst
...
dof_tools.inst.in
)
# ${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
DEAL_II_WITH_TRILINOS
DEAL_II_WITH_UMFPACK
DEAL_II_WITH_ZLIB
+ DEAL_II_WITH_64BIT_INDICES
</pre>
They all have standard meaning with the exception of
two:
<code>BUILD_SHARED_LIBS</code>: If set (default),
<acronym>deal.II</acronym> will be linked as a shared library
+ <li>
+ <code>DEAL_II_PREFER_STATIC_LIBS</code> (defaults to off): If set
+ to true, static archives will be preferred over dynamic libraries when
+ searching for features and corresponding link interface.
+
+ <li>
+ <code>DEAL_II_STATIC_EXECUTABLE</code> (defaults to off):
+ If set to true, <acronym>deal.II</acronym> will be configured in
+ a way to provide a link interface that is suitable for static
+ linkage of executables. Enabling this option forces
+ <code>BUILD_SHARED_LIBS=OFF</code> and
+ <code>DEAL_II_PERFER_STATIC_LIBS</code>.
+
<li>
<code>CMAKE_INSTALL_RPATH_USE_LINK_PATH</code>: If set
(default), the <acronym>deal.II</acronym> library will be
</p>
Compilers can be switched either by command line or by setting
- <code>CMAKE_(C|CXX)_COMPILER</code>:
+ <code>CMAKE_(C|CXX|Fortran)_COMPILER</code>:
<pre>
CC=mpicc CXX=mpicxx cmake <...>
- cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" <...>
+ cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" -DCMAKE_Fortran_COMPILER="mpif90" <...>
</pre>
Please note that
<ul>
The compiler <i>must</i> be specified at the very first
invokation of <code>cmake</code>.
<li>
- The specified C and CXX compilers must be the same compiler
- brand and the same compiler version.
+ A working CXX compiler is needed. It is optional to provide a C
+ or Fortran compiler.
</ul>
</p>
<p>
- deal.II will configure sensible default <code>CFLAGS</code> and
- <code>CXXFLAGS</code> depending on platform, compiler and build
- target. There are two options to override this behaviour:
+ deal.II will configure sensible default <code>CXXFLAGS</code>
+ depending on platform, compiler and build target. There are two
+ options to override this behaviour:
<ol>
<li>
</head>
<frameset rows="70,*">
- <frame name="title" src="title.html">
- <frameset cols="120,*">
- <frame name="navbar" src="navbar.html">
- <frame name="body" src="toc.html">
+ <frame name="title" src="title.html" frameborder="1">
+ <frameset cols="150,*">
+ <frame name="navbar" src="navbar.html" frameborder="0">
+ <frame name="body" src="toc.html" frameborder="0">
</frameset>
<noframes>
<h1>deal.II Development Information</h1>
<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>
<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>
<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>
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
-#####
+## ---------------------------------------------------------------------
+## $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
<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>
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
* 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 ();
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
--- /dev/null
+// ---------------------------------------------------------------------
+// $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.
+ *
+ *
+ */
-
-//-------------------------------------------------------------------------
-// $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
* <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>
*
*
*
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
+// ---------------------------------------------------------------------
+// $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
@{
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
+// ---------------------------------------------------------------------
+// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
*
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-//-------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
/**
-
(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
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
*
* 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
-//-------------------------------------------------------------------------
-// $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
+## ---------------------------------------------------------------------
+## $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
-#---------------------------------------------------------------------------
-# $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.
-#---------------------------------------------------------------------------
-# $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";
-#---------------------------------------------------------------------------
-# $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";
-#---------------------------------------------------------------------------
-# $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";
-#---------------------------------------------------------------------------
-# $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";
-#---------------------------------------------------------------------------
-# $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";
-#---------------------------------------------------------------------------
-# $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
-#---------------------------------------------------------------------------
-# $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";
-#####
+## ---------------------------------------------------------------------
+## $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>
-##
-#####
+## ---------------------------------------------------------------------
#
<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) $">
<p>
You can override the autodetection by manually specifying
<pre>
+
-DDEAL_II_WITH_MUMPS=OFF|ON
</pre>.
</p>
"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>
<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>
<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>
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
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>
<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>
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> -->
<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>
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>
<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>
--- /dev/null
+#!/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;
+}
-//----------------------------------------------------------------------
+// ---------------------------------------------------------------------
// $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.
//
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
-//----------------------------------------------------------------------
+// ---------------------------------------------------------------------
+
--- /dev/null
+## ---------------------------------------------------------------------
+## $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.
+##
+## ---------------------------------------------------------------------
--- /dev/null
+#!/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
+
<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 />
--- /dev/null
+/**
+ * @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–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ö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ö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>
+
+
+*/
/**
- * @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>
<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>
<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>
<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–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ö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ö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>
<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
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ö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>
<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
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
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ö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örfler, S. Findeisen
<br>
<strong>Numerical optimization of a waveguide transition
Communications in Computational Physics, accepted, 2013.
</li>
+ <li> E. Emmrich, A. Wróblewska-Kamiń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
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
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üger
<br>
<strong>Regularization-based fictitious domain methods
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
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>
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>
(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
2013
</li>
+ <li> A. Vidal-Ferrandiz, R. Fayez, D. Ginestar, G. Verdú
+ <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
<!-- 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öhe
<br>
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>
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&M University, 2012.
- </li>
-
<li> A. Demlow, A. H. Georgoulis
<br>
<strong>Pointwise a posteriori error control for
Journal of the Electrochemical Society, 159(5), B1-B10, 2012.
</li>
- <li> T. Dohnal, W. Dö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
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
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
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
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
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
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
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
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>
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
<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
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>
<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>
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.
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
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>
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
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>
<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
-#####
+## ---------------------------------------------------------------------
+## $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}/
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-/* $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}
-/* 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.
-/* 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:
-/* 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:
-/* 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,
// 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,
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)
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(),
-/* 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...
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,
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)
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(),
-/* $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}
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(),
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>(),
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;
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(),
-/* 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
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);
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);
-/* 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
// 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);
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);
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:
//
// 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),
-/* 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
// 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
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,
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
// 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,
-/* 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}
-/* 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:
-/* 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}
// 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];
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
-/* 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
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);
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],
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;
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;
-/* 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}
// <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];
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,
-/* 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}
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,
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,
-/* 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}
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);
-/* 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}
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);
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);
-/* 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>
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;
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,
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());
// 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());
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 ();
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);
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,
(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;
}
-/* 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}
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(),
-/* 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}
Vector<double> system_rhs;
- std::map<unsigned int,double> boundary_values;
+ std::map<types::global_dof_index,double> boundary_values;
ConstraintMatrix hanging_node_constraints;
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(),
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(),
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)
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();
-/* 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}
// 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(),
// 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>(),
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.
<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 — 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
-/* 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}
// 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
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
//
// 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.
// 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
// 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>(),
-/* 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.
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
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)}}$ — 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>
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
<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,
-/* 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}
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;
// 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
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)
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);
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);
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
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);
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
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;
// 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(),
-/* 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}
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>
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>
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;
};
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);
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);
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(),
-/* 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}
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);
{
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
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());
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;
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)
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 ();
-/* 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}
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;
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);
-/* 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}
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;
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,
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),
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);
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
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);
-/* 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}
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 (),
-/* $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>
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);
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);
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);
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
-/* 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}
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;
}
}
- std::map<unsigned int,double> boundary_values;
+ std::map<types::global_dof_index,double> boundary_values;
VectorTools::interpolate_boundary_values (mapping,
dof_handler,
0,
-/* 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
{
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;
};
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;
};
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;
};
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
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>,
-/* 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}
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
// 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>(),
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.
-/* 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}
// 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>
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;
};
fe (2),
pcout (std::cout,
(Utilities::MPI::this_mpi_process(mpi_communicator)
- == 0))
+ == 0)),
+ computing_timer (pcout,
+ TimerOutput::summary,
+ TimerOutput::wall_times)
{}
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,
// 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
// 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);
}
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,
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(),
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);
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),
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 ();
}
+
}
}
-/* 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}
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(),
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(),
-/* $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}
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 ()
// 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);
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);
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;
// 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)
{
// 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)
{
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;
private:
std_cxx1x::shared_ptr<Input<dim> > const &input_obstacle_copy;
- bool use_read_obstacle;
+ bool use_read_obstacle;
};
template <int dim>
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;
}
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);
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);
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,
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),
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");
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();
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);
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 |
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);
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);
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);
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
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;
}
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(),
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)
}
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 ();
{
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");
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 ();
media. Computers & Fluids, 39:1585-1596, 2010
- Chih-Che Chueh, Ned Djilali, Wolfgang Bangerth. An h-adaptive operator
splitting method for two-phase flow in 3D heterogeneous porous
- media. Submitted.
+ media. SIAM Journal on Scientific Computing, 35:B149-B175, 2013.
The implementation discussed here uses and extends
parts of the step-21 and step-31 tutorial programs.
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.
-/* 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}
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);
}
- 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],
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);
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;
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(),
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 ();
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;
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;
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(),
-/* 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
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.
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)
:
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)
:
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;
// 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);
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
{
-/* 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}
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;
-/* 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}
// 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)
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;
-/* 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>
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);
}
- 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),
-/* $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.
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;
// 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),
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)
// 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 ()
//
// 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;
-/* $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
*/
// 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
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}
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);
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));
}
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");
// 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)));
+ }
};
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");
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");
-/* 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}
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
}
// 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>(),
// 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
-/* 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!
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
fe (degree),
mg_dof_handler (triangulation),
degree(degree)
- {}
+ {
+ if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)!=0)
+ deallog.depth_console(0);
+ }
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);
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());
// 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 ();
// 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 ();
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);
}
}
local_dof_indices,
system_matrix, system_rhs);
}
+
+ system_matrix.compress(VectorOperation::add);
+ system_rhs.compress(VectorOperation::add);
}
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]);
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();
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 &&
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);
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 -
// 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
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> >
// 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);
}
{
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 ();
}
{
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);
+ }
}
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;
{
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 ();
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;
-/* 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}
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);
-/* 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}
// 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,
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
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>(),
-/* 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}
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
// 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),
-/* 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:
// @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
// 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
// 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
// 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> >
// 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.
//
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);
// ... 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
//
// 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
-#####
+## ---------------------------------------------------------------------
+## $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
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
{
/**
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
// $Id$
// Version: $Name$
//
-// Copyright (C) 2012 by the deal.II authors
+// Copyright (C) 2012, 2013 by the deal.II authors
//
// TODO: Header
//
#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: *
**************************************/
# 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
-//---------------------------------------------------------------------------
-// $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
* 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
-//---------------------------------------------------------------------------
-// $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
*/
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:
};
vtu,
/**
- * Output in
+ * Output in
* SVG format.
*/
svg,
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
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
/**
- * 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
* 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()
+// ---------------------------------------------------------------------
+// $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
Tensor<2,dim> DF_t (dealii::transpose(invert( (Tensor<2,dim>)(*this) )));
DerivativeForm<1,dim, spacedim> result = DF_t;
- return(result);
+ return (result);
}
else
{
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
/**
* 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;
* 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.
<< "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.
*/
<< "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.
#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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
{
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;
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
* 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
{
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
{
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:
/**
* 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
{
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> {
*
* 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
{
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;
};
+
/**
- * 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
* 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
*/
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;
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
* 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);
{
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;
};
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
-//---------------------------------------------------------------------------
-// $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>
#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
* 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
* 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
* set. The latter information is
* returned by n_elements().
*/
- unsigned int size () const;
+ types::global_dof_index size () const;
/**
* Add the half-open range
* 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
* 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
* 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
* 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
* 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
* 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;
/**
* 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
*/
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.");
*/
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
* @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,
* 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
* 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()
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)
inline
-IndexSet::IndexSet (const unsigned int size)
+IndexSet::IndexSet (const types::global_dof_index size)
:
is_compressed (true),
index_space_size (size),
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 "
inline
-unsigned int
+types::global_dof_index
IndexSet::size () const
{
return index_space_size;
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)
{
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)
// 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))
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();
inline
bool
-IndexSet::is_element (const unsigned int index) const
+IndexSet::is_element (const types::global_dof_index index) const
{
if (ranges.empty() == false)
{
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();
}
#ifdef DEBUG
- unsigned int s = 0;
+ types::global_dof_index s = 0;
for (std::vector<Range>::iterator range = ranges.begin();
range != ranges.end();
++range)
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
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
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;
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
/**
* 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);
/**
// 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);
-//---------------------------------------------------------------------------
-// $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
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>
+ 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)
{
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);
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
}
+ 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;
-//---------------------------------------------------------------------------
-// $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
//---------------------------------------------------------------------------
* 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
{
/**
- * 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;
};
/**
- * 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;
};
/**
- * 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;
/**
- * 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,
/**
* 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;
//@}
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;
/**
- * 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,
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;
//@}
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;
/**
- * 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;
//@}
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;
};
/**
- * 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
{
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);
};
/**
- * 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);
/**
- * 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;
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);
/**
- * 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
{
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);
/**
- * 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]
* 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
* ...
* 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;
* }
* @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");
* }
* @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");
* 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
* 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"
*
* 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.
*
*
*
* 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
* 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
{
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
};
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);
/**
- * 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,
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]
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>
//@}
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);
/**
- * 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:
* }
* @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)
* {
* 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>
*
* <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
* 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
{
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;
};
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 ();
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);
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;
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
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 ();
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;
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);
};
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
#include <deal.II/base/utilities.h>
#include <deal.II/base/memory_consumption.h>
+#include <limits>
DEAL_II_NAMESPACE_OPEN
* 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;
/**
* 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;
/**
* 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;
/**
* 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
* Exception
*/
DeclException2 (ExcIndexNotPresent,
- unsigned int, unsigned int,
+ types::global_dof_index,
+ unsigned int,
<< "Global index " << arg1
<< " neither owned nor ghost on proc " << arg2);
* 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
* 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
* 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
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);
}
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
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;
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;
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;
inline
- const MPI_Comm&
+ const MPI_Comm &
Partitioner::get_communicator() const
{
return communicator;
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
y = offset+step+step-x;
}
else
- {
+ {
const number offset = step * interval;
if (x<offset || x>offset+step)
return 0;
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* $[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.
* 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.
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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);
+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
#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
-//---------------------------------------------------------------------------
-// $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
/**
* 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.
-//---------------------------------------------------------------------------
-// $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
*/
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.
};
//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
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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
*/
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.
*/
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.
*/
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.
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
}
}
+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>
-//---------------------------------------------------------------------------
-// $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
#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
+#include <deal.II/base/table_indices.h>
#include <vector>
#include <cmath>
*/
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.
*/
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.
*/
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
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 <>
}
+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
-//---------------------------------------------------------------------------
-// $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
{
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;
};
+
+
+/*
+ * 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
namespace Threads
{
- template <typename T>
/**
* @brief A class that provides a separate storage location on each thread that accesses the object.
*
* 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:
-//---------------------------------------------------------------------------
-// $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
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,
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>
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>
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,
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,
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,
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,
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,
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,
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,
// 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;
}
// 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);
{
call (function, ret_val);
}
+
/**
* Wait for the task to
* return. Since we are in
-//---------------------------------------------------------------------------
-// $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
/**
* Reference to the TimerOutput object
*/
- dealii::TimerOutput & timer;
+ dealii::TimerOutput &timer;
/**
* Do we still need to exit the section we are in?
*/
inline
TimerOutput::Scope::Scope(dealii::TimerOutput &timer_, const std::string §ion_name)
-:
-timer(timer_), in(true)
+ :
+ timer(timer_), in(true)
{
timer.enter_section(section_name);
}
-//---------------------------------------------------------------------------
-// $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
/**
*/
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);
}
+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
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);
/**
* more information.
*/
const types::subdomain_id artificial_subdomain_id = static_cast<types::subdomain_id>(-2);
-
}
-//---------------------------------------------------------------------------
-// $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
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.
#endif
+
}
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;
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
#include <vector>
#include <utility>
+#include <memory>
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
#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.
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)
+ {}
+ };
/**
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);
+ }
}
/**
// 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;
*/
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
* 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);
}
};
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
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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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.
* 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:
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;
* 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
* 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;
/**
* 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
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
*/
-//---------------------------------------------------------------------------
-// $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
* 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.
* ordering. Filled by
* initialize().
*/
- std::vector<unsigned int> local_renumbering;
+ std::vector<types::global_dof_index> local_renumbering;
};
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];
}
-//---------------------------------------------------------------------------
-// $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
*/
/**
- * 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
* <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>
* 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
* 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;
/**
* @}
* 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>
*/
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
*/
/**
- * 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,
* <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;
/**
* 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
* 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;
/**
* @}
* 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;
/**
*/
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;
/**
*
* 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;
/**
* @}
* 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
-//---------------------------------------------------------------------------
-// $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>
#include <deal.II/grid/tria_iterator.templates.h>
#include <vector>
+#include <limits>
DEAL_II_NAMESPACE_OPEN
*/
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,
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,
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,
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());
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,
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,
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,
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());
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,
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());
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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"));
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 "
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
// 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());
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);
}
}
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,
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,
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
// 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());
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);
}
}
"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;
{
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;
}
}
// 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;
{
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());
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;
}
}
// 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;
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
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)
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
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
{
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);
}
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
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
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 ());
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
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 ());
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);
}
{
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);
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);
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);
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)
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)
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)
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());
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 ());
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 ());
// 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);
}
// 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);
}
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)
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,
->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);
->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);
->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);
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());
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());
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());
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());
}
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;
}
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
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);
}
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)
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);
}
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(),
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);
}
// 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)
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);
//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
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,
//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
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)
//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
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)
//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
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);
}
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);
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);
}
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);
-//---------------------------------------------------------------------------
-// $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
* 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
/**
* 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
*/
-//---------------------------------------------------------------------------
-// $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
* 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.
*
*
* 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
* 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
* 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
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;
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;
* 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
* 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
* @p make_boundary_sparsity_pattern
* function.
*/
- unsigned int
+ types::global_dof_index
n_boundary_dofs (const FunctionMap &boundary_indicators) const;
/**
* indicators under
* consideration.
*/
- unsigned int
+ types::global_dof_index
n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const;
/**
* 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;
/**
* @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.");
/**
* degrees of freedom located at
* vertices.
*/
- std::vector<unsigned int> vertex_dofs;
+ std::vector<types::global_dof_index> vertex_dofs;
*/
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 ();
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
#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 ---------------------------------- */
template <int dim, int spacedim>
inline
-unsigned int
+types::global_dof_index
DoFHandler<dim,spacedim>::n_dofs () const
{
return number_cache.n_global_dofs;
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));
}
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;
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
{
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;
-//---------------------------------------------------------------------------
-// $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
*/
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;
};
*/
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;
};
*/
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;
};
}
-//----------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
-//---------------------------------------------------------------------------
-// $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
* Store the global indices of
* the degrees of freedom.
*/
- std::vector<unsigned int> dofs;
+ std::vector<types::global_dof_index> dofs;
public:
/**
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
* 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,
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
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;
/**
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;
}
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,
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,
-//---------------------------------------------------------------------------
-// $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
* 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
/**
* 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));
*/
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);
*/
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);
*/
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);
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
*/
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
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
* 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);
/**
* @}
* 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);
*/
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);
*/
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);
*/
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);
*/
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,
*/
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> ¢er,
const bool counter);
*/
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);
*/
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);
*/
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);
/**
*/
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);
/**
-//---------------------------------------------------------------------------
-// $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
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);
/**
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);
/**
/**
* 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>
/**
* 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>
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
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>());
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>());
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;
/**
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
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,
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
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.
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);
/**
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
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
// 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;
}
}
-//---------------------------------------------------------------------------
-// $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
-//----------------------------------------------------------------------
-// $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
* processors that may
* participate on this mesh.
*/
- unsigned int n_global_dofs;
+ types::global_dof_index n_global_dofs;
/**
* Number of dofs owned by
* 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
* 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
/**
* 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;
/**
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));
}
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);
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,
// 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);
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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);
/**
* 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
* 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
* 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
* 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
* definition of the
* divergence.
*/
- typedef Tensor<1, spacedim> divergence_type;
+ typedef dealii::Tensor<1, spacedim> divergence_type;
/**
* A structure where for each shape
*/
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;
+ };
+
}
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.
*/
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;
/**
*/
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;
*/
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;
*/
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;
/**
*/
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;
*/
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;
/**
*/
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;
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;
/**
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;
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;
/**
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;
/**
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;
//@}
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
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;
};
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
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)
{
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)
{
// 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];
}
}
+ 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;
+ }
+ }
}
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>
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);
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
{
-//---------------------------------------------------------------------------
-// $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
*/
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);
+ };
}
:
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)
+ {}
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
--- /dev/null
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
-// $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
/**
* 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
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
*/
{
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
*/
{
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;
/**
- * 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
*/
{
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;
/**
- * 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
*/
{
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;
};
/**
- * 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
*/
{
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;
};
/**
- * 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
*/
{
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;
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 ())
{}
{
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());
+ }
}
-//---------------------------------------------------------------------------
-// $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
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
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);
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);
const Point<dim> ¢er,
const double inner_radius,
const double outer_radius,
- const unsigned int n_cells = 0,
+ const size_type n_cells = 0,
bool colorize = false);
/**
const Point<dim> ¢er,
const double inner_radius,
const double outer_radius,
- const unsigned int n_cells = 0,
+ const size_type n_cells = 0,
const bool colorize = false);
const Point<dim> ¢er,
const double inner_radius,
const double outer_radius,
- const unsigned int n_cells = 0,
+ const size_type n_cells = 0,
const bool colorize = false);
/**
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);
* @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,
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);
/**
* @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);
*/
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);
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
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);
};
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
/**
* 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;
/**
* 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).
/**
* Cell labeling (fixed order).
- *
+ *
* The following booleans determine which properties of the cell
* shall be displayed as text in the middle of each cell.
*/
/**
* 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
* 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,
*/
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
/**
- * 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);
/**
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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
* 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.
*
* 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.
*
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;
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;
*/
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;
/*@}*/
/*---------------------------------------*/
*/
DeclException0 (ExcTriangulationNotEmpty);
/**
- * Trying to re-read a grid, an error occured.
+ * Trying to re-read a grid, an error occurred.
*
* @ingroup Exceptions
*/
* 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;
// 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;
-//---------------------------------------------------------------------------
-// $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
#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
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
*/
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
* 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;
* 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;
/**
- * 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
* 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;
/**
/**
* 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;
*/
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
*
* @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
* @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;
* @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;
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;
+
/**
* @}
*/
"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
-//---------------------------------------------------------------------------
-// $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
+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
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
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
}
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
if (pdt == 0)
return false;
else
- return (subdomain != pdt->locally_owned_subdomain());
+ return (this->subdomain_id() != pdt->locally_owned_subdomain());
#endif
}
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
}
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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* = accessor;
* @endcode
*/
- TriaRawIterator (const Accessor &a);
+ explicit TriaRawIterator (const Accessor &a);
/**
* Constructor. Assumes that the
* one.
*/
template <typename OtherAccessor>
- TriaRawIterator (const OtherAccessor &a);
+ explicit TriaRawIterator (const OtherAccessor &a);
/**
* Proper constructor, initialized
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;
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
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));
}
#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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
* 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
/**
* 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
-//----------------------------------------------------------------------
-// $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
* 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
* 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
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;
/**
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;
/*@}*/
* 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
* 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
* @p make_boundary_sparsity_pattern
* function.
*/
- unsigned int
+ types::global_dof_index
n_boundary_dofs (const FunctionMap &boundary_indicators) const;
/**
* indicators under
* consideration.
*/
- unsigned int
+ types::global_dof_index
n_boundary_dofs (const std::set<types::boundary_id> &boundary_indicators) const;
/**
* 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
* 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;
/**
* Exception
*/
DeclException1 (ExcNewNumbersNotConsecutive,
- int,
+ types::global_dof_index,
<< "The given list of new dof indices is not consecutive: "
<< "the index " << arg1 << " does not exist.");
/**
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);
};
/**
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
* 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
* 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
* 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
* 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>);
/**
* 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
* 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;
template <int dim, int spacedim>
inline
- unsigned int
+ types::global_dof_index
DoFHandler<dim,spacedim>::n_dofs () const
{
return number_cache.n_global_dofs;
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;
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;
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 ());
inline
void DoFHandler<dim, spacedim>::MGVertexDoFs::set_index (const unsigned int,
const unsigned int,
- const unsigned int)
+ types::global_dof_index)
{
Assert (false, ExcNotImplemented ());
}
DEAL_II_NAMESPACE_CLOSE
#endif
-
-
-//---------------------------- 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
-//---------------------------------------------------------------------------
-// $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
* 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
* DoFLevel() for detailed
* information.
*/
- std::vector<unsigned int> dofs;
+ std::vector<types::global_dof_index > dofs;
/**
* Set the global index of
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);
/**
* 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,
* 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,
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,
// 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"));
// 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);
}
}
}
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),
// 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"));
// 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)
{
// 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
// 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
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,
// 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"));
// 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;
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"));
// 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"));
// 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);
}
}
}
-//---------------------------- 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
-//---------------------------- 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
-//------------------------ 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
-//---------------------------- 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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]);
+ }
}
}
{
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.
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);
{
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)
{
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);
+ }
}
}
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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
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
// 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;
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);
// 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;
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);
}
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];
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]);
}
}
-//---------------------------------------------------------------------------
-// $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
#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
class BlockIndices : public Subscriptor
{
public:
+ /**
+ * Declare the type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* Default
* 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
* 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
* 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
* 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;
//@}
* 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;
//@}
/**
* value is the total number of
* entries.
*/
- std::vector<unsigned int> start_indices;
+ std::vector<size_type> start_indices;
};
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;
}
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];
}
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);
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;
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;
}
inline
-unsigned int
+BlockIndices::size_type
BlockIndices::total_size () const
{
if (n_blocks == 0) return 0;
inline
-unsigned int
+BlockIndices::size_type
BlockIndices::block_size (const unsigned int block) const
{
Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks));
inline
-unsigned int
+BlockIndices::size_type
BlockIndices::block_start (const unsigned int block) const
{
Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks));
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;
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]);
}
-//---------------------------------------------------------------------------
-// $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
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;
* 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
* <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
* 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
* 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);
* 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;
* 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.
* 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
* 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
/**
* 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:
/**
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);
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())
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())
inline
void
-BlockList::initialize(unsigned int n_blocks)
+BlockList::initialize(size_type n_blocks)
{
index_sets.resize(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);
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);
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);
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);
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());
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))
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
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;
inline
-unsigned int
+BlockList::size_type
BlockList::size() const
{
return index_sets.size();
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();
}
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();
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();
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;
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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()
* 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,
*/
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;
/**
*/
template<class MATRIX>
Entry (const MATRIX &matrix,
- unsigned row, unsigned int col,
+ size_type row, size_type col,
double prefix, bool transpose);
/**
* 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
: private BlockMatrixArray<number>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor creating a
* useless object. initialize()
* 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
*/
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.
* matrix here.
*/
DeclException1(ExcNoDiagonal,
- unsigned int,
+ size_type,
<< "No diagonal entry was added for block " << arg1);
/**
* matrix here.
*/
DeclException1(ExcMultipleDiagonal,
- unsigned int,
+ size_type,
<< "Inverse diagonal entries may not be added in block "
<< arg1);
//@}
* for one row.
*/
void do_row (BlockVector<number> &dst,
- unsigned int row_num) const;
+ size_type row_num) const;
/**
* Flag for backward insertion.
inline
BlockMatrixArray<number>::Entry::Entry (
const MATRIX &m,
- unsigned int row,
- unsigned int col,
+ size_type row,
+ size_type col,
double prefix,
bool transpose)
:
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())
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);
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)
{
-//---------------------------------------------------------------------------
-// $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
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.
public AccessorBase<BlockMatrix>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Type of the matrix used in
* this accessor.
* 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
{
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;
* 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
* 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
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> >
* matrix is of dimension
* $m \times n$.
*/
- unsigned int m () const;
+ size_type m () const;
/**
* Return the dimension of the
* matrix is of dimension
* $m \times n$.
*/
- unsigned int n () const;
+ size_type n () const;
/**
* 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);
/**
* 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
* 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
* 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
* 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
* 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);
/**
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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.
* 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
* 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
* 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
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())
// 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
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,
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,
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
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())
// 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);
{
// 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) +
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) +
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();
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;
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
++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;
}
}
// 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));
template <class MatrixType>
inline
-unsigned int
+typename BlockMatrixBase<MatrixType>::size_type
BlockMatrixBase<MatrixType>::m () const
{
return row_block_indices.total_size();
template <class MatrixType>
inline
-unsigned int
+typename BlockMatrixBase<MatrixType>::size_type
BlockMatrixBase<MatrixType>::n () const
{
return column_block_indices.total_size();
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,
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)
{
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);
}
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)
{
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);
}
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()));
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();
// 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;
#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());
// 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)
{
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)
{
(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,
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);
}
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);
}
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()));
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();
#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,
// 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;
#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());
// 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)
{
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,
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,
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);
}
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));
};
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));
}
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);
}
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),
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));
}
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);
}
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);
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);
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);
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);
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
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
* (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
{
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;
// 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);
-//---------------------------------------------------------------------------
-// $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
// 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;
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));
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;
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);
}
template <typename number>
-unsigned int
+typename BlockSparseMatrix<number>::size_type
BlockSparseMatrix<number>::n_nonzero_elements () const
{
return sparsity_pattern->n_nonzero_elements ();
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;
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,
{
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;
-//---------------------------------------------------------------------------
-// $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
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
* 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
* columns of the columns of
* sub-matrices.
*/
- unsigned int n_cols () const;
+ size_type n_cols () const;
/**
* Return the dimension of the
* matrix is of dimension
* $m \times n$.
*/
- unsigned int m () const;
+ size_type m () const;
/**
* Return the dimension of the
* matrix is of dimension
* $m \times n$.
*/
- unsigned int n () const;
+ size_type n () const;
/**
* Set the element <tt>(i,j)</tt>
* 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);
/**
* 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);
template <typename Number>
inline
-unsigned int
+typename BlockSparseMatrixEZ<Number>::size_type
BlockSparseMatrixEZ<Number>::n_rows () const
{
return row_indices.total_size();
template <typename Number>
inline
-unsigned int
+typename BlockSparseMatrixEZ<Number>::size_type
BlockSparseMatrixEZ<Number>::n_cols () const
{
return column_indices.total_size();
template <typename Number>
inline
-unsigned int
+typename BlockSparseMatrixEZ<Number>::size_type
BlockSparseMatrixEZ<Number>::m () const
{
return n_rows();
template <typename Number>
inline
-unsigned int
+typename BlockSparseMatrixEZ<Number>::size_type
BlockSparseMatrixEZ<Number>::n () const
{
return n_cols();
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,
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,
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));
}
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;
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
<< "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
-//---------------------------------------------------------------------------
-// $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
{
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
-//---------------------------------------------------------------------------
-// $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
* 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)"
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
* 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,
* 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
* 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
* given coordinates.
*/
SparsityPatternBase &
- block (const unsigned int row,
- const unsigned int column);
+ block (const size_type row,
+ const size_type column);
/**
* 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
* 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
* 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.
* 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
* 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
* of the (block-)rows of
* sub-matrices.
*/
- unsigned int n_rows () const;
+ size_type n_rows () const;
/**
* Return number of columns of
* 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
* 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
* 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
/**
* Number of block rows.
*/
- unsigned int rows;
+ size_type rows;
/**
* Number of block columns.
*/
- unsigned int columns;
+ size_type columns;
/**
* Array of sparsity patterns.
* 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
* 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
* 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
* 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
* 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
* <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
* 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
* 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
* <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
* 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
* 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
* <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
* 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
* 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
* 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
* <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
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));
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));
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,
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())
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
// 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
// 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;
}
#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
// 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;
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,
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;
template <class SparsityPatternBase>
inline
-unsigned int
+typename BlockSparsityPatternBase<SparsityPatternBase>::size_type
BlockSparsityPatternBase<SparsityPatternBase>::n_block_cols () const
{
return columns;
template <class SparsityPatternBase>
inline
-unsigned int
+typename BlockSparsityPatternBase<SparsityPatternBase>::size_type
BlockSparsityPatternBase<SparsityPatternBase>::n_block_rows () const
{
return rows;
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());
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);
-//---------------------------------------------------------------------------
-// $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
* 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
* <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
* 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);
* 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);
/**
* 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
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)
{
// 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]));
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);
}
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;
}
-//---------------------------------------------------------------------------
-// $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
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);
}
template <typename Number>
-BlockVector<Number>::BlockVector (const std::vector<unsigned int> &n)
+BlockVector<Number>::BlockVector (const std::vector<size_type> &n)
{
reinit (n, false);
}
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];
}
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();
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);
}
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);
}
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);
}
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);
}
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 << ':';
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);
}
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);
}
-//---------------------------------------------------------------------------
-// $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
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
* const or non-const
* reference.
*/
- Iterator (BlockVector &parent,
- const unsigned int global_index);
+ Iterator (BlockVector &parent,
+ const size_type global_index);
/**
* Copy constructor.
* 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:
* element to which we
* presently point.
*/
- unsigned int global_index;
+ size_type global_index;
/**
* Current block and index
* to.
*/
unsigned int current_block;
- unsigned int index_within_block;
+ size_type index_within_block;
/**
* Indices of the global
* 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.
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
* 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
/**
* 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)
*
* Exactly the same as operator().
*/
- reference operator[] (const unsigned int i);
+ reference operator[] (const size_type i);
/**
* Copy operator: fill all components of
* 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
* 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
* 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
* 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>
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),
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)
// 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;
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;
};
}
// then move the next
// boundary arbitrarily far
// away
- next_break_forward = numbers::invalid_unsigned_int;
+ next_break_forward = numbers::invalid_size_type;
};
++global_index;
// 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;
};
template <class VectorType>
inline
-unsigned int
+std::size_t
BlockVectorBase<VectorType>::size () const
{
return block_indices.total_size();
{
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();
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);
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);
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;
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;
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;
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;
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();
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;
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)
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];
}
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()));
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);
}
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];
}
{
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);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
{
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));
}
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]);
}
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;
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]);
}
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 ();
}
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;
{
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;
{
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;
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;
{
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;
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;
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;
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);
}
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);
}
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);
}
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);
}
-//---------------------------------------------------------------------------
-// $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
* 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
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.
* 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.
* 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
* 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);
/**
* 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);
/**
* 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.
* 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
* 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
* 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);
//@}
/**
*/
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;
/**
*/
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;
/**
* 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;
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;
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;
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;
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)
{
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));
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)
{
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));
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]));
}
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
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
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,
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];
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());
// 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
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();
-//---------------------------------------------------------------------------
-// $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
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;
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;
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;
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)
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;
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)
{
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));
// 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];
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));
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.);
}
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;
// 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)
template <typename number>
-unsigned int
+typename ChunkSparseMatrix<number>::size_type
ChunkSparseMatrix<number>::n_nonzero_elements () const
{
Assert (cols != 0, ExcNotInitialized());
template <typename number>
-unsigned int
+typename ChunkSparseMatrix<number>::size_type
ChunkSparseMatrix<number>::n_actually_nonzero_elements () const
{
Assert (cols != 0, ExcNotInitialized());
// 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],
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],
*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));
}
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++;
}
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
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));
// 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
(*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));
////////////////
// 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
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)
// 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
(*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)
}
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)
// 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
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)
// 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
(*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)
}
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)
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
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 *
// (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
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 +
// 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
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));
// 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
(*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));
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());
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());
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 << ' ';
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;
-//---------------------------------------------------------------------------
-// $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
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.
* 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
* @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;
/**
* @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;
/**
* 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.
* @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;
/**
* 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;
/**
* 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;
/**
* 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]);
*
* 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]);
* 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;
/**
*/
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
*/
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;
/**
*/
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
*/
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;
/**
/**
* 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
*
* 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
* 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
* 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
* 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.
/**
* 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
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())),
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();
}
Assert (is_valid_entry() == true, ExcInvalidIterator());
return sparsity_pattern->get_chunk_size()*reduced_accessor.row() +
- chunk_row;
+ chunk_row;
}
Assert (is_valid_entry() == true, ExcInvalidIterator());
return sparsity_pattern->get_chunk_size()*reduced_accessor.column() +
- chunk_col;
+ chunk_col;
}
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)
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;
inline
-unsigned int
+ChunkSparsityPattern::size_type
ChunkSparsityPattern::n_cols () const
{
return cols;
inline
-unsigned int
+ChunkSparsityPattern::size_type
ChunkSparsityPattern::get_chunk_size () const
{
return chunk_size;
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);
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,
// 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())
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);
-//---------------------------------------------------------------------------
-// $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
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;
/**
* 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
* 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
* 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
* 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
* 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
* 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;
/**
* $(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
* 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
*/
struct Line
{
- std::set<unsigned int> entries;
+ std::set<size_type> entries;
/**
* Constructor.
* 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
inline
void
-CompressedSetSparsityPattern::Line::add (const unsigned int j)
+CompressedSetSparsityPattern::Line::add (const size_type j)
{
entries.insert (j);
}
inline
-unsigned int
+CompressedSetSparsityPattern::size_type
CompressedSetSparsityPattern::n_rows () const
{
return rows;
inline
-unsigned int
+CompressedSetSparsityPattern::size_type
CompressedSetSparsityPattern::n_cols () const
{
return cols;
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);
}
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);
}
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();
}
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 ());
}
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 ());
}
-//---------------------------------------------------------------------------
-// $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
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,
* 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
* 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());
/**
* 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
* 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
* 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
* 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
* 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
* $(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
* 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.
* this row. This array is always
* kept sorted.
*/
- std::vector<unsigned int> entries;
+ std::vector<size_type> entries;
/**
* Constructor.
* 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
/**
* estimates memory consumption.
*/
- std::size_t memory_consumption () const;
+ size_type memory_consumption () const;
};
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)
// 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);
inline
-unsigned int
+CompressedSimpleSparsityPattern::size_type
CompressedSimpleSparsityPattern::n_rows () const
{
return rows;
inline
-unsigned int
+types::global_dof_index
CompressedSimpleSparsityPattern::n_cols () const
{
return cols;
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);
}
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);
}
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();
}
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];
}
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();
}
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();
}
-//---------------------------------------------------------------------------
-// $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
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,
* 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
* 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
* 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
* 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
* 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
* 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
* $(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
* 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
* 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.
* 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
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
inline
-unsigned int
+types::global_dof_index
CompressedSparsityPattern::n_rows () const
{
return rows;
inline
-unsigned int
+types::global_dof_index
CompressedSparsityPattern::n_cols () const
{
return cols;
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);
}
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)
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 ();
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 ();
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 ();
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();
}
-//---------------------------------------------------------------------------
-// $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
//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
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
* 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
* 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
* 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
* 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);
/**
* 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
* @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
* finally merge() them together
* again.
*/
- void shift (const unsigned int offset);
+ void shift (const size_type offset);
/**
* Clear all entries of this
* Return number of constraints stored in
* this matrix.
*/
- unsigned int n_constraints () const;
+ size_type n_constraints () const;
/**
* Return whether the degree of freedom
* 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
* 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
* 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
* 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
* 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
* 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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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;
/**
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
* @ingroup Exceptions
*/
DeclException1 (ExcLineInexistant,
- unsigned int,
+ size_type,
<< "The specified line " << arg1
<< " does not exist.");
/**
* @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 "
* @ingroup Exceptions
*/
DeclException1 (ExcDoFIsConstrainedFromBothObjects,
- int,
+ size_type,
<< "Degree of freedom " << arg1
<< " is constrained from both object in a merge operation.");
/**
* @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"
* @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 "
* @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
<< "with the appropriate locally_relevant set so "
<< "that every processor who owns a DoF that constrains "
<< "another DoF also knows about this constraint?");
-
+
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
* and have to store the line
* number explicitly.
*/
- unsigned int line;
+ size_type line;
/**
* Row numbers and values of the
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
* contributions into vectors and
* matrices.
*/
- std::vector<unsigned int> lines_cache;
+ std::vector<size_type> lines_cache;
/**
* This IndexSet is used to limit the
* 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
* 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
*/
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;
/**
*/
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;
/**
*/
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;
/**
*/
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;
/**
* 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;
/**
* 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;
};
inline
void
-ConstraintMatrix::add_line (const unsigned int line)
+ConstraintMatrix::add_line (const size_type line)
{
Assert (sorted==false, ExcMatrixIsClosed());
// 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
// 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
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,
// 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());
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]];
inline
-unsigned int
+types::global_dof_index
ConstraintMatrix::n_constraints () const
{
return lines.size();
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
{
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;
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;
-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())
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);
}
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());
{
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;
}
{
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;
}
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()));
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;
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
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
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
-//---------------------------------------------------------------------------
-// $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
#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>
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
// 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;
};
// 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
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;
"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>
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
// 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;
};
// 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
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],
// 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() *
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() *
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 *
// 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;
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
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
// 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,
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
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
// 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,
// 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,
// 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);
// 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 ();
}
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();
// 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
// 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
{
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,
// 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
{
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,
{
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 *
// 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);
{
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();
}
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);
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());
- }
}
}
}
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);
}
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
{
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
// 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]];
// 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
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))
// 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))
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
// 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);
// 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]);
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;
}
+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)
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;
}
// 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
// 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
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);
}
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;
}
{
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;
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];
}
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),
// 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 ();
<< "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;
}
// 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;
}
// 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));
// 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;
}
// 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;
// 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;
// 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;
// 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;
}
// 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;
}
// 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],
// 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;
}
// 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(),
++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);
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;
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,
// 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;
}
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,
// 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;
}
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));
}
// 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))
*
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
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.)
// 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);
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.)
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;
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
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),
}
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);
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),
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);
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);
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;
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);
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
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)
// 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;
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,
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);
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)
// 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,
// 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
// 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)
{
}
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);
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)
{
}
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);
// 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);
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 *
}
// 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)])]].
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,
}
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)
// 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);
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;
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);
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 &&
}
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)
{
// 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,
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)
{
// 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(),
// 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]);
// 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);
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;
// 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(),
// 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]);
}
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
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)
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,
}
}
- 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]);
// 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);
-//---------------------------------------------------------------------------
-// $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
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
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
// 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
{
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);
// 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
{
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
public:
class const_iterator;
+ /**
+ * Declare the type of container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Accessor class for iterators
*/
* pointer is sufficient.
*/
Accessor (const FilteredMatrix<VECTOR> *matrix,
- const unsigned int index);
+ const size_type index);
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
/**
* Current row number.
*/
- unsigned int index;
+ size_type index;
/*
* Make enclosing class a
* friend.
* Constructor.
*/
const_iterator(const FilteredMatrix<VECTOR> *matrix,
- const unsigned int index);
+ const size_type index);
/**
* Prefix increment.
* 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
* 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
inline
FilteredMatrix<VECTOR>::Accessor::Accessor(
const FilteredMatrix<VECTOR> *matrix,
- const unsigned int index)
+ const size_type index)
:
matrix(matrix),
index(index)
template<class VECTOR>
inline
-unsigned int
+types::global_dof_index
FilteredMatrix<VECTOR>::Accessor::row() const
{
return matrix->constraints[index].first;
template<class VECTOR>
inline
-unsigned int
+types::global_dof_index
FilteredMatrix<VECTOR>::Accessor::column() const
{
return matrix->constraints[index].first;
inline
FilteredMatrix<VECTOR>::const_iterator::const_iterator(
const FilteredMatrix<VECTOR> *matrix,
- const unsigned int index)
+ const size_type index)
:
accessor(matrix, index)
{}
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));
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(),
-//---------------------------------------------------------------------------
-// $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
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.
* 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.
/**
* Current row number.
*/
- unsigned int a_row;
+ size_type a_row;
/**
* Current column number.
* 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.
* 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
* 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);
/**
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
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
*/
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
*/
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;
/**
*/
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);
/**
*/
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
* @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);
/**
* @}
* 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
* 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
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
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);
/**
* 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);
* 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
* 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);
template <typename number>
inline
-unsigned int
+typename FullMatrix<number>::size_type
FullMatrix<number>::m() const
{
return this->n_rows();
template <typename number>
inline
-unsigned int
+typename FullMatrix<number>::size_type
FullMatrix<number>::n() const
{
return this->n_cols();
// 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();
}
}
// 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();
}
}
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]);
}
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));
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;
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),
template <typename number>
inline
-unsigned int
+typename FullMatrix<number>::size_type
FullMatrix<number>::Accessor::row() const
{
return a_row;
template <typename number>
inline
-unsigned int
+typename FullMatrix<number>::size_type
FullMatrix<number>::Accessor::column() const
{
return a_col;
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)
{}
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);
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);
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());
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];
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;
}
-//---------------------------------------------------------------------------
-// $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
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)
:
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;
}
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;
{
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;
// 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;
}
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++));
};
}
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;
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));
{
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);
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()));
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);
}
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]);
}
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));
}
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;
}
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));
}
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));
}
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));
#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;
}
#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)
{
// 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;
}
#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)
{
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;
}
#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;
}
// 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);
}
}
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;
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;
{
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;
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;
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;
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));
}
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));
}
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));
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()));
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));
}
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()));
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));
}
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));
}
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;
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);
}
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);
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);
};
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);
}
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());
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]);
}
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,
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));
}
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));
}
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) << ' ';
// 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
// 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)
{
// 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]);
// 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;
}
// 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];
}
}
--- /dev/null
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
-// $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
class Householder : private FullMatrix<number>
{
public:
+ /**
+ * Declare type of container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Create an empty object.
*/
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());
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);
// 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)
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();
// 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());
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();
// 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());
-//---------------------------------------------------------------------------
-// $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
class IdentityMatrix
{
public:
+ /**
+ * Declate type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor. Creates a
* zero-sized matrix that should
* 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
* matrix, the number of rows and
* columns are equal, of course.
*/
- unsigned int m () const;
+ size_type m () const;
/**
* Number of columns of this
* matrix, the number of rows and
* columns are equal, of course.
*/
- unsigned int n () const;
+ size_type n () const;
/**
* Matrix-vector
* Number of rows and columns of
* this matrix.
*/
- unsigned int size;
+ size_type size;
};
inline
-IdentityMatrix::IdentityMatrix (const unsigned int n)
+IdentityMatrix::IdentityMatrix (const size_type n)
:
size (n)
{}
inline
void
-IdentityMatrix::reinit (const unsigned int n)
+IdentityMatrix::reinit (const size_type n)
{
size = n;
}
inline
-unsigned int
+IdentityMatrix::size_type
IdentityMatrix::m () const
{
return size;
inline
-unsigned int
+IdentityMatrix::size_type
IdentityMatrix::n () const
{
return size;
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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
* 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
*/
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);
* called.
*/
std::complex<number>
- eigenvalue (const unsigned int i) const;
+ eigenvalue (const size_type i) const;
/**
* Retrieve singular values after
* called.
*/
number
- singular_value (const unsigned int i) const;
+ singular_value (const size_type i) const;
/**
* Print the matrix and allow
// 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();
}
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();
}
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());
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());
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
+// ---------------------------------------------------------------------
+// $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
-//---------------------------------------------------------------------------
-// $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
* 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
*
* 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
*
: public Subscriptor
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Constructor rendering an
* uninitialized object.
* 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.
*
* 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);
/**
* 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
* 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);
* 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
* 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,
* 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);
/**
* 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
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.
*/
* 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
* 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
: public Subscriptor
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* The type of object stored.
*/
* 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
* 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.
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)
{}
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)
{}
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));
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());
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);
}
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
//#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));
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());
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);
}
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());
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));
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);
}
}
else
{
- for (unsigned int i=0; i<this->size(); ++i)
+ for (size_type i=0; i<this->size(); ++i)
matrix(i).clear();
}
}
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);
}
template <class MATRIX>
inline MatrixBlock<MATRIX> &
-MatrixBlockVector<MATRIX>::block(unsigned int i)
+MatrixBlockVector<MATRIX>::block(size_type i)
{
return *(*this)(i);
}
template <class MATRIX>
inline MATRIX &
-MatrixBlockVector<MATRIX>::matrix(unsigned int i)
+MatrixBlockVector<MATRIX>::matrix(size_type i)
{
return (*this)(i)->matrix;
}
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);
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);
}
template <class MATRIX>
inline MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block(unsigned int i)
+MGMatrixBlockVector<MATRIX>::block(size_type i)
{
return matrices(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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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;
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;
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;
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();
}
}
-//---------------------------------------------------------------------------
-// $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
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
* <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
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)
{}
-//---------------------------------------------------------------------------
-// $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
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.
/**
* Component for filtering block vectors.
*/
- unsigned int component;
+ size_type component;
};
-//---------------------------------------------------------------------------
-// $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
{
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;
}
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;
}
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;
}
-//---------------------------------------------------------------------------
-// $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
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
*
* Default value is one.
*/
- unsigned int block_size;
+ size_type block_size;
/**
* If true, plot
* 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);
};
/**
*/
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
*/
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
*/
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
*/
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);
};
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);
}
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);
}
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);
}
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
// 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));
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)),
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
-//---------------------------------------------------------------------------
-// $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
* 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
* 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.
*
* 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);
/**
* 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
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);
}
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);
}
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];
}
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);
}
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();
}
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);
}
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);
}
-//---------------------------------------------------------------------------
-// $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
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;
/**
* 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
* 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
* 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
/**
* 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
* 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
* 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
*
* 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
*
* 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
*
* 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
*
* Performance: Direct array access (fast).
*/
- Number &local_element (const unsigned int local_index);
+ Number &local_element (const size_type local_index);
//@}
* 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);
/**
* 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);
/**
* 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);
/**
* 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
/**
* 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.
/**
* 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.
template <typename Number>
inline
- Vector<Number>::Vector (const unsigned int size)
+ Vector<Number>::Vector (const size_type size)
:
allocated_size (0),
val (0),
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)
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)
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;
}
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;
}
template <typename Number>
inline
- types::global_dof_index Vector<Number>::size () const
+ typename Vector<Number>::size_type
+ Vector<Number>::size () const
{
return partitioner->size();
}
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();
}
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();
}
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
template <typename Number>
inline
- unsigned int
+ typename Vector<Number>::size_type
Vector<Number>::n_ghost_entries () const
{
return partitioner->n_ghost_indices();
+ 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);
}
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)];
}
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)];
}
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);
}
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);
}
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()+
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()+
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());
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());
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)"));
template <typename Number>
inline
- const MPI_Comm&
+ const MPI_Comm &
Vector<Number>::get_mpi_communicator() const
{
return partitioner->get_communicator();
-//----------%-----------------------------------------------------------------
-// $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
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
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)
{
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
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);
}
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);
// 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;
// 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
// 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),
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),
{
#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
// 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,
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
// 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());
// 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
{
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
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),
{
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);
}
// 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());
-//---------------------------------------------------------------------------
-// $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
* 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
{
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;
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
* 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
* 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);
/**
* 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
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
inline
BlockVector::BlockVector (const unsigned int n_blocks,
- const unsigned int block_size)
+ const size_type block_size)
{
reinit (n_blocks, block_size);
}
inline
- BlockVector::BlockVector (const std::vector<unsigned int> &n)
+ BlockVector::BlockVector (const std::vector<size_type> &n)
{
reinit (n, false);
}
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
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());
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);
}
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())
+ inline
+ void
+ BlockVector::reinit (const unsigned int num_blocks)
+ {
+ reinit (num_blocks, 0, true);
+ }
+
+
+
inline
void
BlockVector::swap (BlockVector &v)
-//---------------------------------------------------------------------------
-// $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
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
-//---------------------------------------------------------------------------
-// $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
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.
/**
* 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
* 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
};
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.
*/
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.
* 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);
/**
* <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
* 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
* <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
* <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
* 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);
/**
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* exactly are stored locally,
* use local_range().
*/
- unsigned int local_size () const;
+ size_type local_size () const;
/**
* Return a pair of indices
* 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;
/**
* 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
* 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
* diagonal entries in the
* matrix.
*/
- PetscReal trace () const;
+ PetscScalar trace () const;
#endif
/**
* 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:
* 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
* 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
*/
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.
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
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),
inline
- unsigned int
+ const_iterator::Accessor::size_type
const_iterator::Accessor::row() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
inline
- unsigned int
+ const_iterator::Accessor::size_type
const_iterator::Accessor::column() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
inline
- unsigned int
+ const_iterator::Accessor::size_type
const_iterator::Accessor::index() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
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)
{}
// 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());
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);
}
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);
}
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()));
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);
}
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());
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());
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);
}
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);
}
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()));
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);
}
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());
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);
}
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)
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);
inline
bool
- MatrixBase::in_local_range (const unsigned int index) const
+ MatrixBase::in_local_range (const size_type index) const
{
PetscInt begin, end;
&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)));
}
-//---------------------------------------------------------------------------
-// $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
* 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
-//---------------------------------------------------------------------------
-// $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
# 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>
* 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:
{
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;
-//---------------------------------------------------------------------------
-// $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
*/
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
* <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,
explicit BlockVector (const std::vector<IndexSet> ¶llel_partitioning,
const MPI_Comm &communicator = MPI_COMM_WORLD);
+ /**
+ * Same as above, but include ghost elements
+ */
+ BlockVector (const std::vector<IndexSet> ¶llel_partitioning,
+ const std::vector<IndexSet> &ghost_indices,
+ const MPI_Comm &communicator);
+
+
+
/**
* Destructor. Clears memory
*/
*/
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);
/**
* 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
void reinit (const std::vector<IndexSet> ¶llel_partitioning,
const MPI_Comm &communicator);
+ /**
+ * Same as above but include ghost entries.
+ */
+ void reinit (const std::vector<IndexSet> ¶llel_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
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);
}
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);
}
inline
BlockVector::BlockVector (const std::vector<IndexSet> ¶llel_partitioning,
- const MPI_Comm &communicator)
+ const MPI_Comm &communicator)
{
reinit(parallel_partitioning, communicator);
}
+ inline
+ BlockVector::BlockVector (const std::vector<IndexSet> ¶llel_partitioning,
+ const std::vector<IndexSet> &ghost_indices,
+ const MPI_Comm &communicator)
+ {
+ reinit(parallel_partitioning, ghost_indices, communicator);
+ }
inline
BlockVector &
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);
}
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())
inline
void
BlockVector::reinit (const std::vector<IndexSet> ¶llel_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();
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> ¶llel_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 &
-//---------------------------------------------------------------------------
-// $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
class SparseMatrix : public MatrixBase
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* A structure that describes some of
* 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
* 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
* 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
*/
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
* 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
* 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
* 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
* 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
-//---------------------------------------------------------------------------
-// $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
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
*/
static const bool supports_distributed_data = true;
- /**
- * Default constructor. Initialize the
- * vector as empty.
- */
+ /**
+ * Default constructor. Initialize the
+ * vector as empty.
+ */
Vector ();
/**
* 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);
/**
* 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);
/**
*/
explicit Vector (const MPI_Comm &communicator,
const VectorBase &v,
- const unsigned int local_size);
+ const size_type local_size);
/**
*/
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
* 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
*/
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
* 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
* 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);
* 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);
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)
{
// 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);
-//---------------------------------------------------------------------------
-// $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
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>
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
* 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
* 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
* 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
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
* 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.
-//---------------------------------------------------------------------------
-// $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
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
* 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
* 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
* size of the vector to be
* created.
*/
- void create_vector (const unsigned int n);
+ void create_vector (const size_type n);
};
/*@}*/
// 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);
-//---------------------------------------------------------------------------
-// $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
*/
class VectorReference
{
+ public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
private:
/**
* Constructor. It is made private so
* 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
* Index of the referenced element of
* the vector.
*/
- const unsigned int index;
+ const size_type index;
/**
* Make the vector class a friend, so
*/
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;
* Return the global dimension of the
* vector.
*/
- unsigned int size () const;
+ size_type size () const;
/**
* Return the local dimension of the
* exactly are stored locally,
* use local_range().
*/
- unsigned int local_size () const;
+ size_type local_size () const;
/**
* Return a pair of indices
* 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;
/**
* 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
* 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
* Exactly the same as operator().
*/
reference
- operator [] (const unsigned int index);
+ operator [] (const size_type index);
/**
* Provide read-only access to an
* Exactly the same as operator().
*/
PetscScalar
- operator [] (const unsigned int index) const;
+ operator [] (const size_type index) const;
/**
* A collective set operation: instead
* 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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
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;
* @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);
};
{
inline
VectorReference::VectorReference (const VectorBase &vector,
- const unsigned int index)
+ const size_type index)
:
vector (vector),
index (index)
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)));
}
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;
}
inline
internal::VectorReference
- VectorBase::operator () (const unsigned int index)
+ VectorBase::operator () (const size_type index)
{
return internal::VectorReference (*this, index);
}
inline
PetscScalar
- VectorBase::operator () (const unsigned int index) const
+ VectorBase::operator () (const size_type index) const
{
return static_cast<PetscScalar>(internal::VectorReference (*this, index));
}
inline
internal::VectorReference
- VectorBase::operator [] (const unsigned int index)
+ VectorBase::operator [] (const size_type index)
{
return operator()(index);
}
inline
PetscScalar
- VectorBase::operator [] (const unsigned int index) const
+ VectorBase::operator [] (const size_type index) const
{
return operator()(index);
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
class PreconditionIdentity : public Subscriptor
{
public:
-
/**
* This function is only
* present to
class PreconditionSSOR : public PreconditionRelaxation<MATRIX>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* A typedef to the base class.
class PreconditionPSOR : public PreconditionRelaxation<MATRIX>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Initialize matrix and
* relaxation parameter. The
* 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());
/**
* 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;
};
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.
// 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;
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 ¶meters)
{
permutation = &p;
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,
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]);
}
}
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]);
// 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();
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);
// 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
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;
-//---------------------------------------------------------------------------
-// $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
typedef inverse_type value_type;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Parameters for block preconditioners.
*/
* 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);
/**
* Block size.
*/
- unsigned int block_size;
+ size_type block_size;
/**
* Invert diagonal during initialization.
* 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);
/**
* 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
* 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
* 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
/**
* Return the size of the blocks.
*/
- unsigned int block_size () const;
+ size_type block_size () const;
/**
* @deprecated Use size()
* diagonal block is assumed to
* be of the same size.
*/
- unsigned int blocksize;
+ size_type blocksize;
/**
* Pointer to the matrix. Make
/**
* 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.
typedef typename MATRIX::value_type number;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* STL conforming iterator.
*/
* 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.
* 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.
* Constructor.
*/
const_iterator(const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix,
- const unsigned int row);
+ const size_type row);
/**
* Prefix increment.
* 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:
protected PreconditionBlock<MATRIX, inverse_type>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor.
*/
private PreconditionBlockSOR<MATRIX, inverse_type>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Define number type of matrix.
*/
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)
{
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),
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();
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(),
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(),
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)
{}
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);
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);
-//---------------------------------------------------------------------------
-// $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
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)
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());
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);
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());
{
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);
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);
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();
// 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
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';
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
// 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);
{
--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)
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,
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;
}
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);
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);
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();
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()));
// 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())
{
++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);
}
// 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
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;
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
// 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)
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,
// 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);
}
// 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);
}
-//---------------------------------------------------------------------------
-// $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
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
* 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);
/**
* 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
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;
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)
{
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)
{
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];
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];
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];
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());
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());
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());
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());
template <typename number>
inline
FullMatrix<number> &
-PreconditionBlockBase<number>::diagonal(unsigned int i)
+PreconditionBlockBase<number>::diagonal(size_type i)
{
Assert(store_diagonals(), ExcDiagonalsNotStored());
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);
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;
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
typedef inverse_type value_type;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Parameters for block relaxation methods.
*/
* 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
-//---------------------------------------------------------------------------
-// $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
}
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
// 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();
}
}
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)
? (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());
// 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);
}
}
-//---------------------------------------------------------------------------
-// $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
/**
* Optional signature of the @p u-vector.
*/
- std::vector<unsigned int> signature;
+ std::vector<types::global_dof_index> signature;
/**
* Switch for debugging information.
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),
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
class SolverBase
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* Constructor. Takes the MPI communicator over which parallel
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
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
* deal.II's own SolverControl objects to see if convergence has
* been reached.
*/
- void
+ void
get_solver_state (const SolverControl::State state);
/**
*/
void
get_eigenpair (const unsigned int index,
- double &eigenvalues,
+ PetscScalar &eigenvalues,
PETScWrappers::VectorBase &eigenvectors);
/**
* 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:
// 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]);
+ }
}
-//---------------------------------------------------------------------------
-// $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
* <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
* 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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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.
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)
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)
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;
}
-//---------------------------------------------------------------------------
-// $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
-//---------------------------- 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
precondition.vmult(vv,p);
}
else
- {
+ {
precondition.vmult(p, tmp_vectors[inner_iteration]);
A.vmult(vv,p);
};
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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
* <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
* available after invocation of
* decompose().
*/
- std::vector<const unsigned int *> prebuilt_lower_bound;
+ std::vector<const size_type *> prebuilt_lower_bound;
private:
/**
inline number
SparseLUDecomposition<number>::
get_strengthen_diagonal(const number /*rowsum*/,
- const unsigned int /*row*/) const
+ const size_type /*row*/) const
{
return strengthen_diagonal;
}
-//---------------------------------------------------------------------------
-// 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
{
decomposed = false;
- std::vector<const unsigned int *> tmp;
+ std::vector<const size_type *> tmp;
tmp.swap (prebuilt_lower_bound);
SparseMatrix<number>::clear();
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);
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);
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);
}
}
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))
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
-//---------------------------------------------------------------------------
-// $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
DEAL_II_NAMESPACE_OPEN
-
-
/**
* This class provides an interface to the sparse direct solver
* UMFPACK (see <a
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.
/**
* @{
*/
-
+
/**
* This function does nothing. It is only here to provide a interface
* consistent with other sparse direct solvers.
/**
* @{
*/
-
+
/**
* 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).
* 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;
+
/**
* @}
*/
* 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.
*/
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
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:
/**
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
bool initialize_called;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* Constructor
-//---------------------------------------------------------------------------
-// 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
class SparseILU : public SparseLUDecomposition<number>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Constructor. Does nothing.
*
-//---------------------------------------------------------------------------
-// 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
// 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.
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];
}
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;
}
}
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:
// 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;
}
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.
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:
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.
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;
}
// 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;
}
}
-//---------------------------------------------------------------------------
-// $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
#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
template <typename Matrix> class BlockMatrixBase;
template <typename number> class SparseILU;
-
#ifdef DEAL_II_WITH_TRILINOS
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;
* @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.
/**
* Constructor.
*/
- Accessor (MatrixType *matrix,
- const unsigned int row,
- const unsigned int index);
+ Accessor (MatrixType *matrix,
+ const size_type row,
+ const size_type index);
/**
* Constructor.
* @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
/**
* 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:
/**
* @<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.
*/
* 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
* 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
*/
std::size_t memory_consumption () const;
+ /**
+ * Dummy function for compatibility with distributed, parallel matrices.
+ */
+ void compress (::dealii::VectorOperation::values);
+
//@}
/**
* @name Modifying entries
* 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);
/**
* 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);
* 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
* 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
* 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);
/**
* 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
* 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
* 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
* 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.
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
* 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
* 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
* 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
*
* @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
*
* @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;
//@}
/**
*/
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;
/**
*/
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;
/**
* 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
* 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
* 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
* 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
//@{
/**
- * 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
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;
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;
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
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);
}
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);
}
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()));
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
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);
}
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);
}
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()));
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,
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];
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());
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());
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),
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(),
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(),
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();
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),
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),
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)
{}
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;
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()));
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()));
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()));
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()));
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;
}
-//---------------------------------------------------------------------------
-// $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
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.);
}
{
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));
// 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)
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;
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);
template <typename number>
-unsigned int
+typename SparseMatrix<number>::size_type
SparseMatrix<number>::n_nonzero_elements () const
{
Assert (cols != 0, ExcNotInitialized());
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;
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))
*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));
}
{
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());
// 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
// then copy everything in one swoop
this->set(row,
- colnum_cache,
- value_cache);
+ colnum_cache,
+ value_cache);
}
return *this;
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++;
}
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]];
*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]];
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());
// 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())
// 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));
}
// 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;
}
// 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;
}
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;
// 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());
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));
// 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());
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());
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);
}
}
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);
}
}
*/
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);
}
*/
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);
}
// 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.
// 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);
// 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
&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);
// 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.
// 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);
// 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;
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
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);
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();
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]];
// 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);
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);
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
// 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];
}
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
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 =
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
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;
// 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
// 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)
&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
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
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());
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);
}
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]);
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());
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);
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());
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);
}
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]);
}
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]);
}
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);
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());
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 << ' ';
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)
}
+template <typename number>
+void
+SparseMatrix<number>::compress (::dealii::VectorOperation::values)
+{}
+
template <typename number>
std::size_t
-//---------------------------------------------------------------------------
-// $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
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
* 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.
/**
* Non-existent column number.
*/
- static const unsigned int invalid = numbers::invalid_unsigned_int;
+ static const size_type invalid = numbers::invalid_size_type;
};
/**
/**
* 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.
* pointer is sufficient.
*/
Accessor (const SparseMatrixEZ<number> *matrix,
- const unsigned int row,
+ const size_type row,
const unsigned short index);
/**
* represented by this
* object.
*/
- unsigned int row() const;
+ size_type row() const;
/**
* Index in row of the element
* element represented by
* this object.
*/
- unsigned int column() const;
+ size_type column() const;
/**
* Value of this matrix entry.
/**
* Current row number.
*/
- unsigned int a_row;
+ size_type a_row;
/**
* Current index in row.
* Constructor.
*/
const_iterator(const SparseMatrixEZ<number> *matrix,
- const unsigned int row,
+ const size_type row,
const unsigned short index);
/**
* 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);
/**
* 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
* matrix is of dimension
* $m \times n$.
*/
- unsigned int m () const;
+ size_type m () const;
/**
* Return the dimension of 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.
*/
- unsigned int n_nonzero_elements () const;
+ size_type n_nonzero_elements () const;
/**
* Determine an estimate for the
* 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;
//@}
/**
* 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);
/**
* 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);
/**
* 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
* 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);
* 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
* 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
* 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
* 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
* 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
* 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
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
*/
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;
/**
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;
/**
* used to check vector
* dimensions only.
*/
- unsigned int n_columns;
+ size_type n_columns;
/**
* Info structure for each row.
template <typename number>
inline
-SparseMatrixEZ<number>::Entry::Entry(unsigned int column,
+SparseMatrixEZ<number>::Entry::Entry(size_type column,
const number &value)
:
column(column),
template <typename number>
inline
-SparseMatrixEZ<number>::RowInfo::RowInfo(unsigned int start)
+SparseMatrixEZ<number>::RowInfo::RowInfo(size_type start)
:
start(start),
length(0),
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),
template <typename number>
inline
-unsigned int
+typename SparseMatrixEZ<number>::size_type
SparseMatrixEZ<number>::const_iterator::Accessor::row() const
{
return a_row;
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;
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)
//---------------------------------------------------------------------------
template <typename number>
inline
-unsigned int SparseMatrixEZ<number>::m () const
+typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::m () const
{
return row_info.size();
}
template <typename number>
inline
-unsigned int SparseMatrixEZ<number>::n () const
+typename SparseMatrixEZ<number>::size_type SparseMatrixEZ<number>::n () const
{
return n_columns;
}
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)
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);
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.
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;
}
}
// 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
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)
{
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)
{
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));
}
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));
}
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]);
}
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]);
}
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)
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)
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);
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);
// 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());
}
// 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());
}
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);
// 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()])
// 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()]);
{
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;
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);
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]
-//---------------------------------------------------------------------------
-// $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
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);
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();
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;
}
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
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
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
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;
}
}
{
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;
{
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;
{
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;
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;
{
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;
}
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;
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();
// Add up entries actually used
used = 0;
- unsigned int max_length = 0;
+ size_type max_length = 0;
for (; row != endrow ; ++ row)
{
used += row->length;
}
// 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)
-//---------------------------------------------------------------------------
-// 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
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
* Compute the row-th "inner
* sum".
*/
- number get_rowsum (const unsigned int row) const;
+ number get_rowsum (const size_type row) const;
};
/*@}*/
-//---------------------------------------------------------------------------
-// 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
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;
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());
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
}
// 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
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];
-//---------------------------------------------------------------------------
-// $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
class SparseVanka
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Constructor. Gets the matrix
* for preconditioning and a bit
* 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
* 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
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
-//---------------------------------------------------------------------------
-// $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
#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
// 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;
};
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
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);
}
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
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
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
// 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);
// 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
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))
{
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;
{
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
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;
// 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
// 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)];
};
// 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;
// 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)
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;
}
-//---------------------------------------------------------------------------
-// $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
{
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
* 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
* <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);
}
}
// 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
* 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.
* 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
* 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
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.
* @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
* 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
* @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;
* @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);
/**
* @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;
* @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);
/**
* 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);
/**
* @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;
* @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);
/**
* 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.
* @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;
* 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);
/**
* @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;
* 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);
/**
* @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);
/**
* 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;
* 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);
*
* 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
* 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);
// @}
/**
* 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
* 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>.
* @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
* @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;
// @}
/**
* 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
* 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
* 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.
* 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
* 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
* 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.
* 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
* 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;
// @}
* 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
* 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
* <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.
* 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.
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)
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);
inline
- unsigned int
+ size_type
Accessor::column() const
{
Assert (is_valid_entry() == true, ExcInvalidIterator());
inline
- unsigned int
+ size_type
Accessor::index() const
{
Assert (is_valid_entry() == true, ExcInvalidIterator());
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)
{}
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]);
}
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]);
}
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]];
}
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;
inline
-unsigned int
+SparsityPattern::size_type
SparsityPattern::n_cols () const
{
return cols;
inline
-const unsigned int *
+const SparsityPattern::size_type *
SparsityPattern::get_column_numbers () const
{
return colnums;
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];
inline
-std::size_t
+SparsityPattern::size_type
SparsityPattern::n_nonzero_elements () const
{
Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject());
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);
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;
{
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;
}
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;
}
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;
}
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)
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,
//
// 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));
-//---------------------------------------------------------------------------
-// $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
*/
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
*/
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
*/
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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
class TridiagonalMatrix
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* @name Constructors and initalization.
*/
* empty matrix of dimension
* <tt>n</tt>.
*/
- TridiagonalMatrix(unsigned int n = 0,
+ TridiagonalMatrix(size_type n = 0,
bool symmetric = false);
/**
* to zero. The symmetry
* properties may be set as well.
*/
- void reinit(unsigned int n,
+ void reinit(size_type n,
bool symmetric = false);
* 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
* 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
* 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
* compute_eigenvalues(), you can
* access each eigenvalue here.
*/
- number eigenvalue(const unsigned int i) const;
+ number eigenvalue(const size_type i) const;
//@}
///@name Miscellanea
//@{
#ifndef DOXYGEN
template<typename number>
-unsigned int
+types::global_dof_index
TridiagonalMatrix<number>::m() const
{
return diagonal.size();
template<typename number>
-unsigned int
+types::global_dof_index
TridiagonalMatrix<number>::n() const
{
return diagonal.size();
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()));
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()));
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);
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
{
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;
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;
-//---------------------------------------------------------------------------
-// $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
* 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
*
* References BlockVector.reinit().
*/
- explicit BlockVector (const std::vector<unsigned int> &N);
+ explicit BlockVector (const std::vector<size_type> &N);
/**
* Constructor. Set the number of
* 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
* 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);
* 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
inline
- BlockVector::BlockVector (const std::vector<unsigned int> &N)
+ BlockVector::BlockVector (const std::vector<size_type> &N)
{
reinit (N);
}
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());
inline
- BlockVector::BlockVector (const unsigned int num_blocks)
+ BlockVector::BlockVector (const size_type num_blocks)
{
reinit (num_blocks);
}
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];
}
{
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();
-//---------------------------------------------------------------------------
-// $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
* processes.
*/
explicit BlockVector (const std::vector<IndexSet> ¶llel_partitioning,
- const MPI_Comm &communicator = MPI_COMM_WORLD);
+ const MPI_Comm &communicator = MPI_COMM_WORLD);
/**
* Copy-Constructor. Set all the
* 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
void reinit (const std::vector<IndexSet> ¶llel_partitioning,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const bool fast = false);
+ /**
+ * like above, but with a second set of indices for
+ * ghost entries.
+ */
+ void reinit (const std::vector<IndexSet> &partitioning,
+ const std::vector<IndexSet> &ghost_values,
+ const MPI_Comm &communicator = MPI_COMM_WORLD);
+
/**
* Change the dimension to that
* 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
inline
- BlockVector::BlockVector (const unsigned int num_blocks)
+ BlockVector::BlockVector (const size_type num_blocks)
{
reinit (num_blocks);
}
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];
}
{
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();
-//---------------------------------------------------------------------------
-// $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
class PreconditionBase : public Subscriptor
{
public:
+ /**
+ * Declare the type for container size.
+ */
+ typedef dealii::types::global_dof_index size_type;
/**
* Standardized data struct to
* Prints an estimate of the memory
* consumption of this class.
*/
- std::size_t memory_consumption () const;
+ size_type memory_consumption () const;
private:
/**
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());
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());
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());
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());
-//---------------------------------------------------------------------------
-// $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
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
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.
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,
-//---------------------------------------------------------------------------
-// $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
* 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
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:
/**
/**
* 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
* 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
* 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
* 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.
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
* 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
* Exception
*/
DeclException2 (ExcInvalidIndexWithinRow,
- int, int,
+ size_type, size_type,
<< "Attempt to access element " << arg2
<< " of row " << arg1
<< " which doesn't have that many elements.");
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
* 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);
/**
* 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);
/**
* memory prior to use (in the
* compress() step).
*/
- SparseMatrix (const Epetra_Map ¶llel_partitioning,
- const unsigned int n_max_entries_per_row = 0);
+ SparseMatrix (const Epetra_Map ¶llel_partitioning,
+ const size_type n_max_entries_per_row = 0);
/**
* Same as before, but now set a
* 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
* memory prior to use (in the
* compress() step).
*/
- SparseMatrix (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator = MPI_COMM_WORLD,
- const unsigned int n_max_entries_per_row = 0);
+ SparseMatrix (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator = MPI_COMM_WORLD,
+ const unsigned int n_max_entries_per_row = 0);
/**
* Same as before, but now set the
* 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
* 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
* where
* <tt>n=local_size()</tt>.
*/
- std::pair<unsigned int, unsigned int>
+ std::pair<size_type, size_type>
local_range () const;
/**
* 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,
* returned in case this is called in
* an MPI-based program.
*/
- std::size_t memory_consumption () const;
+ size_type memory_consumption () const;
//@}
/**
* 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);
/**
* <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);
* 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);
* <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);
* <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);
* <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);
/**
* 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);
* 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);
* 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);
* 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);
* 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);
/**
* 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
* 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
* 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
* 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;
//@}
/**
* 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
* 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
* 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
* the end iterator for the
* last row of a matrix.
*/
- iterator end (const unsigned int r);
+ iterator end (const size_type r);
//@}
/**
* Exception
*/
DeclException2 (ExcInvalidIndex,
- int, int,
+ size_type, size_type,
<< "The entry with index <" << arg1 << ',' << arg2
<< "> does not exist.");
* 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 "
* 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"
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),
inline
- unsigned int
+ AccessorBase::size_type
AccessorBase::row() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
inline
- unsigned int
+ AccessorBase::size_type
AccessorBase::column() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
inline
- unsigned int
+ AccessorBase::size_type
AccessorBase::index() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
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)
{}
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)
{}
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)
{}
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)
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);
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)
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);
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)));
}
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));
// 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)
{
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)
{
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);
}
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)
{
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);
}
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)
{
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)
{
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
// 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
}
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());
}
}
- Assert(n_columns <= (int)n_cols, ExcInternalError());
+ Assert(n_columns <= (TrilinosWrappers::types::int_type)n_cols, ExcInternalError());
}
// 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
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);
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);
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());
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)
{
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);
}
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)
{
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);
}
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)
{
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*/)
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
}
}
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(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,
// 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);
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,
// 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
}
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);
}
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
}
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;
}
}
}
{
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);
}
-
+
template <typename VectorType>
inline
void
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);
-//---------------------------------------------------------------------------
-// $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
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
* 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
/**
* 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
* 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
class Iterator
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef dealii::types::global_dof_index size_type;
/**
* Constructor. Create an
* 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.
* Exception
*/
DeclException2 (ExcInvalidIndexWithinRow,
- int, int,
+ size_type, size_type,
<< "Attempt to access element " << arg2
<< " of row " << arg1
<< " which doesn't have that many elements.");
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef dealii::types::global_dof_index size_type;
+
/**
* Declare a typedef for the
* iterator class.
* 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
* 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
* 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
* 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
* increases the performance when
* creating the sparsity pattern.
*/
- SparsityPattern (const Epetra_Map ¶llel_partitioning,
- const unsigned int n_entries_per_row = 0);
+ SparsityPattern (const Epetra_Map ¶llel_partitioning,
+ const size_type n_entries_per_row = 0);
/**
* Same as before, but now use the
* sparsity pattern is designed to
* describe.
*/
- SparsityPattern (const Epetra_Map ¶llel_partitioning,
- const std::vector<unsigned int> &n_entries_per_row);
+ SparsityPattern (const Epetra_Map ¶llel_partitioning,
+ const std::vector<size_type> &n_entries_per_row);
/**
* This constructor is similar to the
*/
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
* 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
* add() function.
*/
void
- reinit (const Epetra_Map ¶llel_partitioning,
- const unsigned int n_entries_per_row = 0);
+ reinit (const Epetra_Map ¶llel_partitioning,
+ const size_type n_entries_per_row = 0);
/**
* Same as before, but now use the
* designed to describe.
*/
void
- reinit (const Epetra_Map ¶llel_partitioning,
- const std::vector<unsigned int> &n_entries_per_row);
+ reinit (const Epetra_Map ¶llel_partitioning,
+ const std::vector<size_type> &n_entries_per_row);
/**
* This reinit function is similar to
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
* 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
* increases the performance when
* creating the sparsity pattern.
*/
- SparsityPattern (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator = MPI_COMM_WORLD,
- const unsigned int n_entries_per_row = 0);
+ SparsityPattern (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator = MPI_COMM_WORLD,
+ const size_type n_entries_per_row = 0);
/**
* Same as before, but now use the
*/
SparsityPattern (const IndexSet ¶llel_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
* 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
* 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
* add() function.
*/
void
- reinit (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator = MPI_COMM_WORLD,
- const unsigned int n_entries_per_row = 0);
+ reinit (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator = MPI_COMM_WORLD,
+ const size_type n_entries_per_row = 0);
/**
* Same as before, but now use the
* designed to describe.
*/
void
- reinit (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator,
- const std::vector<unsigned int> &n_entries_per_row);
+ reinit (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator,
+ const std::vector<size_type> &n_entries_per_row);
/**
* This reinit function is similar to
* <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
* 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
* 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
* 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;
/**
* 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
* 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
* 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
* 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);
/**
* 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
* 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
* 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;
//@}
/**
* Exception
*/
DeclException2 (ExcInvalidIndex,
- int, int,
+ size_type, size_type,
<< "The entry with index <" << arg1 << ',' << arg2
<< "> does not exist.");
* 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 "
* 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"
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),
inline
- unsigned int
+ Accessor::size_type
Accessor::row() const
{
Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
inline
- unsigned int
+ Accessor::size_type
Accessor::column() const
{
Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
inline
- unsigned int
+ Accessor::size_type
Accessor::index() const
{
Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
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)
{}
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
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);
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)));
}
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);
}
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));
inline
- SparsityPattern::SparsityPattern (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator,
- const unsigned int n_entries_per_row)
+ SparsityPattern::SparsityPattern (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator,
+ const size_type n_entries_per_row)
:
compressed (false)
{
inline
SparsityPattern::SparsityPattern (const IndexSet ¶llel_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)
{
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)
{
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)
{
inline
void
- SparsityPattern::reinit (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator,
- const unsigned int n_entries_per_row)
+ SparsityPattern::reinit (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator,
+ const size_type n_entries_per_row)
{
Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator,
false);
inline
void SparsityPattern::reinit (const IndexSet ¶llel_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);
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);
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);
-//---------------------------------------------------------------------------
-// $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
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
* @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;
*
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
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
* this is all we need to
* generate a parallel vector.
*/
- Vector (const Epetra_Map ¶llel_partitioning);
+ explicit Vector (const Epetra_Map ¶llel_partitioning);
/**
* Copy constructor from the
* that sets the partitioning
* details.
*/
- explicit Vector (const Epetra_Map ¶llel_partitioning,
- const VectorBase &v);
+ Vector (const Epetra_Map ¶llel_partitioning,
+ const VectorBase &v);
/**
* Reinitialize from a deal.II
* elements.
*/
template <typename Number>
- explicit Vector (const Epetra_Map ¶llel_partitioning,
- const dealii::Vector<Number> &v);
+ Vector (const Epetra_Map ¶llel_partitioning,
+ const dealii::Vector<Number> &v);
//@}
/**
* @name Initialization with an IndexSet
* need to generate a %parallel
* vector.
*/
- Vector (const IndexSet ¶llel_partitioning,
+ explicit Vector (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator = MPI_COMM_WORLD);
+
+ /**
+ * Creates a ghosted parallel vector.
+ */
+ Vector (const IndexSet &local,
+ const IndexSet &ghost,
const MPI_Comm &communicator = MPI_COMM_WORLD);
/**
* communicator that set the
* partitioning details.
*/
- explicit Vector (const IndexSet ¶llel_partitioning,
- const VectorBase &v,
- const MPI_Comm &communicator = MPI_COMM_WORLD);
+ Vector (const IndexSet ¶llel_partitioning,
+ const VectorBase &v,
+ const MPI_Comm &communicator = MPI_COMM_WORLD);
/**
* Copy-constructor from deal.II
* copies all the elements.
*/
template <typename Number>
- explicit Vector (const IndexSet ¶llel_partitioning,
- const dealii::Vector<Number> &v,
- const MPI_Comm &communicator = MPI_COMM_WORLD);
+ Vector (const IndexSet ¶llel_partitioning,
+ const dealii::Vector<Number> &v,
+ const MPI_Comm &communicator = MPI_COMM_WORLD);
/**
* Reinit functionality. This function
// 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));
}
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
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
* input the number of elements
* in the vector.
*/
- Vector (const unsigned int n);
+ explicit Vector (const size_type n);
/**
* This constructor takes as
* map will be generated
* internally.
*/
- Vector (const Epetra_Map &partitioning);
+ explicit Vector (const Epetra_Map &partitioning);
/**
* This constructor takes as input
* 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
* 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
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;
}
{
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));
// 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;
-//---------------------------------------------------------------------------
-// $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
// forward declaration
class VectorBase;
-
/**
* @cond internal
*/
*/
namespace internal
{
+ /**
+ * Declare type for container size.
+ */
+ typedef dealii::types::global_dof_index size_type;
+
/**
* This class implements a
* wrapper for accessing the
* 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
* 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 "
* Index of the referenced element
* of the vector.
*/
- const unsigned int index;
+ const size_type index;
/**
* Make the vector class a
*/
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;
* Return the global dimension of
* the vector.
*/
- unsigned int size () const;
+ size_type size () const;
/**
* Return the local dimension of
* elements, they are included in
* this number.
*/
- unsigned int local_size () const;
+ size_type local_size () const;
/**
* Return a pair of indices
* 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
* @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
* element, both read and write.
*/
reference
- operator () (const unsigned int index);
+ operator () (const size_type index);
/**
* Provide read-only access to an
* the <code>el()</code> command.
*/
TrilinosScalar
- operator () (const unsigned int index) const;
+ operator () (const size_type index) const;
/**
* Provide access to a given
* Exactly the same as operator().
*/
reference
- operator [] (const unsigned int index);
+ operator [] (const size_type index);
/**
* Provide read-only access to an
* Exactly the same as operator().
*/
TrilinosScalar
- operator [] (const unsigned int index) const;
+ operator [] (const size_type index) const;
/**
* Return the value of the vector
* 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().
*/
* 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);
/**
* 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);
//@}
* 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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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
namespace internal
{
inline
- VectorReference::VectorReference (VectorBase &vector,
- const unsigned int index)
+ VectorReference::VectorReference (VectorBase &vector,
+ const size_type index)
:
vector (vector),
index (index)
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));
}
{
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;
}
inline
internal::VectorReference
- VectorBase::operator () (const unsigned int index)
+ VectorBase::operator () (const size_type index)
{
return internal::VectorReference (*this, index);
}
inline
internal::VectorReference
- VectorBase::operator [] (const unsigned int index)
+ VectorBase::operator [] (const size_type index)
{
return operator() (index);
}
inline
TrilinosScalar
- VectorBase::operator [] (const unsigned int index) const
+ VectorBase::operator [] (const size_type index) const
{
return operator() (index);
}
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
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
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
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;
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
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
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
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;
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 "
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));
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;
}
-//---------------------------------------------------------------------------
-// $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
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
* 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
* @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
* 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
* 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
/**
* Return dimension of the vector.
*/
- unsigned int size () const;
+ std::size_t size () const;
/**
* Return whether the vector contains only
* 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
*
* Exactly the same as operator().
*/
- Number operator[] (const unsigned int i) const;
+ Number operator[] (const size_type i) const;
/**
* Access the @p ith component
*
* Exactly the same as operator().
*/
- Number &operator[] (const unsigned int i);
+ Number &operator[] (const size_type i);
//@}
* 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);
/**
* 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
* 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);
/**
* vector. Get this number by
* calling <tt>size()</tt>.
*/
- unsigned int vec_size;
+ size_type vec_size;
/**
* Amount of memory actually
* memory when the number of
* needed elements is reduced.
*/
- unsigned int max_vec_size;
+ size_type max_vec_size;
/**
* Pointer to the array of
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),
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)
{
template <typename Number>
inline
-unsigned int Vector<Number>::size () const
+std::size_t Vector<Number>::size () const
{
return vec_size;
}
template <typename Number>
inline
bool Vector<Number>::in_local_range
-(const types::global_dof_index) const
+(const size_type) const
{
return true;
}
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];
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];
}
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);
}
template <typename Number>
inline
-Number &Vector<Number>::operator[] (const unsigned int i)
+Number &Vector<Number>::operator[] (const size_type i)
{
return operator()(i);
}
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(),
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()));
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]),
-//---------------------------------------------------------------------------
-// $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
{
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;
{
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;
{
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())
}
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)
{
}
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)
{
}
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)
{
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)
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)
// 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;
// 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;
}
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
{
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;
}
// 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,
// 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);
{
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())
{
{
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())
{
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;
(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;
(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;
}
(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];
}
(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];
}
(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];
}
(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];
}
(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];
}
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];
}
(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];
}
// 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]);
}
(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];
}
(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];
}
(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];
}
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;
// 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;
{
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");
}
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;
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;
}
// 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));
{
AssertThrow (in, ExcIO());
- unsigned int sz;
+ size_type sz;
char buf[16];
-//---------------------------------------------------------------------------
-// $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
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);
/**
* nothing after first
* initialization
*/
- void initialize(const unsigned int size);
+ void initialize(const size_type size);
/**
* Pointer to the storage
* object
* 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
-//---------------------------------------------------------------------------
-// $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
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
* 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
* 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
* 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.
* 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
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
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
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;
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;
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;
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;
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;
-//---------------------------------------------------------------------------
-// $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
#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>
*/
void clear ();
+
/**
* Returns a pointer to the first index in the DoF row @p row.
*/
* 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,
/**
* 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.
* 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
/**
* 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;
* 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;
};
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;
}
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;
}
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]);
}
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;
}
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;
}
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]);
}
// 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);
}
-//---------------------------------------------------------------------------
-// $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>
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;
}
* 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;
};
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)
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;
// 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
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,
{
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);
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);
// 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;
// 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)
{
(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
// 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));
}
}
}
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
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
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 ||
}
else
current_dof -= first_owned;
- plain_dof_indices.push_back (current_dof);
+ plain_dof_indices.push_back (static_cast<unsigned int>
+ (current_dof));
}
}
}
// 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)
// 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);
// 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());
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)
?
{
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)
?
}
}
- 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
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;
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);
}
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];
}
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(),
// 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
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 ()
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;
}
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
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;
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;
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)
{
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;
- 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());
}
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);
{
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));
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),
-//---------------------------------------------------------------------------
-// $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
{
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());
{
typedef VectorType BaseVectorType;
- static BaseVectorType* get_vector_component (VectorType &vec,
+ static BaseVectorType *get_vector_component (VectorType &vec,
const unsigned int)
{
return &vec;
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
// 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);
// 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);
// 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);
// 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);
// 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
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;
{
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
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)
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;
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;
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;
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
/**
* 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);
//@}
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());
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
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
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;
}
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
-//---------------------------------------------------------------------------
-// $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>
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
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
{
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;
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));
// 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
}
// 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();
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
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
-//---------------------------------------------------------------------------
-// $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
*/
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,
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,
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);
/**
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
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
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
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
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,
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)
{
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)
{
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];
{
// 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);
}
{
// 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);
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)
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)
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)
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)
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());
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());
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
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
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
*/
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;
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
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);
}
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)
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;
}
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());
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;
}
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))
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());
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
* 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
{
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);
};
}
-//---------------------------------------------------------------------------
-// $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
* @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
-//---------------------------------------------------------------------------
-// $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
DEAL_II_NAMESPACE_OPEN
template <typename> class TriaActiveIterator;
+template <typename> class FilteredIterator;
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)
{
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);
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
info, cell_worker,
boundary_worker, face_worker,
cells_first,
- true);
+ unique_faces_only);
dof_info.assemble(assembler);
}
#endif
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
*/
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
* 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
*/
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);
/**
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.
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);
/**
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);
/**
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);
/**
inline void
ResidualSimple<MATRIX>::initialize_local_blocks(const BlockIndices &)
{}
-
-
+
+
template <class VECTOR>
template <class DOFINFO>
inline void
}
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>
}
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());
+ }
}
}
}
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());
info2.indices_by_block[row], info1.indices_by_block[column]);
}
else
- {
- Assert(false, ExcNotImplemented());
- }
+ {
+ Assert(false, ExcNotImplemented());
+ }
}
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());
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());
{
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]))
||
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());
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());
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());
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]))
{
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());
-//---------------------------------------------------------------------------
-// $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
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,
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,
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,
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,
-//---------------------------------------------------------------------------
-// $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>
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,
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,
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,
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,
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
template<typename number, class VECTOR>
void
MGCoarseGridHouseholder<number, VECTOR>::operator() (
- const unsigned int,
+ const unsigned int /*level*/,
VECTOR &dst,
const VECTOR &src) const
{
template<typename number, class VECTOR>
void
MGCoarseGridSVD<number, VECTOR>::operator() (
- const unsigned int,
+ const unsigned int /*level*/,
VECTOR &dst,
const VECTOR &src) const
{
-//---------------------------------------------------------------------------
-// $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
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
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;
};
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);
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);
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())
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());
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());
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());
}
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;
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
{
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);
{
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);
-//---------------------------------------------------------------------------
-// $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
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>());
/**
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>());
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;
/**
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());
/**
*/
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;
*/
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;
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);
}
/* @} */
-//---------------------------------------------------------------------------
-// $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
{
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);
{
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 <>
{
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)
{
}
};
* 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
-//---------------------------------------------------------------------------
-// $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
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();
{
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]);
// 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);
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);
}
}
// 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);
}
}
-//---------------------------------------------------------------------------
-// $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
/**
* 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()
/*@}*/
-//---------------------------------------------------------------------------
+//----------inline function definition--------------------------------------------------
template <typename number>
inline void
MGTransferBlockSelect<number>::select(const unsigned int block)
-//---------------------------------------------------------------------------
-// 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
typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT;
-
template <typename number>
template <int dim, typename number2, int spacedim>
void
-//---------------------------------------------------------------------------
-// $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
/**
* 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()
* 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;
/**
* 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
= 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> >()
);
/**
-//---------------------------------------------------------------------------
-// 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
//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);
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);
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();
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);
-//---------------------------------------------------------------------------
-// $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
:
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),
-//---------------------------------------------------------------------------
-// $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>
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);
{
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)
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
// 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];
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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>
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;
}
{
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;
}
{
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;
}
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;
{
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));
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
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>());
// 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
//
// 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);
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>());
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>());
// 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);
/**
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>());
*/
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,
*/
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,
* 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,
* 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,
* 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,
* 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);
* 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,
* 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,
* 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,
* 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,
* 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);
-//---------------------------------------------------------------------------
-// $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
{
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;
};
}
}
-//---------------------------------------------------------------------------
-// $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
* 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
* 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
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),
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;
};
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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
/**
* Calls the project()
- * function, see above, with
+ * function above, with
* <tt>mapping=MappingQ1@<dim@>()</tt>.
*/
template <int dim, class VECTOR, int spacedim>
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
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());
/**
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());
/**
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());
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());
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>());
/**
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>());
/**
-//---------------------------------------------------------------------------
-// $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
// 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);
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
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();
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
// 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
//
}
-
- 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);
}
+ 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,
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
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
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++)
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++)
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++)
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++)
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(),
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
// ----------- interpolate_boundary_values for std::map --------------------
- namespace internal
+ namespace
{
// interpolate boundary values in
// 1d. in higher dimensions, we
// 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>)
{
- 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>)
{
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;
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>());
}
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;
}
+ 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,
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,
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)
{
// -------- 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);
}
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,
-// ----- 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 -----
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)
{
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;
}
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)
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)
* 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 ());
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
* 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 ());
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 ());
}
// 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;
{
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;
"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
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() );
// 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();
-#####
+## ---------------------------------------------------------------------
+## $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
ADD_SUBDIRECTORY(meshworker)
+ADD_CUSTOM_TARGET(library)
+
FOREACH(build ${DEAL_II_BUILD_TYPES})
STRING(TOLOWER ${build} build_lowercase)
${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}"
# 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}"
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
// 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("-"));
// 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("-"));
}
// 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);
}
// 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("-"));
// 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("-"));
}
// 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);
}
-//---------------------------------------------------------------------------
-// $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
};
#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)
};
//----------------------------------------------------------------------//
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)
{}
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];
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];
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];
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];
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];
if (n_metadata > 0)
out << "</FieldData>\n";
-}
+ }
VtuStream vtu_out(out, flags);
// 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
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()));
// 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;
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;
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()));
// 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;
// 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>";
+// ---------------------------------------------------------------------
+// $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.
*
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
* 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)
:
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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
// 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();
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!"));
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);
}
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));
}
-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();
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());
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));
#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,
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));
}
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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)
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);
void LogStream::pop ()
{
- if (get_prefixes().size() > 1)
+ if (get_prefixes().size() > 0)
get_prefixes().pop();
}
// 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();
if (print_thread_id)
*std_out << '[' << thread << ']';
- *std_out << head << ':';
+ if (head.size() > 0)
+ *std_out << head << ':';
}
if (file && (get_prefixes().size() <= file_depth))
if (print_thread_id)
*file << '[' << thread << ']';
- *file << head << ':';
+ if (head.size() > 0)
+ *file << head << ':';
}
}
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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);
}
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,
// or just end PETSc.
PetscFinalize();
# endif
- }
-#endif
+ }
+#endif
// only MPI_Finalize if we are running with MPI and we are not using PETSc
-//---------------------------------------------------------------------------
-// $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>
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)
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()
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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;
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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)
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++;
}
}
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;
}
// 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;
}
// 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);
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
+// ---------------------------------------------------------------------
+// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
}
}
else
- {
+ {
const double offset = step * interval;
if (x<offset || x>offset+step)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
// 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,
{
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));
}
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
DEAL_II_NAMESPACE_OPEN
+
//////////////////////////////////////////////////////////////////////
// TensorFunction
//////////////////////////////////////////////////////////////////////
}
+
+//////////////////////////////////////////////////////////////////////
+// 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>;
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
-//---------------------------------------------------------------------------
-// $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>
void compute_tensor_index(const unsigned int,
const unsigned int,
const unsigned int,
- unsigned int (&)[dim])
+ unsigned int ( &)[dim])
{
Assert(false, ExcNotImplemented());
}
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
leave_subsection();
if ( (output_frequency == summary || output_frequency == every_call_and_summary)
- && output_is_enabled == true)
+ && output_is_enabled == true)
print_summary();
}
-//---------------------------------------------------------------------------
-// $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>
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
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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)
{
{
// 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
{
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;
}
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)
{
{
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);
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)
:
/* ---------------------- 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,
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);
== 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
}
// check mesh for ghostcells,
- // refine as neccessary.
+ // refine as necessary.
// iterate over every ghostquadrant,
// find corresponding deal coarsecell
// and recurse.
--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;
+ }
+ }
}
}
// 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
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."));
}
}
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);
}
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;
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;
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 ();
}
template <>
- unsigned int
+ types::global_dof_index
Triangulation<1,1>::n_global_active_cells () const
{
Assert (false, ExcNotImplemented());
template <>
- unsigned int
+ types::global_dof_index
Triangulation<1,2>::n_global_active_cells () const
{
Assert (false, ExcNotImplemented());
template <>
- unsigned int
+ types::global_dof_index
Triangulation<1,3>::n_global_active_cells () const
{
Assert (false, ExcNotImplemented());
-//---------------------------------------------------------------------------
-// $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)
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
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 ());
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());
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
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"));
-//---------------------------------------------------------------------------
-// $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!
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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;
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;
}
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());
}
// 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:
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 +
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 ();
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 ();
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 ();
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 ();
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 ();
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 ();
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> &,
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);
}
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);
}
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);
}
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);
}
{
// 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);
}
{
// 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);
}
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;
}
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
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
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;
}
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
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
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
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(),
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
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(),
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
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;
}
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());
// 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
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());
}
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());
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)
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());
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)
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());
}
//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)
delete faces;
faces = 0;
- std::vector<unsigned int> tmp;
+ std::vector<types::global_dof_index> tmp;
std::swap (vertex_dofs, tmp);
number_cache.clear ();
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,
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 ()
{
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)
-//---------------------------------------------------------------------------
-// $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
\}
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,
#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,
#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,
#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,
#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,
#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,
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
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
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
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
}
-//---------------------------------------------------------------------------
-// $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
*/
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
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
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
* 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)
{
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();
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
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)
// 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)
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)
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)?
}
- 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)
{
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
// 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)
== 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)
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)
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,
(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) ?
{
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] :
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)
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)
// 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)
== 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)
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)
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 )
{
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);
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,
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),
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,
{
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
{
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
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());
// 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);
// 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);
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))
{
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);
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))
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);
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());
}
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;
// 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();
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
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());
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
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);
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
//* 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(),
// 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++;
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;
.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
// 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]
#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();
//* 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),
// 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++;
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;
// 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]
//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);
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(),
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;
// 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;
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());
}
// 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(),
.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);
}
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
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"));
-//---------------------------------------------------------------------------
-// $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)
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,
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,
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,
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
}
-//---------------------------------------------------------------------------
-// $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>
{
namespace boost
{
- namespace types
+ namespace boosttypes
{
using namespace ::boost;
using namespace std;
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
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)
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);
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(),
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(),
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);
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(),
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);
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)
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();
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);
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
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);
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;
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);
}
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;
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;
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 ());
// 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
// 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
// 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]
// 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)
{
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);
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);
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);
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)
{
// 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];
// 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())
// 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]
// 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)
{
// 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)
{
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)
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
// 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());
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);
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);
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));
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;
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);
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);
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)
{
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
// 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;
}
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;
}
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);
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)
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;
}
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;
}
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);
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);
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)
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;
}
}
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);
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,
{
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);
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)
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;
}
}
const Point<DH::space_dimension> ¢er,
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);
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> ¢er,
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);
}
const Point<DH::space_dimension> ¢er,
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);
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);
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));
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);
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));
// 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;
// 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());
}
-//---------------------------------------------------------------------------
-// $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)
{
(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>
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
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
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);
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
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
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);
\}
(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
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>&);
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>&);
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);
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
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>&);
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);
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);
template
void
compute_random<DoFHandler<deal_II_dimension> >
- (std::vector<unsigned int>&,
+ (std::vector<types::global_dof_index>&,
const DoFHandler<deal_II_dimension> &);
template
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);
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
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> &);
(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
-//---------------------------------------------------------------------------
-// $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>
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));
"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();
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));
}
- 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();
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));
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);
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);
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);
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)
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());
#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))
};
#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
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)
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)
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(),
#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))
};
#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();
// 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);
"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(),
// 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);
{
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),
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
{
// 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,
{
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();
// 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);
// 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;
}
* 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)
{
// 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());
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
{
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
// 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
// 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
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
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);
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)
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));
}
}
}
}
// 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())
}
// 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())
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)
// 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
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;
}
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;
}
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)
{
(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
// 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
// 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
// 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();
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))
// 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();
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))
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
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
// 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(),
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];
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)
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
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.
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());
= (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
}
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_;
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.
= (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
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,
const unsigned int coarse_component,
const InterGridMap<dealii::DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map,
const std::vector<dealii::Vector<double> > ¶meter_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)
{
// 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)
{
// 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);
};
}
const unsigned int coarse_component,
const InterGridMap<dealii::DoFHandler<dim,spacedim> > &coarse_to_fine_grid_map,
const std::vector<dealii::Vector<double> > ¶meter_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;
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>;
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;
// 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();
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();
// 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;
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) ||
// 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,
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
// 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)
{
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());
// 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
// 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)
{
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)
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);
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
// 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,
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),
};
// 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;
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());
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
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(),
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();
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;
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)
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());
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();
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();
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
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)
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);
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)
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]);
}
}
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)
// 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)
-//---------------------------------------------------------------------------
-// $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)
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>
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
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
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
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
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
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
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
(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
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> &);
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> &);
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
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
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
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
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
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
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
(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
-//---------------------------------------------------------------------------
-// $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>
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
// 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.
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
+// ---------------------------------------------------------------------
+// $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>
// 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;
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;
{
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
// 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
// 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)
// 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
// 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)
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
* 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);
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;
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;
+ }
}
// 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;
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;
}
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;
}
// 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)
{
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;
}
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;
}
// 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)
{
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;
}
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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
// 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();
#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
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
}
// 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];
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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);
}
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
:
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),
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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
// 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)
{
// 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]));
}
}
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
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] =
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]));
}
}
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;
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);
}
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
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,
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)
}
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)
//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;
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;
// 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());
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 ();
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);
-//---------------------------------------------------------------------------
-// $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)
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>
-//---------------------------------------------------------------------------
-// $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>
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];
}
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);
}
}
+ 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
{
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++;
}
}
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 ?
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)
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++;
}
}
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)
{
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++);
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)
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)
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++;
}
}
}
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 ?
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)
{
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++;
}
}
}
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)
{
{
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 *
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 *
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)
{
{
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];
}
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)
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)
{
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)
{
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)
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)
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)
{
{
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)
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)
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)
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)
{
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++);
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)
(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;
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++;
}
}
}
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)
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>::
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;
}
}
+ // ---------------------- 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
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);
+ }
}
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);
+ }
}
}
}
* to.
*/
virtual
- unsigned int
+ types::global_dof_index
n_dofs_for_dof_handler () const = 0;
#include "fe_values.decl.1.inst"
* to.
*/
virtual
- unsigned int
+ types::global_dof_index
n_dofs_for_dof_handler () const;
#include "fe_values.decl.2.inst"
* error.
*/
virtual
- unsigned int
+ types::global_dof_index
n_dofs_for_dof_handler () const;
#include "fe_values.decl.2.inst"
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();
{
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)
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));
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++;
}
}
{
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)
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++;
}
}
}
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++;
}
}
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)
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++;
}
}
}
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());
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
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
{
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());
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
{
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,
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
{
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());
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
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
{
-//-----------------------------------------------------------------------
-// $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
-//-----------------------------------------------------------------------
-// $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
-//-----------------------------------------------------------------------
-// $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)
{
-//-----------------------------------------------------------------------
-// $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)
{
-//-----------------------------------------------------------------------
-// $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
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
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>
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>
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>
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
}
(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>
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>
(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>
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
(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;
(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
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>
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>
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>
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
(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>
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>
(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>
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;
(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>
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>
(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>
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
-//---------------------------------------------------------------------------
-// $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.
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
-//---------------------------------------------------------------------------
-// $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>
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);
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
// 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);
-//---------------------------------------------------------------------------
-// $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)
{
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
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)
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);
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)
{
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;
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)
{
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;
}
// 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);
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;
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;
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;
}
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) );
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));
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));
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,
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;
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;
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;
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]);
// 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;
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]);
// 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])
}
// 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;
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]);
// 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])
}
// 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;
const Point<1> &,
const double,
const double,
- const unsigned int,
+ const size_type ,
const bool)
{
Assert (false, ExcNotImplemented());
const double,
const double,
const double,
- const unsigned int,
- const unsigned int)
+ const size_type ,
+ const size_type )
{
Assert (false, ExcNotImplemented());
}
const Point<1> &,
const double,
const double,
- const unsigned int,
+ const size_type ,
const bool)
{
Assert (false, ExcNotImplemented());
const Point<1> &,
const double,
const double,
- const unsigned int,
+ const size_type ,
const bool)
{
Assert (false, ExcNotImplemented());
template <>
-void GridGenerator::hyper_shell (Triangulation<2> &tria,
- const Point<2> ¢er,
- const double inner_radius,
- const double outer_radius,
- const unsigned int n_cells,
+void GridGenerator::hyper_shell (Triangulation<2> &tria,
+ const Point<2> ¢er,
+ const double inner_radius,
+ const double outer_radius,
+ const size_type n_cells,
const bool colorize)
{
Assert ((inner_radius > 0) && (inner_radius < outer_radius),
// 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
// 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;
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;
const double,
const double,
const double,
- const unsigned int,
- const unsigned int)
+ const size_type,
+ const size_type)
{
Assert (false, ExcNotImplemented());
}
// Implementation for 2D only
template <>
void
-GridGenerator::half_hyper_shell (Triangulation<2> &tria,
- const Point<2> ¢er,
- const double inner_radius,
- const double outer_radius,
- const unsigned int n_cells,
+GridGenerator::half_hyper_shell (Triangulation<2> &tria,
+ const Point<2> ¢er,
+ const double inner_radius,
+ const double outer_radius,
+ const size_type n_cells,
const bool colorize)
{
Assert ((inner_radius > 0) && (inner_radius < outer_radius),
// 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
// 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
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);
template <>
-void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria,
- const Point<2> ¢er,
- const double inner_radius,
- const double outer_radius,
- const unsigned int n_cells,
+void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria,
+ const Point<2> ¢er,
+ const double inner_radius,
+ const double outer_radius,
+ const size_type n_cells,
const bool colorize)
{
Assert ((inner_radius > 0) && (inner_radius < outer_radius),
// 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
// 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
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);
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);
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] +
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];
// 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
{
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;
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),
const Point<3> ¢er,
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),
const Point<3> ¢er,
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),
// 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 ());
// 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
// 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;
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],
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;
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)
{
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];
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)
{
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();
// 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);
// 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());
}
// 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
// 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
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)));
}
}
// 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);
}
const double,
const double,
const double,
- const unsigned int,
+ const size_type,
bool)
{
Assert(false, ExcNotImplemented());
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;
{
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;
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;
{
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)
-//---------------------------------------------------------------------------
-// $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)
{
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);
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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
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;
// 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
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;
}
}
// 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:
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;
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
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;
}
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;
}
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';
}
<< "\">"
<< "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
case 3:
out << "subdomain_id";
break;
- case 4: out << "level_subdomain_id";
- break;
+ case 4:
+ out << "level_subdomain_id";
+ break;
default:
break;
}
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;
}
{
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 ());
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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.
+//
+// ---------------------------------------------------------------------
+
-//---------------------------------------------------------------------------
-// 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>
-//---------------------------------------------------------------------------
-// $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>
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
// 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();
-//---------------------------------------------------------------------------
-// $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)
#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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
- // 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
// 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
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())
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);
new_lines[5]->index()));
}
+ types::subdomain_id subdomainid = cell->subdomain_id();
for (unsigned int i=0; i<n_children; ++i)
{
// 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 ());
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 ();
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 ());
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)
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.
// 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 ());
/**
* 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
// 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
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
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
// 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;
}
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();
}
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();
}
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,
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),
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),
// 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
// 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;
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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];
}
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;
}
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);
}
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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);
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------- 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>
// 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)
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)
{
}
// finally place the end
// marker
- dof_handler.vertex_dofs[pointer] = numbers::invalid_unsigned_int;
+ dof_handler.vertex_dofs[pointer] = numbers::invalid_dof_index;
}
}
*/
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;
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;
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;
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)
}
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
#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)
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)
}
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
#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)
// 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
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)
}
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
#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)
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
// 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)
}
// 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;
}
}
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());
}
// 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:
// 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() +
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;
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();
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());
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())
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());
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())
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;
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;
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
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());
// 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 (),
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());
// 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 (),
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]);
};
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;
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;
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;
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
= *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,
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),
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
{}
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
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
// 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]
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),
= *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),
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
{}
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
{}
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
= *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),
// 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();
// 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);
// 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;
// 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());
= 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,
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
// 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));
}
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());
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,
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());
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;
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;
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;
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;
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;
}
const unsigned int,
const unsigned int,
const unsigned int,
- const unsigned int) const
+ const types::global_dof_index) const
{
Assert (false, ExcNotImplemented());
}
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);
}
}
-//---------------------------------------------------------------------------
-// $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)
{
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
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
\}
-//---------------------------- 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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------- 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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------- 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>
-//---------------------------------------------------------------------------
-// $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)
{
-//----------------------- 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>
-//---------------------------------------------------------------------------
-// $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)
{
-#####
+## ---------------------------------------------------------------------
+## $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})
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
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
// 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
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
-//---------------------------------------------------------------------------
-// $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>
+// ---------------------------------------------------------------------
+// $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>;
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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)
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;
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;
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 ();
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));
// 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));
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 ();
}
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;
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)
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;
}
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;
}
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;
}
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();
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();
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();
-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)
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),
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;
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;
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
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
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
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)
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);
}
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();
}
{
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();
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)
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);
}
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();
}
{
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();
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)
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();
}
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]);
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();
}
{
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]);
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)
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();
}
(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();
(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);
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();
}
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();
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);
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------- 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
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> &,
// 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> &,
-//---------------------------------------------------------------------------
-// $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>
-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));
}
-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));
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));
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));
-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);
}
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));
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));
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);
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);
}
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);
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));
// 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
// 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
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);
{
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);
}
void copy_row (const SparsityPattern &csp,
- const unsigned int row,
+ const size_type row,
ChunkSparsityPattern &dst)
{
SparsityPattern::iterator col_num = csp.begin (row);
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(),
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
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);
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));
// 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(),
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);
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);
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));
-unsigned int
+ChunkSparsityPattern::size_type
ChunkSparsityPattern::max_entries_per_row () const
{
return sparsity_pattern.max_entries_per_row() * chunk_size;
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));
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));
-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));
-unsigned int
+ChunkSparsityPattern::size_type
ChunkSparsityPattern::n_nonzero_elements () const
{
if ((n_rows() % chunk_size == 0)
(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;
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;
}
}
}
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)
// 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
-unsigned int
+ChunkSparsityPattern::size_type
ChunkSparsityPattern::bandwidth () const
{
// calculate the bandwidth from that of the underlying sparsity
// 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>
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
-//---------------------------------------------------------------------------
-// $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>
-CompressedSetSparsityPattern::CompressedSetSparsityPattern (const unsigned int m,
- const unsigned int n)
+CompressedSetSparsityPattern::CompressedSetSparsityPattern (const size_type m,
+ const size_type n)
:
rows(0),
cols(0)
-CompressedSetSparsityPattern::CompressedSetSparsityPattern (const unsigned int n)
+CompressedSetSparsityPattern::CompressedSetSparsityPattern (const size_type n)
:
rows(0),
cols(0)
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;
-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;
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));
// 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)
{
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;
{
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
-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));
}
-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();
}
-//---------------------------------------------------------------------------
-// $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>
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)
{
// 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)
{
// 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
*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;
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)
}
-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);
}
-CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const unsigned int m,
- const unsigned int n,
+CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_type m,
+ const size_type n,
const IndexSet &rowset_
)
:
}
+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),
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;
-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;
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(),
// 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)
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;
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
-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));
}
-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();
}
}
-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;
// 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
-//---------------------------------------------------------------------------
-// $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>
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;
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;
-CompressedSparsityPattern::CompressedSparsityPattern (const unsigned int m,
- const unsigned int n)
+CompressedSparsityPattern::CompressedSparsityPattern (const size_type m,
+ const size_type n)
:
rows(0),
cols(0)
-CompressedSparsityPattern::CompressedSparsityPattern (const unsigned int n)
+CompressedSparsityPattern::CompressedSparsityPattern (const size_type n)
:
rows(0),
cols(0)
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;
-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;
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));
// 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)
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;
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
-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));
}
-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 ();
// 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
-//---------------------------------------------------------------------------
-// $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>
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);
}
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);
}
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);
}
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));
}
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));
//
// 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)
{
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);
// 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;
}
// 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());
// 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)
{
// 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;
#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)
||
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!"));
// 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!"));
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 *
// 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++;
// 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,
// 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());
// 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;
}
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
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
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;
}
// 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;
-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)
}
{
- std::vector<unsigned int> tmp;
+ std::vector<size_type> tmp;
lines_cache.swap (tmp);
}
// 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
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;
};
// 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
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
// 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()]);
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]);
};
// 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
// 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,
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);
// 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
// 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;
}
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,
// 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 (; 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);
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,
// 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
// 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;
}
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,
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);
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);
{
// 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);
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);
}
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.
// 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,
{
// 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);
}
// 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);
};
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.
// 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);
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,
{
// 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);
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);
}
// 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);
};
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.
// 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,
{
// 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);
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);
};
-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;
-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;
}
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";
{
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
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,\
#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
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 , \
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 , \
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 , \
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 , \
#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
#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>);
+// ---------------------------------------------------------------------
+// $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;
}
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;
}
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;
}
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
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)
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
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
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;
{
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
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
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;
-//---------------------------------------------------------------------------
-// $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>
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)
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)
{
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;
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);
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);
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);
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);
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];
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,
{
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);
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:
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,
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];
}
{
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);
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:
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.
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];
}
{
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);
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.
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];
}
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 << ' ';
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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)
{}
-//---------------------------------------------------------------------------
-// $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),
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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
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;
-//---------------------------------------------------------------------------
-// $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>
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,
-//---------------------------------------------------------------------------
-// $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>
// 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
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 ();
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 ();
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;
PetscScalar
- MatrixBase::diag_element (const unsigned int i) const
+ MatrixBase::diag_element (const size_type i) const
{
Assert (m() == n(), ExcNotQuadratic());
- unsigned int
+ MatrixBase::size_type
MatrixBase::m () const
{
PetscInt n_rows, n_cols;
- unsigned int
+ MatrixBase::size_type
MatrixBase::n () const
{
PetscInt n_rows, n_cols;
- unsigned int
+ MatrixBase::size_type
MatrixBase::local_size () const
{
PetscInt n_rows, n_cols;
- std::pair<unsigned int, unsigned int>
+ std::pair<MatrixBase::size_type, MatrixBase::size_type>
MatrixBase::local_range () const
{
PetscInt begin, end;
- unsigned int
+ MatrixBase::size_type
MatrixBase::n_nonzero_elements () const
{
MatInfo mat_info;
= 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
#if DEAL_II_PETSC_VERSION_GTE(3,1,0)
- PetscReal
+ PetscScalar
MatrixBase::trace () const
{
- PetscReal result;
+ PetscScalar result;
const int ierr
= MatGetTrace (matrix, &result);
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,
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
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);
}
}
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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
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);
}
-//---------------------------------------------------------------------------
-// $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>
{
namespace MPI
{
+ typedef types::global_dof_index size_type;
+
BlockVector &
BlockVector::operator = (const PETScWrappers::BlockVector &v)
{
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();
+ }
}
}
-//---------------------------------------------------------------------------
-// $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>
- 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)
{
- 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)
{
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)
{
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;
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;
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;
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));
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));
// 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));
}
+ 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(),
// 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)
//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
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))
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;
// 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),
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,
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
-//---------------------------------------------------------------------------
-// $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>
- 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)
{
- 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)
{
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;
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;
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());
}
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=."));
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,
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;
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
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);
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
}
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);
-//---------------------------------------------------------------------------
-// $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>
- 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);
}
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
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
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
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));
// 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,
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(),
{
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;
-//---------------------------------------------------------------------------
-// $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>
- Vector::Vector (const unsigned int n)
+ Vector::Vector (const size_type n)
{
Vector::create_vector (n);
}
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
void
- Vector::create_vector (const unsigned int n)
+ Vector::create_vector (const size_type n)
{
const int ierr
= VecCreateSeq (PETSC_COMM_SELF, n, &vector);
-//---------------------------------------------------------------------------
-// $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>
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);
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);
}
- 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
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()."));
}
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));
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()."));
}
- unsigned int
+ VectorBase::size_type
VectorBase::size () const
{
PetscInt sz;
- unsigned int
+ VectorBase::size_type
VectorBase::local_size () const
{
PetscInt sz;
- std::pair<unsigned int, unsigned int>
+ std::pair<VectorBase::size_type, VectorBase::size_type>
VectorBase::local_range () const
{
PetscInt begin, end;
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(),
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(),
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(),
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);
}
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();
}
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
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;
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 :
{
#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
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
}
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;
// 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));
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
}
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,
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 ()
{
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
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.
/* ---------------------- 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)
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),
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// 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>
-//---------------------------------------------------------------------------
-// $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>
// 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
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) &&
// 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) &&
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
// 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,
// 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();
}
// 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());
}
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());
// 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,
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;
}
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);
}
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."));
}
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."));
}
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."));
}
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."));
}
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);
}
+
#ifdef DEAL_II_WITH_MUMPS
SparseDirectMUMPS::SparseDirectMUMPS ()
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 ();
// 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;
// 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;
// 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;
// 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>)
// 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>)
-//---------------------------------------------------------------------------
-// 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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------- 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
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);
}
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> &,
// 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> &,
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------- 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)
-//---------------------------------------------------------------------------
-// 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>
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
#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;
-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)
:
-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),
-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)
:
}
-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),
-SparsityPattern::SparsityPattern (const unsigned int n,
+SparsityPattern::SparsityPattern (const size_type n,
const unsigned int max_per_row)
:
max_dim(0),
-SparsityPattern::SparsityPattern (const unsigned int m,
+SparsityPattern::SparsityPattern (const size_type m,
const std::vector<unsigned int> &row_lengths,
const bool)
:
}
-SparsityPattern::SparsityPattern (const unsigned int m,
+SparsityPattern::SparsityPattern (const size_type m,
const std::vector<unsigned int> &row_lengths)
:
max_dim(0),
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),
// 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
// 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
// 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,
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,
// 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,
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;
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)
{
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
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)
{
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);
// 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
}
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))
}
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)),
// 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;
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
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
// 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
// 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))
// 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;
}
// 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())
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);
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)
{
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));
-unsigned int
+SparsityPattern::size_type
SparsityPattern::max_entries_per_row () const
{
// if compress() has not yet been
// 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));
// 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
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));
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)
{
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;
-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(),
// 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);
// 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
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;
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),
-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
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]),
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));
}
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
-//---------------------------------------------------------------------------
-// $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>
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)
{
/**
* 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);
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);
//
// 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());
}
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()));
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())
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
{
// 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)
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
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
// 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)
// 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++;
// 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())
&&
#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])
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);
}
}
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;
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);
}
}
Assert(ptr==end, ExcInternalError());
-
}
}
#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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
template<typename number>
TridiagonalMatrix<number>::TridiagonalMatrix(
- unsigned int size,
+ size_type size,
bool symmetric)
:
diagonal(size, 0.),
template<typename number>
void
TridiagonalMatrix<number>::reinit(
- unsigned int size,
+ size_type size,
bool symmetric)
{
is_symmetric = symmetric;
// 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();
++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);
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);
}
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();
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);
}
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);
}
{
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();
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;
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()));
-//---------------------------------------------------------------------------
-// $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>
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
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();
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,
// ... 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],
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));
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()));
// ... 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));
}
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,
// ... 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],
#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));
- 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;
BlockSparseMatrix::reinit (const std::vector<Epetra_Map> &,
const dealii::BlockCompressedSimpleSparsityPattern &);
+ template void
+ BlockSparseMatrix::reinit (const std::vector<IndexSet> &,
+ const dealii::BlockCompressedSimpleSparsityPattern &,
+ const MPI_Comm &);
+
}
-//---------------------------------------------------------------------------
-// $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>
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 &
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();
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;
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();
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();
}
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> ¶llel_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
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();
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();
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();
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 << ':';
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();
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();
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();
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();
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();
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();
{
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();
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 << ':';
-//---------------------------------------------------------------------------
-// $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>
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
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;
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);
{
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];
}
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());
- std::size_t
+ PreconditionAMG::size_type
PreconditionAMG::memory_consumption() const
{
unsigned int memory = sizeof(this);
-//---------------------------------------------------------------------------
-// $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>
const VectorBase &b,
const PreconditionBase &preconditioner)
{
- int ierr;
-
linear_problem.reset();
// We need an
&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);
}
const dealii::Vector<double> &b,
const PreconditionBase &preconditioner)
{
- int ierr;
-
linear_problem.reset();
// In case we call the solver with
(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);
// ... 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
-//---------------------------------------------------------------------------
-// $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>
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
// 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
{
}
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));
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)
{}
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)
{}
- 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
// 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,
- 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])),
SparseMatrix::SparseMatrix (const IndexSet ¶llel_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))),
- SparseMatrix::SparseMatrix (const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator,
+ SparseMatrix::SparseMatrix (const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row)
:
column_space_map (new Epetra_Map(parallel_partitioning.
- 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))),
- 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.
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());
{
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();
}
}
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
// 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)
}
// 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));
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,
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 =
// 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
++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);
}
// 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));
}
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;
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.;
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
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
// 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));
// 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);
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
// 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);
TrilinosScalar
- SparseMatrix::diag_element (const unsigned int i) const
+ SparseMatrix::diag_element (const size_type i) const
{
Assert (m() == n(), ExcNotQuadratic());
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
namespace internals
{
+ typedef dealii::types::global_dof_index size_type;
+
void perform_mmult (const SparseMatrix &inputleft,
const SparseMatrix &inputright,
SparseMatrix &result,
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];
}
}
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();
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
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());
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;
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) ==
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;
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
// 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,
&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];
}
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 ();
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;
}
}
- 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);
}
}
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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
// 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
// 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));
}
}
:
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);
}
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);
}
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);
}
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."));
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));
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);
}
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);
}
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));
}
{
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();
}
}
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;
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,
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;
&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]);
}
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);
}
// 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();
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
{
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;
{
// 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,
// 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);
- 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;
}
- 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);
}
- 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
if (local_row >= 0)
ncols = graph->NumMyIndices (local_row);
- return static_cast<unsigned int>(ncols);
+ return static_cast<size_type>(ncols);
}
{
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;
}
}
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);
// 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());
-//---------------------------------------------------------------------------
-// $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>
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
{
:
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;
:
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;
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 ()
// 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();
}
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();
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());
}
+ 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)
- 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));
}
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));
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));
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));
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));
}
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));
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));
{
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));
{
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));
{
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));
-//---------------------------------------------------------------------------
-// $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>
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
// 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(),
//
// 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;
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
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
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;
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];
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;
//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 */
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
// 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;
template <typename VECTOR>
inline
void
-GrowingVectorMemory<VECTOR>::Pool::initialize(const unsigned int size)
+GrowingVectorMemory<VECTOR>::Pool::initialize(const size_type size)
{
if (data == 0)
{
template <typename VECTOR>
inline
-GrowingVectorMemory<VECTOR>::GrowingVectorMemory (const unsigned int initial_size,
+GrowingVectorMemory<VECTOR>::GrowingVectorMemory (const size_type initial_size,
const bool log_statistics)
:
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
{}
+ 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>;
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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
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
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));
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)
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));
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)
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
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;
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,
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),
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)
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
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),
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;
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));
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,
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);
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());
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());
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
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();
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 (),
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])
// 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]);
+ }
+ }
}
}
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(),
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(),
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(),
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);
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(),
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);
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*/)
// 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;
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)
{
// 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;
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);
}
-//---------------------------------------------------------------------------
-// $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;
#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
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
\}
}
-//---------------------------------------------------------------------------
-// $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>
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
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);
}
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));
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);
}
// 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
// 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;
}
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;
}
// 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
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)
{
// 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)
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),
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)
{
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.
// 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());
}
}
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
{
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
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());
}
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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;
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);
}
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."));
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);
{
--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);
// 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;
}
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;
}
// 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
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)
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 =
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();
// 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();
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.
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;
// 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());
}
}
-//---------------------------------------------------------------------------
-// $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)
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>
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 (
-//---------------------------------------------------------------------------
-// $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>
#include <deal.II/multigrid/mg_transfer.h>
#include <deal.II/multigrid/mg_transfer.templates.h>
+#include <algorithm>
+
DEAL_II_NAMESPACE_OPEN
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);
// 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
// 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);
}
}
}
-
+
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);
// 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
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);
}
}
+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"
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-#####
+## ---------------------------------------------------------------------
+## $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})
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
{
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)
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
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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>
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;
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;
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,
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
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]],
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> > ,
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> > ,
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)
{
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,
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,
#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))
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
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
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)
{
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)
{
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,
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)
{
//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,
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
}
- 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
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
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,
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
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();
// 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:
// 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
{
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,
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());
// 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));
// 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)
// 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)
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,
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,
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)
// 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)
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));
}
}
// 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)
{
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,
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());
// 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));
// 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)
// 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)
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,
// 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)
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));
}
}
// 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)
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,
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,
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)
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)
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)
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())
{
{
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,
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,
-//---------------------------------------------------------------------------
-// $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
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>);
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
}
// 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
-//---------------------------------------------------------------------------
-// $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>
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;
}
- 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
}
}
- 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++)
{
-//---------------------------------------------------------------------------
-// $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)
-//---------------------------------------------------------------------------
-// $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>
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(),
// 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);
" 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,
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
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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).
-//---------------------------------------------------------------------------
-// $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>
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);
}
-//---------------------------------------------------------------------------
-// $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)
{
-//---------------------------------------------------------------------------
-// $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>
-//---------------------------------------------------------------------------
-// $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)
{
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
}
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 &);
\}
}
(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
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
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
// 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> &,
-#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
ConstraintMatrix &constraints,
const Mapping<deal_II_dimension> &mapping);
#endif
- \}
#endif
+ \}
}