From 8ea94b248b956d19b2354f87b498c341dd34557b Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Tue, 1 Oct 2019 17:19:55 +0200 Subject: [PATCH 1/4] particle_data: Cleanup --- src/core/particle_data.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/particle_data.hpp b/src/core/particle_data.hpp index e377247670d..a6742effb38 100644 --- a/src/core/particle_data.hpp +++ b/src/core/particle_data.hpp @@ -219,7 +219,7 @@ struct ParticlePosition { /** quaternions to define particle orientation */ Utils::Vector4d quat = {1., 0., 0., 0.}; /** unit director calculated from the quaternions */ - inline const Utils::Vector3d calc_director() const { + Utils::Vector3d calc_director() const { return {2 * (quat[1] * quat[3] + quat[0] * quat[2]), 2 * (quat[2] * quat[3] - quat[0] * quat[1]), quat[0] * quat[0] - quat[1] * quat[1] - quat[2] * quat[2] + @@ -352,9 +352,7 @@ struct Particle { /// ParticlePosition r; #ifdef DIPOLES - inline const Utils::Vector3d calc_dip() const { - return r.calc_director() * p.dipm; - } + Utils::Vector3d calc_dip() const { return r.calc_director() * p.dipm; } #endif /// ParticleMomentum m; From 482a7368dbe2fa970a94f17836f30c08232b7c83 Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Tue, 1 Oct 2019 17:20:20 +0200 Subject: [PATCH 2/4] particle_data: Removed stop-gap prototypes --- src/core/particle_data.hpp | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/core/particle_data.hpp b/src/core/particle_data.hpp index a6742effb38..6496cce767a 100644 --- a/src/core/particle_data.hpp +++ b/src/core/particle_data.hpp @@ -400,38 +400,6 @@ struct Particle { #endif }; -/** - * These functions cause a compile time error if - * Particles are copied by memmove or memcpy, - * which do not keep class invariants. - * - * These are templates so that the error is caused - * at the place they are used. - */ -template void memmove(Particle *, Particle *, Size) { - static_assert(sizeof(Size) == 0, "Particles can not be copied like this."); -} -template void memmove(Particle *, Particle const *, Size) { - static_assert(sizeof(Size) == 0, "Particles can not be copied like this."); -} - -template void memcpy(Particle *, Particle *, Size) { - static_assert(sizeof(Size) == 0, "Particles can not be copied like this."); -} -template void memcpy(Particle *, Particle const *, Size) { - static_assert(sizeof(Size) == 0, "Particles can not be copied like this."); -} - -template -void MPI_Send(Particle *, Size, Ts...) { - static_assert(sizeof(Size) == 0, "Particles can not be copied like this."); -} - -template -void MPI_Send(Particle const *, Size, Ts...) { - static_assert(sizeof(Size) == 0, "Particles can not be copied like this."); -} - /** List of particles. The particle array is resized using a sophisticated * (we hope) algorithm to avoid unnecessary resizes. * Access using \ref realloc_particlelist, ... From 36d5c72f0bbe98df931dca18386bcada5248396d Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Fri, 4 Oct 2019 12:35:03 +0200 Subject: [PATCH 3/4] core: Removed unused function --- src/core/particle_data.cpp | 6 ------ src/core/particle_data.hpp | 4 ---- 2 files changed, 10 deletions(-) diff --git a/src/core/particle_data.cpp b/src/core/particle_data.cpp index e3a2b482669..fb673880c26 100644 --- a/src/core/particle_data.cpp +++ b/src/core/particle_data.cpp @@ -555,12 +555,6 @@ void realloc_local_particles(int part) { } } -void init_particlelist(ParticleList *pList) { - pList->n = 0; - pList->max = 0; - pList->part = nullptr; -} - int realloc_particlelist(ParticleList *l, int size) { assert(size >= 0); int old_max = l->max; diff --git a/src/core/particle_data.hpp b/src/core/particle_data.hpp index 7751e587677..c3b3ed1aa84 100644 --- a/src/core/particle_data.hpp +++ b/src/core/particle_data.hpp @@ -445,10 +445,6 @@ void free_particle(Particle *part); /* Functions acting on Particle Lists */ /************************************************/ -/** Initialize a particle list. - * Use with care and ONLY for initialization! */ -void init_particlelist(ParticleList *pList); - /** Allocate storage for local particles and ghosts. This version does \em not care for the bond information to be freed if necessary. \param plist the list on which to operate From ce6536f192770dabc92d47806cb63e729c04a49f Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Fri, 4 Oct 2019 14:32:35 +0200 Subject: [PATCH 4/4] core: Removed unused macro --- src/core/particle_data.hpp | 3 --- src/python/espressomd/particle_data.pyx | 1 - 2 files changed, 4 deletions(-) diff --git a/src/core/particle_data.hpp b/src/core/particle_data.hpp index c3b3ed1aa84..4e3a983ab93 100644 --- a/src/core/particle_data.hpp +++ b/src/core/particle_data.hpp @@ -66,9 +66,6 @@ enum { /** \ref ParticleProperties::ext_flag "ext_flag" mask to check whether any of * the coordinates is fixed. */ #define COORDS_FIX_MASK (COORD_FIXED(0) | COORD_FIXED(1) | COORD_FIXED(2)) -/** \ref ParticleProperties::ext_flag "ext_flag" mask to check whether all of - * the coordinates are fixed. */ -#define COORDS_ALL_FIXED (COORD_FIXED(0) & COORD_FIXED(1) & COORD_FIXED(2)) #ifdef ROTATION /** \ref ParticleProperties::ext_flag "ext_flag" value for particle subject to diff --git a/src/python/espressomd/particle_data.pyx b/src/python/espressomd/particle_data.pyx index 6f6c3cfeb67..753a9a160ba 100644 --- a/src/python/espressomd/particle_data.pyx +++ b/src/python/espressomd/particle_data.pyx @@ -43,7 +43,6 @@ def _COORD_FIXED(coord): COORDS_FIX_MASK = _COORD_FIXED(0) | _COORD_FIXED(1) | _COORD_FIXED(2) -COORDS_ALL_FIXED = _COORD_FIXED(0) & _COORD_FIXED(1) & _COORD_FIXED(2) PARTICLE_EXT_TORQUE = 16 ROT_X = 2 ROT_Y = 4