Changed CPU synchronization from averaging to

communicating changes
This commit is contained in:
2024-03-05 17:22:05 +01:00
parent 5d33ea11ff
commit 95461433c2
6 changed files with 191 additions and 52 deletions
+22 -1
View File
@@ -100,9 +100,14 @@ std::shared_ptr<Timer> SpeciesBuilder::timer() {
return timer_;
}
std::shared_ptr<Timer> SpeciesBuilder::lastSyncTimer() {
return last_sync_timer_;
}
void SpeciesBuilder::initTimer() {
DEBUG_LEVEL_2("Init timer.");
timer_ = std::shared_ptr<Timer>(new Timer());
last_sync_timer_ = std::shared_ptr<Timer>(new Timer());
}
void SpeciesBuilder::initBackgroundSpecies(Parameter& parameter) {
@@ -251,6 +256,12 @@ void SpeciesBuilder::fillTrackedDensity(Parameter& parameter) {
json_path_append(b.second.path_in_json,
{"DensityField", "DynamicDensityField"}),
timer_);
b.second.last_sync_density_field = buildDynamicDensityField(
parameter,
json_path_append(b.second.path_in_json,
{"DensityField", "DynamicDensityField"}),
last_sync_timer_);
}
}
@@ -270,7 +281,7 @@ void SpeciesBuilder::buildSpecies() {
b.second.type, b.second.name, b.second.mass_kg, b.second.charge_C,
b.second.mover, b.second.terminator, b.second.reflector,
b.second.density_field, b.second.velocity_distribution,
b.second.drift_velocity));
b.second.drift_velocity, b.second.last_sync_density_field));
}
}
@@ -282,7 +293,15 @@ void SpeciesBuilder::fillCurrentCollector(Parameter& parameter) {
json_path_append(tracked_species_info.at(b.first).path_in_json,
{"CurrentCollector"}),
timer_);
// has to be recreated, if it would be copied the timer_ pointer would
// point to the same object -> could not get updated during synchronization
auto last_sync_current_collector = buildCurrentCollector(
parameter,
json_path_append(tracked_species_info.at(b.first).path_in_json,
{"CurrentCollector"}),
last_sync_timer_);
b.second->currentCollector(current_collector);
b.second->lastSyncCurrentCollector(last_sync_current_collector);
}
}
@@ -294,6 +313,8 @@ void SpeciesBuilder::fillLoggers(Parameter& parameter) {
json_path_append(tracked_species_info.at(b.first).path_in_json,
{"Loggers"}));
b.second->deletionLogger(deletion_logger);
b.second->lastSyncDeletionLogger(
std::make_shared<DeletionLogger>(*deletion_logger));
}
}