24#ifndef PARTICLE_MANAGER_HH
25#define PARTICLE_MANAGER_HH
38template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
46 : _xParticleSystem(xParticleSystem), _sGeometry(sGeometry),
47 _sLattice(sLattice), _converter(converter), _externalAcceleration(externalAcceleration),
52template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
53template<
typename taskList,
typename ISEQ>
58 auto executeTask = [&](
auto task){
60 using TASK =
typename decltype(task)::type;
61#ifdef VERBOSE_PARTICLEMANAGER
63 if constexpr (access::providesParallelization<PARTICLETYPE>()){
64 clout.setMultiOutput(
true);
66 std::string taskStr =
typeid(TASK).name();
68 clout <<
"-TaskLooped(globiC=" << globiC
69 <<
")-Particle " << particle.
getId() <<
": "
70 << taskStr << std::endl;
71 clout.setMultiOutput(
false);
74 if constexpr(TASK::latticeCoupling){
75 TASK::execute( _xParticleSystem, particle, _sGeometry, _sLattice, _converter, globiC, _periodic );
77 TASK::execute( _xParticleSystem, particle, _externalAcceleration, timeStepSize, globiC );
81 meta::list_for_each_index<taskList>(executeTask,indexSequence);
84template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
85template<
typename ...TASKLIST>
87#ifdef VERBOSE_PARTICLEMANAGER
89 clout <<
"TASKLIST:" << std::endl;
93 using taskList =
typename meta::list<TASKLIST...>;
95 auto indexSequenceNoLoop =
96 meta::filter_index_sequence<taskList,requires_no_loop>();
98 auto executeNoLoopTask = [&](
auto task){
99 using TASK =
typename decltype(task)::type;
100#ifdef VERBOSE_PARTICLEMANAGER
103 if constexpr (access::providesParallelization<PARTICLETYPE>()){
106 std::string taskStr =
typeid(TASK).name();
108 clout <<
"-Task: " << taskStr << std::endl;
112 if constexpr(TASK::latticeCoupling){
113 TASK::execute( _xParticleSystem, _sGeometry, _sLattice, _converter, _periodic );
115 if constexpr (std::is_invocable_v<
decltype(TASK::execute),
120 TASK::execute( _xParticleSystem, _converter.getPhysDeltaX(),
121 _communicator, _periodic);
124 TASK::execute( _xParticleSystem, _communicator);
127#ifdef VERBOSE_PARTICLEMANAGER
132 auto executeLoopedTasks = [&](
auto indexSequence){
133 if constexpr( access::providesParallelization<PARTICLETYPE>() ){
140 unpackTasksLooped<taskList>( particle, timeStepSize, indexSequence, globiC );
144 forParticlesInParticleSystem<T,PARTICLETYPE,conditions::all_particles>( _xParticleSystem,
147 unpackTasksLooped<taskList>( particle, timeStepSize, indexSequence, 0 );
158 meta::index_sequence_for_subsequence<taskList>(
159 executeNoLoopTask, executeLoopedTasks, indexSequenceNoLoop);
162template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
163template<
typename ...TASKLIST>
166template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
168 return _communicator;
171template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
174 _externalAcceleration = externalAcceleration;
class for marking output with some text
void setMultiOutput(bool b)
enable message output for all MPI processes, disabled by default
Representation of a statistic for a parallel 2D geometry.
Super class maintaining block lattices for a cuboid decomposition.
Conversion between physical and lattice units, as well as discretization.
std::size_t getId() const
Return memory ID of the currently represented particle.
ParticleManager(XParticleSystem< T, PARTICLETYPE > &xParticleSystem, SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, Vector< T, PARTICLETYPE::d > externalAcceleration=Vector< T, PARTICLETYPE::d >(0.), Vector< bool, PARTICLETYPE::d > periodic=Vector< bool, PARTICLETYPE::d >(false))
const communication::ParticleCommunicator & getParticleCommunicator()
void setExternalAcceleration(const Vector< T, PARTICLETYPE::d > &externalAcceleration)
Set external acceleration.
void synchronizeIO(unsigned tDelay=100, MPI_Comm comm=MPI_COMM_WORLD)
Synchronizes the processes and wait to ensure correct cout order.
void forParticlesInSuperParticleSystem(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, F f)
std::conditional_t< PARTICLETYPE::template providesNested< descriptors::PARALLELIZATION >(), SuperParticleSystem< T, PARTICLETYPE >, ParticleSystem< T, PARTICLETYPE > > XParticleSystem
Top level namespace for all of OpenLB.