Replace GMX_ASSERT with assert in vectypes.h
authorJoe Jordan <ejjordan12@gmail.com>
Thu, 10 Sep 2020 06:42:13 +0000 (06:42 +0000)
committerArtem Zhmurov <zhmurov@gmail.com>
Thu, 10 Sep 2020 06:42:13 +0000 (06:42 +0000)
It is inappropriate to have a wrapper around assert in a public API.
This change removes dependence on GMX_ASSERT in one component of the
installed API. Transient dependencies related to inclusion of
gmxassert.h in vectypes.h are also removed.

python_packaging/sample_restraint/src/cpp/ensemblepotential.h
src/gromacs/domdec/gpuhaloexchange_impl.cpp
src/gromacs/math/vectypes.h
src/gromacs/mdlib/stat.cpp
src/gromacs/mdlib/stat.h

index eec2648b28ee36f4c17d57e447e83e67afd18d1f..29ac4a3112c5c7820faf52abd2e338f75d45e1b6 100644 (file)
@@ -27,6 +27,7 @@
 #include "gmxapi/md/mdmodule.h"
 
 #include "gromacs/restraint/restraintpotential.h"
+#include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
 
 #include "sessionresources.h"
index a6a0915fc789fcd26ea847971a201bcf060e7e88..eaffb5d37111f99c7a04c78743b3234a20ffeae4 100644 (file)
@@ -48,6 +48,7 @@
 #include "config.h"
 
 #include "gromacs/domdec/gpuhaloexchange.h"
+#include "gromacs/utility/gmxassert.h"
 
 #if !GMX_GPU_CUDA
 
index 7db36cee58bae9956af6a359173d1ca03188bcc5..d4d5211d11040df051f044d22918d33a4caf5588 100644 (file)
 #ifndef GMX_MATH_VECTYPES_H
 #define GMX_MATH_VECTYPES_H
 
+#include <cassert>
 #include <cmath>
 
 #include <algorithm>
 #include <type_traits>
 
-#include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/real.h"
 
 #define XX 0 /* Defines for indexing in */
@@ -146,7 +146,7 @@ public:
     //! Allow vector scalar division
     BasicVector<ValueType> operator/(const ValueType& right) const
     {
-        GMX_ASSERT(right != 0, "Cannot divide by zero");
+        assert((right != 0 && "Cannot divide by zero"));
 
         return *this * (1 / right);
     }
@@ -162,7 +162,7 @@ public:
     //! Divide vector by a scalar
     BasicVector<ValueType>& operator/=(const ValueType& right)
     {
-        GMX_ASSERT(right != 0, "Cannot divide by zero");
+        assert((right != 0 && "Cannot divide by zero"));
 
         return *this *= 1 / right;
     }
@@ -184,7 +184,7 @@ public:
     BasicVector<ValueType> unitVector() const
     {
         const ValueType vectorNorm = norm();
-        GMX_ASSERT(vectorNorm != 0, "unitVector() should not be called with a zero vector");
+        assert((vectorNorm != 0 && "unitVector() should not be called with a zero vector"));
 
         return *this / vectorNorm;
     }
index 60d6445f2d1641ae6952449568c3e8dd4fdc58e6..2c8c6b44d0cdca0556f237f9d9cc5b853f35c8b8 100644 (file)
@@ -148,7 +148,7 @@ void global_stat(const gmx_global_stat*  gs,
                  int                     nsig,
                  real*                   sig,
                  int*                    totalNumberOfBondedInteractions,
-                 gmx_bool                bSumEkinhOld,
+                 bool                    bSumEkinhOld,
                  int                     flags)
 /* instead of current system, gmx_booleans for summing virial, kinetic energy, and other terms */
 {
index 6293f776906ee947c75f21d0f1d21784651b463f..d69d5ceaef0240f92d64e1361e87d6d02e268ef2 100644 (file)
@@ -71,7 +71,7 @@ void global_stat(const gmx_global_stat*  gs,
                  int                     nsig,
                  real*                   sig,
                  int*                    totalNumberOfBondedInteractions,
-                 gmx_bool                bSumEkinhOld,
+                 bool                    bSumEkinhOld,
                  int                     flags);
 
 /*! \brief Returns TRUE if io should be done */