HAVE_*SQRT*. This is no problem with public headers because
it is OK if user code uses a different rsqrt implementation */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#include <math.h>
-#include "units.h"
-#include "utilities.h"
-#include "vectypes.h"
-
-#include "../utility/basedefinitions.h"
-#include "../utility/fatalerror.h"
-#include "../utility/real.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/utilities.h"
+#include "gromacs/math/vectypes.h"
+#include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/real.h"
#ifdef __cplusplus
extern "C" {
b[ZZ] = a[ZZ];
}
-static gmx_inline void copy_rvecn(rvec *a, rvec *b, int startn, int endn)
+static gmx_inline void copy_rvecn(gmx_cxx_const rvec *a, rvec *b, int startn, int endn)
{
int i;
for (i = startn; i < endn; i++)
c[ZZ] = z;
}
-static gmx_inline void copy_mat(matrix a, matrix b)
+static gmx_inline void copy_mat(gmx_cxx_const matrix a, matrix b)
{
copy_rvec(a[XX], b[XX]);
copy_rvec(a[YY], b[YY]);
return atan2(wlen, s);
}
-static gmx_inline void mmul_ur0(matrix a, matrix b, matrix dest)
+static gmx_inline void mmul_ur0(gmx_cxx_const matrix a, gmx_cxx_const matrix b, matrix dest)
{
dest[XX][XX] = a[XX][XX]*b[XX][XX];
dest[XX][YY] = 0.0;
dest[ZZ][ZZ] = a[ZZ][ZZ]*b[ZZ][ZZ];
}
-static gmx_inline void mmul(matrix a, matrix b, matrix dest)
+static gmx_inline void mmul(gmx_cxx_const matrix a, gmx_cxx_const matrix b, matrix dest)
{
dest[XX][XX] = a[XX][XX]*b[XX][XX]+a[XX][YY]*b[YY][XX]+a[XX][ZZ]*b[ZZ][XX];
dest[YY][XX] = a[YY][XX]*b[XX][XX]+a[YY][YY]*b[YY][XX]+a[YY][ZZ]*b[ZZ][XX];
dest[ZZ][ZZ] = a[ZZ][XX]*b[XX][ZZ]+a[ZZ][YY]*b[YY][ZZ]+a[ZZ][ZZ]*b[ZZ][ZZ];
}
-static gmx_inline void transpose(matrix src, matrix dest)
+static gmx_inline void transpose(gmx_cxx_const matrix src, matrix dest)
{
dest[XX][XX] = src[XX][XX];
dest[YY][XX] = src[XX][YY];
dest[ZZ][ZZ] = src[ZZ][ZZ];
}
-static gmx_inline void tmmul(matrix a, matrix b, matrix dest)
+static gmx_inline void tmmul(gmx_cxx_const matrix a, gmx_cxx_const matrix b, matrix dest)
{
/* Computes dest=mmul(transpose(a),b,dest) - used in do_pr_pcoupl */
dest[XX][XX] = a[XX][XX]*b[XX][XX]+a[YY][XX]*b[YY][XX]+a[ZZ][XX]*b[ZZ][XX];
dest[ZZ][ZZ] = a[XX][ZZ]*b[XX][ZZ]+a[YY][ZZ]*b[YY][ZZ]+a[ZZ][ZZ]*b[ZZ][ZZ];
}
-static gmx_inline void mtmul(matrix a, matrix b, matrix dest)
+static gmx_inline void mtmul(gmx_cxx_const matrix a, gmx_cxx_const matrix b, matrix dest)
{
/* Computes dest=mmul(a,transpose(b),dest) - used in do_pr_pcoupl */
dest[XX][XX] = a[XX][XX]*b[XX][XX]+a[XX][YY]*b[XX][YY]+a[XX][ZZ]*b[XX][ZZ];
dest[ZZ][ZZ] = a[ZZ][XX]*b[ZZ][XX]+a[ZZ][YY]*b[ZZ][YY]+a[ZZ][ZZ]*b[ZZ][ZZ];
}
-static gmx_inline real det(matrix a)
+static gmx_inline real det(gmx_cxx_const matrix a)
{
return ( a[XX][XX]*(a[YY][YY]*a[ZZ][ZZ]-a[ZZ][YY]*a[YY][ZZ])
-a[YY][XX]*(a[XX][YY]*a[ZZ][ZZ]-a[ZZ][YY]*a[XX][ZZ])
}
-static gmx_inline void m_add(matrix a, matrix b, matrix dest)
+static gmx_inline void m_add(gmx_cxx_const matrix a, gmx_cxx_const matrix b, matrix dest)
{
dest[XX][XX] = a[XX][XX]+b[XX][XX];
dest[XX][YY] = a[XX][YY]+b[XX][YY];
dest[ZZ][ZZ] = a[ZZ][ZZ]+b[ZZ][ZZ];
}
-static gmx_inline void m_sub(matrix a, matrix b, matrix dest)
+static gmx_inline void m_sub(gmx_cxx_const matrix a, gmx_cxx_const matrix b, matrix dest)
{
dest[XX][XX] = a[XX][XX]-b[XX][XX];
dest[XX][YY] = a[XX][YY]-b[XX][YY];
dest[ZZ][ZZ] = a[ZZ][ZZ]-b[ZZ][ZZ];
}
-static gmx_inline void msmul(matrix m1, real r1, matrix dest)
+static gmx_inline void msmul(gmx_cxx_const matrix m1, real r1, matrix dest)
{
dest[XX][XX] = r1*m1[XX][XX];
dest[XX][YY] = r1*m1[XX][YY];
dest[ZZ][ZZ] = r1*m1[ZZ][ZZ];
}
-static gmx_inline void m_inv_ur0(matrix src, matrix dest)
+static gmx_inline void m_inv_ur0(gmx_cxx_const matrix src, matrix dest)
{
double tmp = src[XX][XX]*src[YY][YY]*src[ZZ][ZZ];
if (fabs(tmp) <= 100*GMX_REAL_MIN)
dest[YY][ZZ] = 0.0;
}
-static gmx_inline void m_inv(matrix src, matrix dest)
+static gmx_inline void m_inv(gmx_cxx_const matrix src, matrix dest)
{
const real smallreal = (real)1.0e-24;
const real largereal = (real)1.0e24;
dest[ZZ][ZZ] = c*(src[XX][XX]*src[YY][YY]-src[YY][XX]*src[XX][YY]);
}
-static gmx_inline void mvmul(matrix a, const rvec src, rvec dest)
+static gmx_inline void mvmul(gmx_cxx_const matrix a, const rvec src, rvec dest)
{
dest[XX] = a[XX][XX]*src[XX]+a[XX][YY]*src[YY]+a[XX][ZZ]*src[ZZ];
dest[YY] = a[YY][XX]*src[XX]+a[YY][YY]*src[YY]+a[YY][ZZ]*src[ZZ];
}
-static gmx_inline void mvmul_ur0(matrix a, const rvec src, rvec dest)
+static gmx_inline void mvmul_ur0(gmx_cxx_const matrix a, const rvec src, rvec dest)
{
dest[ZZ] = a[ZZ][XX]*src[XX]+a[ZZ][YY]*src[YY]+a[ZZ][ZZ]*src[ZZ];
dest[YY] = a[YY][XX]*src[XX]+a[YY][YY]*src[YY];
dest[XX] = a[XX][XX]*src[XX];
}
-static gmx_inline void tmvmul_ur0(matrix a, const rvec src, rvec dest)
+static gmx_inline void tmvmul_ur0(gmx_cxx_const matrix a, const rvec src, rvec dest)
{
dest[XX] = a[XX][XX]*src[XX]+a[YY][XX]*src[YY]+a[ZZ][XX]*src[ZZ];
dest[YY] = a[YY][YY]*src[YY]+a[ZZ][YY]*src[ZZ];
dest[ZZ] = linv*src[ZZ];
}
-static void calc_lll(rvec box, rvec lll)
+static void calc_lll(const rvec box, rvec lll)
{
lll[XX] = 2.0*M_PI/box[XX];
lll[YY] = 2.0*M_PI/box[YY];
lll[ZZ] = 2.0*M_PI/box[ZZ];
}
-static gmx_inline real trace(matrix m)
+static gmx_inline real trace(gmx_cxx_const matrix m)
{
return (m[XX][XX]+m[YY][YY]+m[ZZ][ZZ]);
}
}
/* Operations on multidimensional rvecs, used e.g. in edsam.c */
-static gmx_inline void m_rveccopy(int dim, rvec *a, rvec *b)
+static gmx_inline void m_rveccopy(int dim, gmx_cxx_const rvec *a, rvec *b)
{
/* b = a */
int i;
}
/*computer matrix vectors from base vectors and angles */
-static gmx_inline void matrix_convert(matrix box, rvec vec, rvec angle)
+static gmx_inline void matrix_convert(matrix box, const rvec vec, rvec angle)
{
svmul(DEG2RAD, angle, angle);
box[XX][XX] = vec[XX];
#ifdef __cplusplus
}
-
-static gmx_inline real det(const matrix a)
-{
- return ( a[XX][XX]*(a[YY][YY]*a[ZZ][ZZ]-a[ZZ][YY]*a[YY][ZZ])
- -a[YY][XX]*(a[XX][YY]*a[ZZ][ZZ]-a[ZZ][YY]*a[XX][ZZ])
- +a[ZZ][XX]*(a[XX][YY]*a[YY][ZZ]-a[YY][YY]*a[XX][ZZ]));
-}
-
-static gmx_inline void mvmul(const matrix a, const rvec src, rvec dest)
-{
- dest[XX] = a[XX][XX]*src[XX]+a[XX][YY]*src[YY]+a[XX][ZZ]*src[ZZ];
- dest[YY] = a[YY][XX]*src[XX]+a[YY][YY]*src[YY]+a[YY][ZZ]*src[ZZ];
- dest[ZZ] = a[ZZ][XX]*src[XX]+a[ZZ][YY]*src[YY]+a[ZZ][ZZ]*src[ZZ];
-}
-
-static gmx_inline void tmvmul_ur0(const matrix a, const rvec src, rvec dest)
-{
- dest[XX] = a[XX][XX]*src[XX]+a[YY][XX]*src[YY]+a[ZZ][XX]*src[ZZ];
- dest[YY] = a[YY][YY]*src[YY]+a[ZZ][YY]*src[ZZ];
- dest[ZZ] = a[ZZ][ZZ]*src[ZZ];
-}
-
#endif
#endif