Tomographer  v4.0
Tomographer C++ Framework Documentation
ResultsCollector Interface

ResultsCollector takes care of collecting the results from each task run.

In the following, TaskCData is some type that was specified to the task dispatcher. The type CountType designates the type used to count tasks (usually an integral type of course). Also the type ResultType is the type declared for a result by the task (Task Interface). You may make the methods here take template parameters so you don't have to worry about the exact types of these parameters.

void init(CountType num_total_runs, CountType n_chunk, const TaskCData * pcdata)
init() will be called before the tasks are run (e.g. before starting the parallel section), and may be used to initialize data.
void collectResult(CountType task_no, const ResultType& taskresult, const TaskCData * pcdata)
Called each time a task has finished, with the corresponding task result, along with information about which task it was and as always the shared constant data. This method does not need to worry about concurrence, for example writing to shared data (it is either called from the main thread in a critical section, or the data was serialized and passed to the main process, etc.)
in the OMP task dispatcher (Tomographer::MultiProc::OMP::TaskDispatcher), this is called within a critical OMP section, so it may safely access and write shared data.
void runsFinished(CountType num_total_runs, const TaskCData * pcdata)
Called after all the tasks have finished. This is the good time to, e.g., finalize collected values, such as multiplying by parameter space volume, dividing by the number of samples to get the average, etc.