From: Joe Jordan Date: Thu, 10 Sep 2020 06:42:13 +0000 (+0000) Subject: Replace GMX_ASSERT with assert in vectypes.h X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=1d8625e4d0aed5c2252180d420ea3deeea5f7674;p=alexxy%2Fgromacs.git Replace GMX_ASSERT with assert in vectypes.h 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. --- diff --git a/python_packaging/sample_restraint/src/cpp/ensemblepotential.h b/python_packaging/sample_restraint/src/cpp/ensemblepotential.h index eec2648b28..29ac4a3112 100644 --- a/python_packaging/sample_restraint/src/cpp/ensemblepotential.h +++ b/python_packaging/sample_restraint/src/cpp/ensemblepotential.h @@ -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" diff --git a/src/gromacs/domdec/gpuhaloexchange_impl.cpp b/src/gromacs/domdec/gpuhaloexchange_impl.cpp index a6a0915fc7..eaffb5d371 100644 --- a/src/gromacs/domdec/gpuhaloexchange_impl.cpp +++ b/src/gromacs/domdec/gpuhaloexchange_impl.cpp @@ -48,6 +48,7 @@ #include "config.h" #include "gromacs/domdec/gpuhaloexchange.h" +#include "gromacs/utility/gmxassert.h" #if !GMX_GPU_CUDA diff --git a/src/gromacs/math/vectypes.h b/src/gromacs/math/vectypes.h index 7db36cee58..d4d5211d11 100644 --- a/src/gromacs/math/vectypes.h +++ b/src/gromacs/math/vectypes.h @@ -38,12 +38,12 @@ #ifndef GMX_MATH_VECTYPES_H #define GMX_MATH_VECTYPES_H +#include #include #include #include -#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 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& 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 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; } diff --git a/src/gromacs/mdlib/stat.cpp b/src/gromacs/mdlib/stat.cpp index 60d6445f2d..2c8c6b44d0 100644 --- a/src/gromacs/mdlib/stat.cpp +++ b/src/gromacs/mdlib/stat.cpp @@ -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 */ { diff --git a/src/gromacs/mdlib/stat.h b/src/gromacs/mdlib/stat.h index 6293f77690..d69d5ceaef 100644 --- a/src/gromacs/mdlib/stat.h +++ b/src/gromacs/mdlib/stat.h @@ -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 */