Reduce transitive dependencies in arrayref.h
authorSebastian Keller <sebkelle@ethz.ch>
Tue, 15 Sep 2020 09:09:45 +0000 (11:09 +0200)
committerSebastian Keller <sebkelle@ethz.ch>
Wed, 16 Sep 2020 13:11:54 +0000 (15:11 +0200)
Reduce transitive dependencies on other GROMACS headers.
* Replace `GMX_ASSERT` with `assert`
* Replace `index` with `difference_type`

Refs #3674

src/gromacs/ewald/pme_force_sender_gpu_impl.cpp
src/gromacs/ewald/pme_internal.h
src/gromacs/gmxana/pp2shift.cpp
src/gromacs/gpu_utils/tests/devicetransfers.cpp
src/gromacs/mdlib/update_constrain_gpu_impl.cpp
src/gromacs/mdrunutility/multisim.h
src/gromacs/utility/arrayref.h

index 9a05facec46fe6ad4a4e709b7020cf6a521a057f..a30384a8c28135949ca4238a73ad101a5c2eb6aa 100644 (file)
@@ -49,6 +49,7 @@
 
 #include "gromacs/ewald/pme_force_sender_gpu.h"
 #include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/gmxassert.h"
 
 #if !GMX_GPU_CUDA
 
index 686d63e42456f163c7bac2bf5f126cb60d4d5639..a4af8154de90709f18f06827d9135ec8c5eb1495 100644 (file)
@@ -63,6 +63,7 @@
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/defaultinitializationallocator.h"
+#include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/gmxmpi.h"
 
 #include "spline_vectors.h"
index d27fe4ea3fe29672420decc694b5883fb5464ece..cbb4a0d58a2ba9dcb260bfa992a8432afda264bc 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -46,6 +46,7 @@
 #include "gromacs/math/units.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/pleasecite.h"
 #include "gromacs/utility/smalloc.h"
 
index 9a71a58730e16684463642d71d20e6da3ace3573..18a32ee6f87f02423e6ee42898e1d0249f5f0b3a 100644 (file)
@@ -45,6 +45,7 @@
 #include <algorithm>
 
 #include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/gmxassert.h"
 
 namespace gmx
 {
index d3d50c257896f649724f9936bcb0e89f872e8d4d..e2c7d3e94183eaa09ab1c6c98e6c66ab8cd4ceee 100644 (file)
@@ -45,6 +45,7 @@
 #include "config.h"
 
 #include "gromacs/mdlib/update_constrain_gpu.h"
+#include "gromacs/utility/gmxassert.h"
 
 #if !GMX_GPU_CUDA
 
index 33222ca9b7cd3aedfd0c16bb0e0bdb3453950928..eb0f75bec585f9ff5a8ab8c3a47fa450d6522bed 100644 (file)
@@ -48,6 +48,7 @@
 #include <vector>
 
 #include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/gmxmpi.h"
 
 namespace gmx
index f2c852b9703b40d14507149d376ffd3767fc6c10..5eacdcb672fc1e63e2fbaa497440e4404b770dce 100644 (file)
@@ -47,6 +47,7 @@
 #ifndef GMX_UTILITY_ARRAYREF_H
 #define GMX_UTILITY_ARRAYREF_H
 
+#include <cassert>
 #include <cstddef>
 
 #include <array>
@@ -61,8 +62,6 @@
 #    include <gromacs/external/boost/stl_interfaces/iterator_interface.hpp>
 #endif
 
-#include "gromacs/utility/gmxassert.h"
-
 namespace gmx
 {
 
@@ -193,7 +192,7 @@ public:
      */
     ArrayRef(pointer begin, pointer end) : begin_(begin), end_(end)
     {
-        GMX_ASSERT(end >= begin, "Invalid range");
+        assert((end >= begin && "Invalid range"));
     }
     /*! \brief
      * Constructs a reference to a particular range.
@@ -205,7 +204,7 @@ public:
      */
     ArrayRef(iterator begin, iterator end) : begin_(begin), end_(end)
     {
-        GMX_ASSERT(end >= begin, "Invalid range");
+        assert((end >= begin && "Invalid range"));
     }
     //! \cond
     // Doxygen 1.8.5 doesn't parse the declaration correctly...
@@ -252,7 +251,7 @@ public:
      */
     size_type size() const { return end_ - begin_; }
     //! Returns the signed size of the reference.
-    index ssize() const { return size(); }
+    difference_type ssize() const { return size(); }
     //! Identical to size().
     size_type capacity() const { return end_ - begin_; }
     //! Whether the reference refers to no memory.