Files
2024-12-04 17:15:04 +01:00

50 lines
1.8 KiB
C++
Executable File

#ifndef LOGGER_H
#define LOGGER_H
#include <map>
#include <vector>
#include "simulation/coordinates.h"
// enum that defines the different types of deletions that can be counted
enum class DeletionType {
wall,
recombination,
max_interactions,
max_time_alive,
cluster_formation
};
// class that keeps track of the DeletionType that caused a particle to be deleted
class DeletionLogger {
public:
// Constructor: vector used_types defines for which DeletionType elements the
// deletion is supposed to be tracked (i.e. if recombination is not
// specified in the used_types vector, then particles that are
// removed due to recombination are not counted)
DeletionLogger(std::vector<DeletionType> used_types);
// increase the count corresponding to DeletionType by 1
// Coordinate coordinate is not used (i.e. can be chosen arbitrarily)
virtual void logDeletion(const Coordinate& coordinate, DeletionType type);
// returns the map with the keys being the tracked DeletionTypes and the
// value the long int count of how many particles have been logged by the
// corresponding key
std::map<DeletionType, long int> numDeletions() const;
// set the count for DeletionType type to new_value
void numDeletions(long int new_value, DeletionType type);
// return the count for DeletionType type; if the type was not specified
// as used in the creation of the object return 0
long int numDeletions(DeletionType type) const;
// make private member variable accessable for the cpu synchronization
friend class CpuSynchronizer;
private:
// map with keys being the used DeletionTypes and the value being the count
// of how many particles have been deleted due to the DeletionType of the key
std::map<DeletionType, long int> num_deletions;
};
#endif /* LOGGER_H */