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

#include <superParticleSystem.h>

+ Inheritance diagram for olb::particles::SuperParticleSystem< T, PARTICLETYPE >:
+ Collaboration diagram for olb::particles::SuperParticleSystem< T, PARTICLETYPE >:

Public Member Functions

 SuperParticleSystem (SuperStructure< T, PARTICLETYPE::d > &superStructure, T maximalCircumRadius=T{0.})
 
 SuperParticleSystem (SuperGeometry< T, PARTICLETYPE::d > &superGeometry, T maximalCircumRadius=T{0.})
 Create SuperParticleSystem from SuperGeometry and optional maximal circumference radius (if already known)
 
void print ()
 
void addDynamics (std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > &dynamicsSPtr)
 
template<typename DYNAMICS , typename ... Args>
void defineDynamics (Args &&...args)
 
std::vector< ParticleSystem< T, PARTICLETYPE > * > & getBlockParticleSystems ()
 
SuperStructure< T, PARTICLETYPE::d > & getSuperStructure ()
 
const std::unordered_set< int > & getNeighbourRanks ()
 
const std::unordered_set< int > & getExtendedNeighbourRanks ()
 
const std::vector< std::unordered_set< int > > & getCuboidNeighborhood ()
 
std::size_t getGlobID ()
 
std::size_t getSerialSize () const
 
Particle< T, PARTICLETYPE > get (std::size_t globalParticleID)
 
template<typename PCONDITION = conditions::all_particles>
constexpr std::size_t size ()
 
void checkForErrors ()
 
void updateOffsetFromCircumRadius (T circumRadius)
 

Detailed Description

template<typename T, typename PARTICLETYPE>
class olb::particles::SuperParticleSystem< T, PARTICLETYPE >

Definition at line 32 of file superParticleSystem.h.

Constructor & Destructor Documentation

◆ SuperParticleSystem() [1/2]

template<typename T , typename PARTICLETYPE >
olb::particles::SuperParticleSystem< T, PARTICLETYPE >::SuperParticleSystem ( SuperStructure< T, PARTICLETYPE::d > & superStructure,
T maximalCircumRadius = T{0.} )

Definition at line 32 of file superParticleSystem.hh.

34 : _superStructure(superStructure)
35 , _serialSize(ParticleSystem<T, PARTICLETYPE>(1).getSerialSize())
36 , _maximalCircumRadius(maximalCircumRadius)
37{
38 static_assert(access::providesValid<PARTICLETYPE>(), "Field GENERAL:VALID has to be provided");
39 auto loadBalancer = superStructure.getLoadBalancer();
40 // always create at least one BlockParticleSystem to counteract possible problems
41 // (for example in creator functions, where the first blockParticleSystem is hard coded)
42 _blockParticleSystems.push_back(new ParticleSystem<T, PARTICLETYPE>);
43 for (int iC = 1; iC < loadBalancer.size(); ++iC) {
44 _blockParticleSystems.push_back(new ParticleSystem<T, PARTICLETYPE>);
45 }
46
47 _cuboidNeighborhood.resize(_superStructure.getCuboidGeometry().getNc());
48 updateCuboidNeighborhood();
49}
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.

References olb::SuperStructure< T, D >::getCuboidGeometry(), and olb::SuperStructure< T, D >::getLoadBalancer().

+ Here is the call graph for this function:

◆ SuperParticleSystem() [2/2]

template<typename T , typename PARTICLETYPE >
olb::particles::SuperParticleSystem< T, PARTICLETYPE >::SuperParticleSystem ( SuperGeometry< T, PARTICLETYPE::d > & superGeometry,
T maximalCircumRadius = T{0.} )

Create SuperParticleSystem from SuperGeometry and optional maximal circumference radius (if already known)

Definition at line 52 of file superParticleSystem.hh.

54 : SuperParticleSystem<T, PARTICLETYPE>(
55 static_cast<SuperStructure<T, PARTICLETYPE::d>&>(superGeometry), maximalCircumRadius)
56{}

Member Function Documentation

◆ addDynamics()

template<typename T , typename PARTICLETYPE >
void olb::particles::SuperParticleSystem< T, PARTICLETYPE >::addDynamics ( std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > & dynamicsSPtr)

Definition at line 85 of file superParticleSystem.hh.

87{
88 auto loadBalancer = _superStructure.getLoadBalancer();
89 for (int iC = 0; iC < loadBalancer.size(); ++iC) {
90 auto& bParticleSystem = *_blockParticleSystems[iC];
91 bParticleSystem.addDynamics( dynamicsSPtr );
92 }
93}

◆ checkForErrors()

template<typename T , typename PARTICLETYPE >
void olb::particles::SuperParticleSystem< T, PARTICLETYPE >::checkForErrors ( )

Definition at line 193 of file superParticleSystem.hh.

194{
195 //Check, whether at least one ParticleDynamics present
196#ifdef PARALLEL_MODE_MPI
197 if(singleton::mpi().isMainProcessor()){
198#endif
199 _blockParticleSystems[0]->checkForErrors();
200#ifdef PARALLEL_MODE_MPI
201 }
202#endif
203}
MpiManager & mpi()

References olb::singleton::mpi().

+ Here is the call graph for this function:

◆ defineDynamics()

template<typename T , typename PARTICLETYPE >
template<typename DYNAMICS , typename ... Args>
void olb::particles::SuperParticleSystem< T, PARTICLETYPE >::defineDynamics ( Args &&... args)

Definition at line 97 of file superParticleSystem.hh.

97 {
98 auto loadBalancer = _superStructure.getLoadBalancer();
99 for (int iC = 0; iC < loadBalancer.size(); ++iC) {
100 auto& bParticleSystem = *_blockParticleSystems[iC];
101 bParticleSystem.template defineDynamics<DYNAMICS>( std::forward<Args>(args)... );
102 }
103}

◆ get()

template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > olb::particles::SuperParticleSystem< T, PARTICLETYPE >::get ( std::size_t globalParticleID)

Definition at line 152 of file superParticleSystem.hh.

153{
154 using namespace descriptors;
155
156 for (ParticleSystem<T, PARTICLETYPE>* blockParticleSystem :
157 _blockParticleSystems) {
158 for (std::size_t localiP = 0; localiP < blockParticleSystem->size();
159 ++localiP) {
160 auto particle = blockParticleSystem->get(localiP);
161 const std::size_t currentGlobalParticleID =
162 particle.template getField<PARALLELIZATION, ID>();
163 if (globalParticleID == currentGlobalParticleID) {
164 return particle;
165 }
166 }
167 }
168
169 std::cerr << "ERROR: Rank " << singleton::mpi().getRank()
170 << " cannot find particle with global id " << globalParticleID
171 << std::endl;
172 assert(false);
173 return _blockParticleSystems[0]->get(0);
174}
int getRank() const
Returns the process ID.

References olb::singleton::MpiManager::getRank(), and olb::singleton::mpi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockParticleSystems()

template<typename T , typename PARTICLETYPE >
std::vector< ParticleSystem< T, PARTICLETYPE > * > & olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getBlockParticleSystems ( )

Definition at line 125 of file superParticleSystem.hh.

126{
127 return _blockParticleSystems;
128}
+ Here is the caller graph for this function:

◆ getCuboidNeighborhood()

template<typename T , typename PARTICLETYPE >
const std::vector< std::unordered_set< int > > & olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getCuboidNeighborhood ( )

Definition at line 118 of file superParticleSystem.hh.

119{
120 return _cuboidNeighborhood;
121}

◆ getExtendedNeighbourRanks()

template<typename T , typename PARTICLETYPE >
const std::unordered_set< int > & olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getExtendedNeighbourRanks ( )

Definition at line 112 of file superParticleSystem.hh.

113{
114 return _extendedNeighbourRanks;
115}
+ Here is the caller graph for this function:

◆ getGlobID()

template<typename T , typename PARTICLETYPE >
std::size_t olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID ( )

Definition at line 138 of file superParticleSystem.hh.

139{
140 return _currentGlobalID++;
141}
+ Here is the caller graph for this function:

◆ getNeighbourRanks()

template<typename T , typename PARTICLETYPE >
const std::unordered_set< int > & olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getNeighbourRanks ( )

Definition at line 106 of file superParticleSystem.hh.

107{
108 return _neighbourRanks;
109}
+ Here is the caller graph for this function:

◆ getSerialSize()

template<typename T , typename PARTICLETYPE >
std::size_t olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSerialSize ( ) const

Definition at line 144 of file superParticleSystem.hh.

145{
146 return _serialSize;
147}
+ Here is the caller graph for this function:

◆ getSuperStructure()

template<typename T , typename PARTICLETYPE >
SuperStructure< T, PARTICLETYPE::d > & olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure ( )

Definition at line 132 of file superParticleSystem.hh.

133{
134 return _superStructure;
135}
+ Here is the caller graph for this function:

◆ print()

template<typename T , typename PARTICLETYPE >
void olb::particles::SuperParticleSystem< T, PARTICLETYPE >::print ( )

Definition at line 59 of file superParticleSystem.hh.

60{
61 OstreamManager clout(std::cout, "SuperParticleSystem");
62 auto loadBalancer = _superStructure.getLoadBalancer();
63 auto rank = singleton::mpi().getRank();
64 clout << "---SuperParticleSystem---" << std::endl;
65 clout.setMultiOutput(true);
66#ifdef PARALLEL_MODE_MPI
68#endif
69 for (int iC = 0; iC < loadBalancer.size(); ++iC) {
70 int globiC = loadBalancer.glob(iC);
71 auto& bParticleSystem = *_blockParticleSystems[iC];
72 size_t size = bParticleSystem.size();
73 clout << "BlockParticleSystem " << globiC << " (" << rank << "," << iC
74 << ")"
75 << ": nop=" << size << std::endl;
76 }
77 clout.setMultiOutput(false);
78#ifdef PARALLEL_MODE_MPI
80#endif
81 clout << "-------------------------" << std::endl;
82}
void synchronizeIO(unsigned tDelay=100, MPI_Comm comm=MPI_COMM_WORLD)
Synchronizes the processes and wait to ensure correct cout order.

◆ size()

template<typename T , typename PARTICLETYPE >
template<typename PCONDITION >
constexpr std::size_t olb::particles::SuperParticleSystem< T, PARTICLETYPE >::size ( )
constexpr

Definition at line 178 of file superParticleSystem.hh.

179{
180 std::size_t size = 0;
181 communication::forSystemsInSuperParticleSystem<T,PARTICLETYPE>(
182 *this,
183 [&](ParticleSystem<T, PARTICLETYPE>& particleSystem, int iC, int globiC) {
184 size += particleSystem.template size<PCONDITION>(globiC);
185 });
186#ifdef PARALLEL_MODE_MPI
188#endif
189 return size;
190}
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.

References olb::singleton::mpi(), and olb::singleton::MpiManager::reduceAndBcast().

+ Here is the call graph for this function:

◆ updateOffsetFromCircumRadius()

template<typename T , typename PARTICLETYPE >
void olb::particles::SuperParticleSystem< T, PARTICLETYPE >::updateOffsetFromCircumRadius ( T circumRadius)

Definition at line 206 of file superParticleSystem.hh.

208{
209 if(_maximalCircumRadius < circumRadius) {
210 _maximalCircumRadius = circumRadius;
211 updateCuboidNeighborhood();
212 }
213}
+ Here is the caller graph for this function:

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