From 037eaec3621ee2b6d1854f83c065c8398b337398 Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 2 Apr 2013 23:07:48 +0000 Subject: [PATCH] Nuke DEAL_II_MIN_VECTOR_CAPACITY and friend git-svn-id: https://svn.dealii.org/trunk@29157 0785d39b-7218-0410-832d-ea1e28bc413d --- .../checks/check_01_compiler_features.cmake | 60 ----------- .../macro_get_cxx_source_return_value.cmake | 59 ----------- deal.II/include/deal.II/base/config.h.in | 10 -- deal.II/source/grid/tria_levels.cc | 66 +----------- deal.II/source/grid/tria_objects.cc | 100 ++---------------- 5 files changed, 16 insertions(+), 279 deletions(-) delete mode 100644 deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake diff --git a/deal.II/cmake/checks/check_01_compiler_features.cmake b/deal.II/cmake/checks/check_01_compiler_features.cmake index d0249fba67..8b4ec89a2e 100644 --- a/deal.II/cmake/checks/check_01_compiler_features.cmake +++ b/deal.II/cmake/checks/check_01_compiler_features.cmake @@ -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 - int main () { - std::vector 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 -# -# - Matthias Maier, rewritten 2012 -# -IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) - GET_CXX_SOURCE_RETURN_VALUE( - " - #include - int main () { - std::vector 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 index 25b824ebab..0000000000 --- a/deal.II/cmake/macros/macro_get_cxx_source_return_value.cmake +++ /dev/null @@ -1,59 +0,0 @@ -##### -## -## Copyright (C) 2012 by the deal.II authors -## -## This file is part of the deal.II library. -## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. -## -## Author: Matthias Maier -## -##### - -# -# 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() diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 9e2960ad17..9e21898d66 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -73,16 +73,6 @@ */ #cmakedefine __PRETTY_FUNCTION__ @__PRETTY_FUNCTION__@ -/* Set to the minimal number of elements a std::vector 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 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. diff --git a/deal.II/source/grid/tria_levels.cc b/deal.II/source/grid/tria_levels.cc index 6ea73f95dc..c438a8578e 100644 --- a/deal.II/source/grid/tria_levels.cc +++ b/deal.II/source/grid/tria_levels.cc @@ -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::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()::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() >::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 >::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() >::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()::lines_per_cell == line_orientations.size(), ExcMemoryInexact (cells.size() * GeometryInfo<2>::lines_per_cell, -- 2.39.5