+
+
+
dnl -------------------------------------------------------------
dnl gcc versions up to 2.95.3 had a problem with the std::advance function,
dnl when the number of steps forward was given by an unsigned number, since
+dnl -------------------------------------------------------------
+dnl
+dnl Usage: DEAL_II_CHECK_MIN_VECTOR_CAPACITY
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_MIN_VECTOR_CAPACITY, dnl
+[
+ AC_LANG(C++)
+ CXXFLAGS="$CXXFLAGSG -Werror"
+
+ AC_MSG_CHECKING(for minimal std::vector<T> capacity)
+ AC_TRY_RUN(
+ [
+#include <vector>
+int main () {
+ std::vector<int> v(1);
+ v.reserve (1);
+ v.resize (1);
+ return v.capacity();
+}
+ ],
+ [
+ dnl That's impossible: the return value can't be zero!
+ AC_MSG_ERROR(impossible result -- aborting)
+ ],
+ [
+ result="$?"
+ AC_MSG_RESULT($result)
+ AC_DEFINE_UNQUOTED(DEAL_II_MIN_VECTOR_CAPACITY, $result,
+ [Set to the minimal number of elements a std::vector<T> can
+ always hold, i.e. its minimal capacity.])
+ ]
+ )
+
+ dnl Do same thing with std::vector<bool>
+ AC_MSG_CHECKING(for minimal std::vector<bool> capacity)
+ AC_TRY_RUN(
+ [
+#include <vector>
+int main () {
+ std::vector<bool> v(1);
+ v.reserve (1);
+ v.resize (1);
+ return v.capacity();
+}
+ ],
+ [
+ dnl That's impossible: the return value can't be zero!
+ AC_MSG_ERROR(impossible result -- aborting)
+ ],
+ [
+ result="$?"
+ AC_MSG_RESULT($result)
+ AC_DEFINE_UNQUOTED(DEAL_II_MIN_BOOL_VECTOR_CAPACITY, $result,
+ [Set to the minimal number of elements a std::vector<bool> can
+ always hold, i.e. its minimal capacity.])
+ ]
+ )
+])
+
+
+
dnl -------------------------------------------------------------
dnl Check whether the numeric_limits classes are available
dnl
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ CXXFLAGS="$CXXFLAGSG -Werror"
+
+ echo "$as_me:$LINENO: checking for minimal std::vector<T> capacity" >&5
+echo $ECHO_N "checking for minimal std::vector<T> capacity... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <vector>
+int main () {
+ std::vector<int> v(1);
+ v.reserve (1);
+ v.resize (1);
+ return v.capacity();
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { { echo "$as_me:$LINENO: error: impossible result -- aborting" >&5
+echo "$as_me: error: impossible result -- aborting" >&2;}
+ { (exit 1); exit 1; }; }
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+ result="$?"
+ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define DEAL_II_MIN_VECTOR_CAPACITY $result
+_ACEOF
+
+
+
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+ echo "$as_me:$LINENO: checking for minimal std::vector<bool> capacity" >&5
+echo $ECHO_N "checking for minimal std::vector<bool> capacity... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <vector>
+int main () {
+ std::vector<bool> v(1);
+ v.reserve (1);
+ v.resize (1);
+ return v.capacity();
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { { echo "$as_me:$LINENO: error: impossible result -- aborting" >&5
+echo "$as_me: error: impossible result -- aborting" >&2;}
+ { (exit 1); exit 1; }; }
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+ result="$?"
+ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define DEAL_II_MIN_BOOL_VECTOR_CAPACITY $result
+_ACEOF
+
+
+
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
echo "$as_me:$LINENO: checking whether getrusage is properly declared" >&5
echo $ECHO_N "checking whether getrusage is properly declared... $ECHO_C" >&6
ac_ext=cc
// as many elements as an integer
// has bits
Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 ||
- refine_flags.size()<256,
+ refine_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("refine_flags",
refine_flags.size(), refine_flags.capacity()));
Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
- coarsen_flags.size()<256,
+ coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("coarsen_flags",
coarsen_flags.size(), coarsen_flags.capacity()));
Assert (neighbors.size() == neighbors.capacity() ||
- neighbors.size()<256,
+ neighbors.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("neighbors",
neighbors.size(), neighbors.capacity()));
Assert (subdomain_ids.size() == subdomain_ids.capacity() ||
- subdomain_ids.size()<256,
+ subdomain_ids.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("subdomain_ids",
subdomain_ids.size(), subdomain_ids.capacity()));
Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
// as many elements as an integer
// has bits
Assert (lines.lines.size() == lines.lines.capacity() ||
- lines.lines.size()<256,
+ lines.lines.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("lines",
lines.lines.size(), lines.lines.capacity()));
Assert (lines.children.size() == lines.children.capacity() ||
- lines.children.size()<256,
+ lines.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("children",
lines.children.size(), lines.children.capacity()));
Assert (lines.used.size() <= lines.used.capacity() + sizeof(int)*8 ||
- lines.used.size()<256,
+ lines.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("used",
lines.used.size(), lines.used.capacity()));
Assert (lines.user_flags.size() <= lines.user_flags.capacity() + sizeof(int)*8 ||
- lines.user_flags.size()<256,
+ lines.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("user_flags",
lines.user_flags.size(), lines.user_flags.capacity()));
Assert (lines.lines.size() == lines.used.size(),
// as many elements as an integer
// has bits
Assert (quads.quads.size() == quads.quads.capacity() ||
- quads.quads.size()<256,
+ quads.quads.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("quads",
quads.quads.size(), quads.quads.capacity()));
Assert (quads.children.size() == quads.children.capacity() ||
- quads.children.size()<256,
+ quads.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("children",
quads.children.size(), quads.children.capacity()));
Assert (quads.used.size() <= quads.used.capacity() + sizeof(int)*8 ||
- quads.used.size()<256,
+ quads.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("used",
quads.used.size(), quads.used.capacity()));
Assert (quads.user_flags.size() <= quads.user_flags.capacity() + sizeof(int)*8 ||
- quads.user_flags.size()<256,
+ quads.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("user_flags",
quads.user_flags.size(), quads.user_flags.capacity()));
Assert (quads.quads.size() == quads.used.size(),
hexes.user_pointers.reserve (new_size);
hexes.user_pointers.insert (hexes.user_pointers.end(),
new_size-hexes.user_pointers.size(), 0);
+
+ hexes.face_orientations.reserve (new_size * GeometryInfo<3>::faces_per_cell);
+ hexes.face_orientations.insert (hexes.face_orientations.end(),
+ new_size * GeometryInfo<3>::faces_per_cell
+ - hexes.face_orientations.size(),
+ true);
};
}
// as many elements as an integer
// has bits
Assert (hexes.hexes.size() == hexes.hexes.capacity() ||
- hexes.hexes.size()<256,
+ hexes.hexes.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("hexes",
hexes.hexes.size(), hexes.hexes.capacity()));
Assert (hexes.children.size() == hexes.children.capacity() ||
- hexes.children.size()<256,
+ hexes.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
ExcMemoryWasted ("children",
hexes.children.size(), hexes.children.capacity()));
Assert (hexes.used.size() <= hexes.used.capacity() + sizeof(int)*8 ||
- hexes.used.size()<256,
+ hexes.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("used",
hexes.used.size(), hexes.used.capacity()));
Assert (hexes.user_flags.size() <= hexes.user_flags.capacity() + sizeof(int)*8 ||
- hexes.user_flags.size()<256,
+ hexes.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
ExcMemoryWasted ("user_flags",
hexes.user_flags.size(), hexes.user_flags.capacity()));
Assert (hexes.hexes.size() == hexes.used.size(),
ExcMemoryInexact (hexes.hexes.size(), hexes.material_id.size()));
Assert (hexes.hexes.size() == hexes.user_pointers.size(),
ExcMemoryInexact (hexes.hexes.size(), hexes.user_pointers.size()));
+ Assert (hexes.hexes.size() * GeometryInfo<3>::faces_per_cell
+ == hexes.face_orientations.size(),
+ ExcMemoryInexact (hexes.hexes.size() * GeometryInfo<3>::faces_per_cell,
+ hexes.face_orientations.size()));
TriangulationLevel<2>::monitor_memory (true_dimension);
}
MemoryConsumption::memory_consumption (hexes.used) +
MemoryConsumption::memory_consumption (hexes.user_flags) +
MemoryConsumption::memory_consumption (hexes.material_id) +
- MemoryConsumption::memory_consumption (hexes.user_pointers));
+ MemoryConsumption::memory_consumption (hexes.user_pointers) +
+ MemoryConsumption::memory_consumption (hexes.face_orientations));
}