]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Nuke DEAL_II_MIN_VECTOR_CAPACITY and friend
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 2 Apr 2013 23:07:48 +0000 (23:07 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 2 Apr 2013 23:07:48 +0000 (23:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@29157 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/checks/check_01_compiler_features.cmake
deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake [deleted file]
deal.II/include/deal.II/base/config.h.in
deal.II/source/grid/tria_levels.cc
deal.II/source/grid/tria_objects.cc

index d0249fba675c8f8b2f0bca457fcef0fbe7d6e0e2..8b4ec89a2e307c767ce3ddb208d895c44fc225ab 100644 (file)
@@ -26,8 +26,6 @@
 #   HAVE_GLIBC_STACKTRACE
 #   HAVE_LIBSTDCXX_DEMANGLER
 #   DEAL_II_COMPILER_HAS_ATTRIBUTE_PRETTY_FUNCTION
-#   DEAL_II_MIN_VECTOR_CAPACITY
-#   DEAL_II_MIN_BOOL_VECTOR_CAPACITY
 #   DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED
 #   DEAL_II_DEPRECATED
 #
@@ -258,64 +256,6 @@ IF(NOT DEAL_II_COMPILER_HAS_ATTRIBUTE_PRETTY_FUNCTION)
 ENDIF()
 
 
-#
-# Check for minimal vector capacity
-#
-# - Matthias Maier, rewritten 2012
-#
-IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-  GET_CXX_SOURCE_RETURN_VALUE(
-    "
-    #include <vector>
-    int main () {
-      std::vector<int> v(1);
-      v.reserve (1);
-      v.resize (1);
-      return v.capacity();
-    }
-    "
-    DEAL_II_MIN_VECTOR_CAPACITY
-    DEAL_II_MIN_VECTOR_CAPACITY_RETURN_VALUE)
-ENDIF()
-
-IF(NOT DEAL_II_MIN_VECTOR_CAPACITY)
-  SET(DEAL_II_MIN_VECTOR_CAPACITY 1)
-ELSE()
-  SET(DEAL_II_MIN_VECTOR_CAPACITY
-    ${DEAL_II_MIN_VECTOR_CAPACITY_RETURN_VALUE}
-    )
-ENDIF()
-
-
-
-#
-# Do same thing with std::vector<bool>
-#
-# - Matthias Maier, rewritten 2012
-#
-IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-  GET_CXX_SOURCE_RETURN_VALUE(
-    "
-    #include <vector>
-    int main () {
-      std::vector<bool> v(1);
-      v.reserve (1);
-      v.resize (1);
-      return v.capacity();
-    }
-    "
-    DEAL_II_MIN_BOOL_VECTOR_CAPACITY
-    DEAL_II_MIN_BOOL_VECTOR_CAPACITY_RETURN_VALUE)
-ENDIF()
-
-IF(NOT DEAL_II_MIN_BOOL_VECTOR_CAPACITY)
-  SET(DEAL_II_MIN_BOOL_VECTOR_CAPACITY 1)
-ELSE()
-  SET(DEAL_II_MIN_BOOL_VECTOR_CAPACITY
-    ${DEAL_II_MIN_BOOL_VECTOR_CAPACITY_RETURN_VALUE})
-ENDIF()
-
-
 #
 # Newer versions of gcc can pass a flag to the assembler to
 # compress debug sections. At the time of writing this test,
diff --git a/deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake b/deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake
deleted file mode 100644 (file)
index 25b824e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#####
-##
-## Copyright (C) 2012 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>
-##
-#####
-
-#
-# TODO: Description...
-#
-MACRO(GET_CXX_SOURCE_RETURN_VALUE _source _var _exit_code)
-
-  #
-  # TODO: This file is still very basic :-]
-  #
-
-  IF(NOT DEFINED ${_var})
-    FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
-      "${_source}\n")
-
-    MESSAGE(STATUS "Performing Test ${_var}")
-
-    TRY_RUN(
-      ${_var}_EXIT_CODE
-      ${_var}_COMPILE_OK
-      ${CMAKE_BINARY_DIR}
-      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx)
-
-    IF(${_var}_COMPILE_OK)
-      SET(${_var} 1 CACHE INTERNAL "Test ${_var}")
-      SET(${_exit_code} ${${_var}_EXIT_CODE} CACHE INTERNAL "Test ${_exit_code}")
-      MESSAGE(STATUS "Performing Test ${_var} - Success")
-
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-        "Performing C++ SOURCE FILE Test ${_var} succeded with the following output:\n"
-        "${OUTPUT}\n"
-        "Return value: ${${_var}}\n"
-        "Source file was:\n${_source}\n")
-
-    ELSE()
-
-      SET(${_var} 0 CACHE INTERNAL "Test ${_var}")
-      MESSAGE(STATUS "Performing Test ${_var} - Failed")
-
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-        "Performing C++ SOURCE FILE Test ${_var} failed with the following output:\n"
-        "${OUTPUT}\n"
-        "Return value: ${${_var}_EXITCODE}\n"
-        "Source file was:\n${_source}\n")
-    ENDIF()
-  ENDIF()
-ENDMACRO()
index 9e2960ad17508324cc40e7bb6da41fa39eb4cd48..9e21898d6686b1dfd47d6b8bf87e2d5b4c4bef30 100644 (file)
  */
 #cmakedefine __PRETTY_FUNCTION__ @__PRETTY_FUNCTION__@
 
-/* Set to the minimal number of elements a std::vector<T> can always hold,
- * i.e. its minimal capacity.
- */
-#define DEAL_II_MIN_VECTOR_CAPACITY @DEAL_II_MIN_VECTOR_CAPACITY@
-
-/* Set to the minimal number of elements a std::vector<bool> can always
- * hold, i.e. its minimal capacity.
- */
-#define DEAL_II_MIN_BOOL_VECTOR_CAPACITY @DEAL_II_MIN_BOOL_VECTOR_CAPACITY@
-
 /* If the compiler supports it, then this variable is defined to a string
  * that when written after a function name makes the compiler emit a warning
  * whenever this function is used somewhere that its use is deprecated.
index 6ea73f95dcf41443a56ac975ba93025eedd558bb..c438a8578ea938fe10e9ce1a0b697dbbe18ea010 100644 (file)
@@ -28,13 +28,12 @@ namespace internal
                                    const unsigned int dimension,
                                    const unsigned int space_dimension)
     {
-      // we need space for total_cells
-      // cells. Maybe we have more already
-      // with those cells which are unused,
-      // so only allocate new space if needed.
+      // we need space for total_cells cells. Maybe we have more already
+      // with those cells which are unused, so only allocate new space if
+      // needed.
       //
-      // note that all arrays should have equal
-      // sizes (checked by @p{monitor_memory}
+      // note that all arrays should have equal sizes (checked by
+      // @p{monitor_memory}
       if (total_cells > refine_flags.size())
         {
           refine_flags.reserve (total_cells);
@@ -84,34 +83,6 @@ namespace internal
     void
     TriaLevel<dim>::monitor_memory (const unsigned int true_dimension) const
     {
-      // check that we have not allocated
-      // too much memory. note that bool
-      // vectors allocate their memory in
-      // chunks of whole integers, so
-      // they may over-allocate by up to
-      // as many elements as an integer
-      // has bits
-      Assert (refine_flags.size() <=
-              refine_flags.capacity()  + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("refine_flags",
-                               refine_flags.size(), refine_flags.capacity()));
-      Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
-              coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("coarsen_flags",
-                               coarsen_flags.size(), coarsen_flags.capacity()));
-      Assert (neighbors.size() <=
-              neighbors.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("neighbors",
-                               neighbors.size(), neighbors.capacity()));
-      Assert (subdomain_ids.size() <=
-              subdomain_ids.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("subdomain_ids",
-                               subdomain_ids.size(), subdomain_ids.capacity()));
-      Assert (direction_flags.size() <=
-              direction_flags.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("direction_flags",
-                               direction_flags.size(), direction_flags.capacity()));
-
       Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
               ExcMemoryInexact (refine_flags.size(), neighbors.size()));
       Assert (2*true_dimension*coarsen_flags.size() == neighbors.size(),
@@ -196,33 +167,6 @@ namespace internal
     void
     TriaLevel<3>::monitor_memory (const unsigned int true_dimension) const
     {
-      // check that we have not allocated
-      // too much memory. note that bool
-      // vectors allocate their memory in
-      // chunks of whole integers, so
-      // they may over-allocate by up to
-      // as many elements as an integer
-      // has bits
-      Assert (refine_flags.size() <=
-              refine_flags.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("refine_flags",
-                               refine_flags.size(), refine_flags.capacity()));
-      Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
-              coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("coarsen_flags",
-                               coarsen_flags.size(), coarsen_flags.capacity()));
-      Assert (neighbors.size() <=
-              neighbors.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("neighbors",
-                               neighbors.size(), neighbors.capacity()));
-      Assert (subdomain_ids.size () <=
-              subdomain_ids.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("subdomain_ids",
-                               subdomain_ids.size(), subdomain_ids.capacity()));
-      Assert (direction_flags.size() <=
-              direction_flags.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("direction_flags",
-                               direction_flags.size(), direction_flags.capacity()));
       Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
               ExcMemoryInexact (refine_flags.size(), neighbors.size()));
       Assert (2*true_dimension*coarsen_flags.size() == neighbors.size(),
index 4a68a8ee17e8b5b4c46b751de2fdce79279019df..27e09b129dc35fd11a9ec7cbbd985998fdb78233 100644 (file)
@@ -40,8 +40,7 @@ namespace internal
           last=used.size()-1;
       if (!reverse_order_next_free_single)
         {
-          // first sweep forward, only use
-          // really single slots, do not use
+          // first sweep forward, only use really single slots, do not use
           // pair slots
           for (; pos<last; ++pos)
             if (!used[pos])
@@ -118,8 +117,7 @@ namespace internal
       next_free_pair=0;
       reverse_order_next_free_single=false;
 
-      // count the number of objects, of
-      // unused single objects and of
+      // count the number of objects, of unused single objects and of
       // unused pairs of objects
       unsigned int n_objects=0;
       unsigned int n_unused_pairs=0;
@@ -150,8 +148,8 @@ namespace internal
       Assert(n_objects+2*n_unused_pairs+n_unused_singles==used.size(),
              ExcInternalError());
 
-      // how many single objects are needed in
-      // addition to n_unused_objects?
+      // how many single objects are needed in addition to
+      // n_unused_objects?
       const int additional_single_objects=
         new_objects_single-n_unused_singles;
 
@@ -318,9 +316,8 @@ namespace internal
       next_free_pair=0;
       reverse_order_next_free_single=false;
 
-      // count the number of objects, of unused
-      // single objects and of unused pairs of
-      // objects
+      // count the number of objects, of unused single objects and of
+      // unused pairs of objects
       unsigned int n_quads=0;
       unsigned int n_unused_pairs=0;
       unsigned int n_unused_singles=0;
@@ -350,8 +347,7 @@ namespace internal
       Assert(n_quads+2*n_unused_pairs+n_unused_singles==used.size(),
              ExcInternalError());
 
-      // how many single quads are needed in
-      // addition to n_unused_quads?
+      // how many single quads are needed in addition to n_unused_quads?
       const int additional_single_quads=
         new_quads_single-n_unused_singles;
 
@@ -365,8 +361,7 @@ namespace internal
         {
           // reseve space for the base class
           TriaObjects<TriaObject<2> >::reserve_space(new_quads_in_pairs,new_quads_single);
-          // reserve the field of the derived
-          // class
+          // reserve the field of the derived class
           line_orientations.reserve (new_size * GeometryInfo<2>::lines_per_cell);
           line_orientations.insert (line_orientations.end(),
                                     new_size * GeometryInfo<2>::lines_per_cell
@@ -386,29 +381,6 @@ namespace internal
     void
     TriaObjects<TriaObject<1> >::monitor_memory (const unsigned int) const
     {
-      // check that we have not allocated
-      // too much memory. note that bool
-      // vectors allocate their memory in
-      // chunks of whole integers, so
-      // they may over-allocate by up to
-      // as many elements as an integer
-      // has bits
-      Assert (cells.size() <=
-              cells.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("lines",
-                               cells.size(), cells.capacity()));
-      Assert (children.size() <=
-              children.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("children",
-                               children.size(), children.capacity()));
-      Assert (used.size() <= used.capacity() + sizeof(int)*8 ||
-              used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("used",
-                               used.size(), used.capacity()));
-      Assert (user_flags.size() <= user_flags.capacity() + sizeof(int)*8 ||
-              user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("user_flags",
-                               user_flags.size(), user_flags.capacity()));
       Assert (cells.size() == used.size(),
               ExcMemoryInexact (cells.size(), used.size()));
       Assert (cells.size() == user_flags.size(),
@@ -426,29 +398,6 @@ namespace internal
     void
     TriaObjects<TriaObject<2> >::monitor_memory (const unsigned int) const
     {
-      // check that we have not allocated
-      // too much memory. note that bool
-      // vectors allocate their memory in
-      // chunks of whole integers, so
-      // they may over-allocate by up to
-      // as many elements as an integer
-      // has bits
-      Assert (cells.size() <=
-              cells.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("quads",
-                               cells.size(), cells.capacity()));
-      Assert (children.size() <=
-              children.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("children",
-                               children.size(), children.capacity()));
-      Assert (used.size() <= used.capacity() + sizeof(int)*8 ||
-              used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("used",
-                               used.size(), used.capacity()));
-      Assert (user_flags.size() <= user_flags.capacity() + sizeof(int)*8 ||
-              user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("user_flags",
-                               user_flags.size(), user_flags.capacity()));
       Assert (cells.size() == used.size(),
               ExcMemoryInexact (cells.size(), used.size()));
       Assert (cells.size() == user_flags.size(),
@@ -467,29 +416,6 @@ namespace internal
     void
     TriaObjectsHex::monitor_memory (const unsigned int) const
     {
-      // check that we have not allocated
-      // too much memory. note that bool
-      // vectors allocate their memory in
-      // chunks of whole integers, so
-      // they may over-allocate by up to
-      // as many elements as an integer
-      // has bits
-      Assert (cells.size() <=
-              cells.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("hexes",
-                               cells.size(), cells.capacity()));
-      Assert (children.size() <=
-              children.capacity() + DEAL_II_MIN_VECTOR_CAPACITY,
-              ExcMemoryWasted ("children",
-                               children.size(), children.capacity()));
-      Assert (used.size() <= used.capacity() + sizeof(int)*8 ||
-              used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("used",
-                               used.size(), used.capacity()));
-      Assert (user_flags.size() <= user_flags.capacity() + sizeof(int)*8 ||
-              user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
-              ExcMemoryWasted ("user_flags",
-                               user_flags.size(), user_flags.capacity()));
       Assert (cells.size() == used.size(),
               ExcMemoryInexact (cells.size(), used.size()));
       Assert (cells.size() == user_flags.size(),
@@ -518,13 +444,9 @@ namespace internal
     void
     TriaObjectsQuad3D::monitor_memory (const unsigned int) const
     {
-      // check that we have not allocated
-      // too much memory. note that bool
-      // vectors allocate their memory in
-      // chunks of whole integers, so
-      // they may over-allocate by up to
-      // as many elements as an integer
-      // has bits
+      // check that we have not allocated too much memory. note that bool
+      // vectors allocate their memory in chunks of whole integers, so they
+      // may over-allocate by up to as many elements as an integer has bits
       Assert (cells.size() * GeometryInfo<2>::lines_per_cell
               == line_orientations.size(),
               ExcMemoryInexact (cells.size() * GeometryInfo<2>::lines_per_cell,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.