Unverified Commit c64a2ecf authored by Kai Szuttor's avatar Kai Szuttor Committed by GitHub

Merge pull request #2390 from hmenke/engine

Only copy_v_cs_from_GPU if there are swimming particles
parents aee34399 fe512ce1
Pipeline #4387 passed with stages
in 60 minutes and 33 seconds
......@@ -76,6 +76,7 @@ void add_id_to_type_map(int part_id, int type);
int max_seen_particle = -1;
int n_part = 0;
bool swimming_particles_exist = false;
/**
* @brief id -> rank
*/
......
......@@ -479,6 +479,8 @@ struct ParticleList {
extern int max_seen_particle;
/** total number of particles on all nodes. */
extern int n_part;
/** flag that active swimming particles exist */
extern bool swimming_particles_exist;
/** id->particle mapping on all nodes. This is used to find partners
of bonded interactions. */
......
......@@ -294,7 +294,7 @@ void convert_torques_propagate_omega() {
fprintf(stderr, "%d: convert_torques_propagate_omega:\n", this_node));
#if defined(LB_GPU) && defined(ENGINE)
if (lattice_switch & LATTICE_LB_GPU) {
if ((lattice_switch & LATTICE_LB_GPU) && swimming_particles_exist) {
copy_v_cs_from_GPU(local_cells.particles());
}
#endif
......
......@@ -73,6 +73,7 @@ cdef extern from "domain_decomposition.hpp":
cdef extern from "particle_data.hpp":
extern int n_part
extern bool swimming_particles_exist
cdef extern from "nonbonded_interactions/nonbonded_interaction_data.hpp":
double dpd_gamma
......
......@@ -28,7 +28,7 @@ from .interactions import BondedInteraction
from .interactions import BondedInteractions
from .interactions cimport bonded_ia_params
from copy import copy
from globals cimport max_seen_particle, time_step, box_l, n_part, n_rigidbonds, max_seen_particle_type
from globals cimport max_seen_particle, time_step, box_l, n_part, n_rigidbonds, max_seen_particle_type, swimming_particles_exist
import collections
import functools
import types
......@@ -1273,6 +1273,7 @@ cdef class ParticleHandle(object):
"""
def __set__(self, _params):
global swimming_particles_exist
cdef particle_parameters_swimming swim
swim.swimming = True
swim.v_swim = 0.0
......@@ -1325,6 +1326,9 @@ cdef class ParticleHandle(object):
swim.rotational_friction = _params[
'rotational_friction']
if swim.f_swim != 0 or swim.v_swim != 0:
swimming_particles_exist = True
if set_particle_swimming(self._id, swim) == 1:
raise Exception("Set particle position first.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment