# Reporter component¶

After running simulations, EMOD creates output reports that contain the model results. Two methods of coordinated reporting are implemented: simulation-wide aggregated reporting and spatial reporting. See Output files for more information about the different output reports available.

## Simulation-wide aggregate¶

Simulation-wide aggregate reporting is the most commonly used. This reporting method generates the output written to InsetChart.json. Conceptually, for each time step, the value of a named channel is derived from values provided for that channel by each node. The values are accumulated (summed) over all nodes and then transformed (often normalized by an internal parameter or another channel) just prior to writing. This is implemented through the simulation’s insetChartDataAccumulator.

Basic usage of the NodeTimestepDataAccumulator is explained in Report.h. The simulation is responsible for calling Begin/EndTimestep() and collecting and writing out the data at the end of the simulation. The accumulation calls occur in Node::accumulateInsetChartData().

## Spatial¶

The second method is spatial reporting which is facilitated by SpatialReporter. In spatial reporting, each node again produces values for named channels, but no simulation-wide accumulation takes place. Instead, the values of each channel for each node are written to a binary table (ReportNNNN.dat) where NNNN is the time step. The format of this file is simple and can be summarized as the maximally packed layout of this structure:

struct ReportDataFormat
{
int32_t num_nodes;
int32_t num_channels;
float data[num_nodes*num_channels];
}


Num_Channels is the number of user channels implicitly generated by the number of different channel names requested in calls to Node::reportSpatialDataReportChannels() plus two additional channels for longitude and latitude. JSON metadata for the ReportNNNN.dat files is written to Report.header.dat after the first time step. It does not include entries for latitude and longitude.

In general, the value of channel $$c$$ for node $$n$$, starting at zero, is found at $$data[n\times num\_channels+c]$$. The latitude is $$data[n\times num\_channels+0]$$ and the longitude is $$data[n\times num\_channels+1]$$.

The report data files are written after every time step at the request of the Controller by calling WriteTimestep(). Under MPI, the default implementation reduces all the data to rank 0 and writes the combined data out to file on rank 0.

See Custom reporters for information about how to use a custom reporter.