#ifndef CPU_SYNCHRONIZER_H #define CPU_SYNCHRONIZER_H #include #include #include #include "blitz/array.h" // defined in "simulation/density_field.h" class DynamicDensityField; // defined in "simulation/timer.h" class Timer; // defined in "simulation/current_collector.h" class CurrentCollector; // defined in "simulation/logger.h" class DeletionLogger; // defined in "simulation/species.h" namespace species { class TrackedSpecie; }; // class to synchronize states between mpi-processes class CpuSynchronizer { public: // CpuSynchronizer(); // function to handle synchronization of the map of TrackedSpecie // synchronizes the timer, all CurrentCollectors, DynamicDensityFields and DeletionLoggers void synchronize( std::map>& tracked_species); // function to synchronize a DynamicDensityField; // last_sync_field includes the state of the DynamicDensityField after the last // synchronization, neccessary to calculate changes that have to be communicated // after the synchronization both field and last_sync_field contain the same data // but are different objects void synchronize(DynamicDensityField* field, DynamicDensityField* last_sync_field); // function to synchronize a CurrentCollector; // last_sync_collector includes the state of the CurrentCollector after the last // synchronization, neccessary to calculate changes that have to be communicated // after the synchronization both collector and last_sync_collector contain the same data // but are different objects void synchronize(CurrentCollector* collector, CurrentCollector* last_sync_collector); // function to synchronize a DeletionLogger; // last_sync_logger includes the state of the DeletionLogger after the last // synchronization, neccessary to calculate changes that have to be communicated // after the synchronization both logger and last_sync_logger contain the same data // but are different objects void synchronize(DeletionLogger* logger, DeletionLogger* last_sync_logger); // function to synchronize a Timer; // last_sync_timer includes the state of the Timer after the last // synchronization, neccessary to calculate changes that have to be communicated // after the synchronization both timer and last_sync_timer contain the same data // but are different objects void synchronize(Timer* timer, Timer* last_sync_timer); // calculates delta = array - last_sync_array, then collects all deltas of all // mpi-processes and adds them to last_sync_array (i.e. array does not get modified) void sumToAll(blitz::Array& array, blitz::Array& last_sync_array); // calculates delta = array - last_sync_array, then collects all deltas of all // mpi-processes and adds them to last_sync_array so that // afterwards last_sync_array has the same values on each mpi-process // (i.e. array does not get modified) void sumToAll(blitz::Array& array, blitz::Array& last_sync_array); // calculates delta = array - last_sync_array, then collects all deltas of all // mpi-processes and adds them to last_sync_array so that // afterwards last_sync_array has the same values on each mpi-process // (i.e. array does not get modified) void sumToAll(blitz::Array& array, blitz::Array& last_sync_array); // calculates delta = value - last_sync_value, then collects all deltas of all // mpi-processes and adds them to last_sync_value so that // afterwards last_sync_value has the same value on each mpi-process // (i.e. array does not get modified) void sumToAll(double& value, double& last_sync_value); // calculates delta = array - last_sync_array, then collects all deltas of all // mpi-processes and adds them to last_sync_value so that // afterwards last_sync_value has the same value on each mpi-process // (i.e. array does not get modified) void sumToAll(long int& value, long int& last_sync_value); }; #endif /* CPU_SYNCHRONIZER_H */