OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
BunchStateHandler.h
Go to the documentation of this file.
1#ifndef BUNCH_STATE_HANDLER_H
2#define BUNCH_STATE_HANDLER_H
3
4#include <memory>
5#include <vector>
6
57public:
70 bool unitlessPositions = false;
71 bool momentsDirty = true;
72
73 void setUnitlessPositions(bool v);
74 void markMomentsDirty();
75 void markMomentsClean();
76 };
77
78 BunchStateHandler() = default;
79
80 // -- per-container registration ---------------------------------------
81
88 std::shared_ptr<ContainerState> registerContainer();
89
90 // -- bunch-wide flags --------------------------------------------------
91
92 bool isFirstRepartition() const { return firstRepartition_m; }
101 void setFirstRepartition(bool v);
102
103 // -- emission liveness -------------------------------------------------
104 // TBD: not wired up yet. Re-introduce a bunch-wide bool (plus impl in .cpp
105 // and a unit test) once an emitting distribution actually needs it.
106 // bool isEmittingNow() const;
107 // void setEmittingNow(bool v);
108
109private:
110 // Weak refs to every slot handed out by registerContainer(). Used only by
111 // handler-internal operations that iterate over all containers; pruned
112 // lazily on iteration. Never exposed to callers.
113 std::vector<std::weak_ptr<ContainerState>> registered_m;
114
116};
117
118#endif
Centralised tracking of mutable bunch-level and per-container status flags.
bool isFirstRepartition() const
std::vector< std::weak_ptr< ContainerState > > registered_m
void setFirstRepartition(bool v)
bool & isFirstRepartitionRef()
Non-const reference escape hatch used by LoadBalancer::repartition.
BunchStateHandler()=default
std::shared_ptr< ContainerState > registerContainer()
Allocate a new per-container slot and return a strong reference to it. The handler itself retains onl...
Per-container slot of mutable flags. One per registered ParticleContainer. Lifetime is tied to the ow...