Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit c6997cb8 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

some comments and minor code changes

parent 3fba9b7e
Pipeline #113335 passed with stages
in 142 minutes and 47 seconds
......@@ -4,7 +4,6 @@ import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey;
import org.vadere.state.attributes.processor.AttributesAreaProcessor;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.util.geometry.shapes.VRectangle;
/**
* @author Mario Teixeira Parente
......
......@@ -5,7 +5,6 @@ import org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey;
import org.vadere.state.attributes.processor.AttributesAreaDensityCountingProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.Pedestrian;
import java.util.Collection;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
......@@ -13,9 +12,14 @@ import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
/**
* @author Daniel Lehmberg
* Processor counts number of pedestrians in a measurement area of any shape.
*
* To avoid unneccessary complicated structures this class does *not* extend from @AreaDensityProcessor (which requires
* an intern class or a separate class implementing the density algorithm). However, AreaDensityProcessor is a better
* description of what the processor does.
* See e.g. AreaDensityVoronoiProcessor / AreaDensityVoronoiAlgorithm
*/
@DataProcessorClass(label = "AreaDensityCountingProcessor")
public class AreaDensityCountingProcessor extends AreaDataProcessor<Integer> {
public class AreaDensityCountingProcessor extends AreaDataProcessor<Integer> {
public AreaDensityCountingProcessor() {
super("areaDensityCounting");
......@@ -24,18 +28,23 @@ public class AreaDensityCountingProcessor extends AreaDataProcessor<Integer> {
@Override
protected void doUpdate(final SimulationState state) {
int step = state.getStep();
// Compute density by counting the pedestrians
// With the area of the shape the density can be normalized to [ped/m^2] "pedCount/area"
int pedCount = 0;
// Here could also be another processor. However, because a processor uses more memory, all pedestrians
// are collected from the state directly.
Collection<Pedestrian> pedestrians = state.getTopography().getPedestrianDynamicElements().getElements();
// Alternatively, this could be implemented with "Streams"
for (Pedestrian p : pedestrians) {
if(this.getMeasurementArea().getShape().contains(p.getPosition())){
pedCount++;
}
}
this.putValue(new TimestepKey(step), pedCount);
this.putValue(new TimestepKey(state.getStep()), pedCount);
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment