/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2009,2010,2011,2012,2013,2014, 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.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_selection
*/
-#include <string.h>
+#include "gmxpre.h"
+
+#include "position.h"
-#include "gromacs/legacyheaders/smalloc.h"
-#include "gromacs/legacyheaders/typedefs.h"
-#include "gromacs/legacyheaders/vec.h"
+#include <string.h>
+#include "gromacs/math/vec.h"
#include "gromacs/selection/indexutil.h"
-#include "gromacs/selection/position.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/smalloc.h"
-/*!
- * \param[out] pos Output structure.
- *
- * Any contents of \p pos are discarded without freeing.
- */
-void
-gmx_ana_pos_clear(gmx_ana_pos_t *pos)
+gmx_ana_pos_t::gmx_ana_pos_t()
{
- pos->x = NULL;
- pos->v = NULL;
- pos->f = NULL;
- gmx_ana_indexmap_clear(&pos->m);
- pos->nalloc_x = 0;
+ x = NULL;
+ v = NULL;
+ f = NULL;
+ gmx_ana_indexmap_clear(&m);
+ nalloc_x = 0;
+}
+
+gmx_ana_pos_t::~gmx_ana_pos_t()
+{
+ sfree(x);
+ sfree(v);
+ sfree(f);
+ gmx_ana_indexmap_deinit(&m);
}
/*!
void
gmx_ana_pos_init_const(gmx_ana_pos_t *pos, const rvec x)
{
- gmx_ana_pos_clear(pos);
snew(pos->x, 1);
snew(pos->v, 1);
snew(pos->f, 1);
gmx_ana_indexmap_init(&pos->m, NULL, NULL, INDEX_UNKNOWN);
}
-/*!
- * \param[in,out] pos Position data structure.
- *
- * Frees any memory allocated within \p pos.
- * The pointer \p pos itself is not freed.
- *
- * \see gmx_ana_pos_free()
- */
-void
-gmx_ana_pos_deinit(gmx_ana_pos_t *pos)
-{
- sfree(pos->x); pos->x = NULL;
- sfree(pos->v); pos->v = NULL;
- sfree(pos->f); pos->f = NULL;
- pos->nalloc_x = 0;
- gmx_ana_indexmap_deinit(&pos->m);
-}
-
-/*!
- * \param[in,out] pos Position data structure.
- *
- * Frees any memory allocated for \p pos.
- * The pointer \p pos is also freed, and is invalid after the call.
- *
- * \see gmx_ana_pos_deinit()
- */
-void
-gmx_ana_pos_free(gmx_ana_pos_t *pos)
-{
- gmx_ana_pos_deinit(pos);
- sfree(pos);
-}
-
/*!
* \param[in,out] dest Destination positions.
* \param[in] src Source positions.