OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE > Class Template Reference

#include <particleManager.h>

+ Collaboration diagram for olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >:

Public Member Functions

 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))
 
template<typename ... TASKLIST>
void execute (T timeStepSize)
 
template<typename ... TASKLIST>
void execute ()
 
const communication::ParticleCommunicatorgetParticleCommunicator ()
 
void setExternalAcceleration (const Vector< T, PARTICLETYPE::d > &externalAcceleration)
 Set external acceleration.
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename PARTICLETYPE>
class olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >

Definition at line 42 of file particleManager.h.

Constructor & Destructor Documentation

◆ ParticleManager()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >::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) )

Definition at line 39 of file particleManager.hh.

46 : _xParticleSystem(xParticleSystem), _sGeometry(sGeometry),
47 _sLattice(sLattice), _converter(converter), _externalAcceleration(externalAcceleration),
48 _periodic(periodic)
49{}

Member Function Documentation

◆ execute() [1/2]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
template<typename ... TASKLIST>
void olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >::execute ( )

Definition at line 164 of file particleManager.hh.

164{ execute<TASKLIST...>(_converter.getPhysDeltaT()); }

◆ execute() [2/2]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
template<typename ... TASKLIST>
void olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >::execute ( T timeStepSize)

Definition at line 86 of file particleManager.hh.

86 {
87#ifdef VERBOSE_PARTICLEMANAGER
88 OstreamManager clout( std::cout,"ParticleManager" );
89 clout << "TASKLIST:" << std::endl;
91#endif
92 //Create meta::list of TASKLIST parameter pack
93 using taskList = typename meta::list<TASKLIST...>;
94 //Retrieve index sequence for tasks to be executed without loop
95 auto indexSequenceNoLoop =
96 meta::filter_index_sequence<taskList,requires_no_loop>();
97 //Define function for tasks not requiring loop
98 auto executeNoLoopTask = [&](auto task){
99 using TASK = typename decltype(task)::type;
100#ifdef VERBOSE_PARTICLEMANAGER
102 OstreamManager clout( std::cout,"ParticleManager" );
103 if constexpr (access::providesParallelization<PARTICLETYPE>()){
104 clout.setMultiOutput(true);
105 }
106 std::string taskStr = typeid(TASK).name();
107 taskStr.resize(50);
108 clout << "-Task: " << taskStr << std::endl;
109 clout.setMultiOutput(false);
111#endif
112 if constexpr(TASK::latticeCoupling){
113 TASK::execute( _xParticleSystem, _sGeometry, _sLattice, _converter, _periodic );
114 } else {
115 if constexpr (std::is_invocable_v<decltype(TASK::execute),
116 XParticleSystem<T,PARTICLETYPE>&, const T,
117 const communication::ParticleCommunicator&,
118 const Vector<bool,PARTICLETYPE::d>&>)
119 {
120 TASK::execute( _xParticleSystem, _converter.getPhysDeltaX(),
121 _communicator, _periodic);
122 }
123 else {
124 TASK::execute( _xParticleSystem, _communicator);
125 }
126 }
127#ifdef VERBOSE_PARTICLEMANAGER
129#endif
130 };
131 //Define function for sequence of tasks requiring loop
132 auto executeLoopedTasks = [&](auto indexSequence){
133 if constexpr( access::providesParallelization<PARTICLETYPE>() ){
134 //Loop over valid particles
136 conditions::valid_particles>( _xParticleSystem,
137 [&](Particle<T,PARTICLETYPE>& particle,
138 ParticleSystem<T,PARTICLETYPE>& particleSystem, int globiC){
139 //Unpack tasks to be looped
140 unpackTasksLooped<taskList>( particle, timeStepSize, indexSequence, globiC );
141 });
142 } else {
143 //Loop over all particles
144 forParticlesInParticleSystem<T,PARTICLETYPE,conditions::all_particles>( _xParticleSystem,
145 [&](Particle<T,PARTICLETYPE>& particle){
146 //Unpack tasks to be looped
147 unpackTasksLooped<taskList>( particle, timeStepSize, indexSequence, 0 );
148 });
149 }
150 };
151 //Evaluate index sequence and evaluate tasks or tasks sequences
152 //- Example execution:
153 // Direct: T1
154 // Looped: [T2,T3,T4] (iterate taks for same particle)
155 // Direct: T5
156 // Direct: T6
157 // Looped: [T7,T8] (iterate taks for same particle)
158 meta::index_sequence_for_subsequence<taskList>(
159 executeNoLoopTask, executeLoopedTasks, indexSequenceNoLoop);
160}
void synchronizeIO(unsigned tDelay=100, MPI_Comm comm=MPI_COMM_WORLD)
Synchronizes the processes and wait to ensure correct cout order.
std::string name()
Returns distinct name on GCC, Clang and ICC but may return arbitrary garbage as per the standard.
Definition meta.h:100
void forParticlesInSuperParticleSystem(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, F f)
MpiManager & mpi()

References olb::particles::communication::forParticlesInSuperParticleSystem(), olb::singleton::mpi(), olb::OstreamManager::setMultiOutput(), and olb::singleton::MpiManager::synchronizeIO().

+ Here is the call graph for this function:

◆ getParticleCommunicator()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
const communication::ParticleCommunicator & olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >::getParticleCommunicator ( )

Definition at line 167 of file particleManager.hh.

167 {
168 return _communicator;
169}

◆ setExternalAcceleration()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void olb::particles::dynamics::ParticleManager< T, DESCRIPTOR, PARTICLETYPE >::setExternalAcceleration ( const Vector< T, PARTICLETYPE::d > & externalAcceleration)

Set external acceleration.

Definition at line 172 of file particleManager.hh.

173{
174 _externalAcceleration = externalAcceleration;
175}

The documentation for this class was generated from the following files: