Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particle data cleanup #3232

Merged
merged 5 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/core/particle_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
45 changes: 2 additions & 43 deletions src/core/particle_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -214,7 +211,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] +
Expand Down Expand Up @@ -347,9 +344,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;
Expand Down Expand Up @@ -397,38 +392,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 <typename Size> void memmove(Particle *, Particle *, Size) {
static_assert(sizeof(Size) == 0, "Particles can not be copied like this.");
}
template <typename Size> void memmove(Particle *, Particle const *, Size) {
static_assert(sizeof(Size) == 0, "Particles can not be copied like this.");
}

template <typename Size> void memcpy(Particle *, Particle *, Size) {
static_assert(sizeof(Size) == 0, "Particles can not be copied like this.");
}
template <typename Size> void memcpy(Particle *, Particle const *, Size) {
static_assert(sizeof(Size) == 0, "Particles can not be copied like this.");
}

template <typename Size, typename... Ts>
void MPI_Send(Particle *, Size, Ts...) {
static_assert(sizeof(Size) == 0, "Particles can not be copied like this.");
}

template <typename Size, typename... Ts>
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, ...
Expand Down Expand Up @@ -479,10 +442,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
Expand Down
1 change: 0 additions & 1 deletion src/python/espressomd/particle_data.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down