Commit 0a06f866 authored by hm-lehmberg's avatar hm-lehmberg

WIP: dummy structure for implementation

parent dac80587
Pipeline #113420 passed with stages
in 149 minutes and 19 seconds
package org.vadere.simulator.projects.dataprocessing.processor;
import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.control.SimulationState;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VShape;
import java.util.Collection;
/**
* @author Daniel Lehmberg
*
* This algorithm computes the density for each point in an unstructured mesh grid. The mesh can be over any
* measurement area (i.e. allows any shape).
*/
public class AreaDensityMeshpointAlgorithm extends AreaDensityAlgorithm {
private VShape measurementArea;
public AreaDensityMeshpointAlgorithm(final @NotNull MeasurementArea measurementArea, boolean dummyArgMesh) {
super("areaMeshpoint");
this.measurementArea = measurementArea.getShape();
//TODO set mesh attribute
}
@Override
public double getDensity(final SimulationState state) {
// TODO: there are different ways:
// 1) Consider **all** agents that are in the state
// 2) Consider only agents that are **close to** from the points
// 3) Consider only agents that are **in** the measurement area
// Option 2) is implemented initially.
// TODO: think about: how should an obstacle be treated? It also imposes a "density feeling"
Collection<Pedestrian> consideredAgents = findNearbyPedestrians(state);
// TODO: compute the density using the nearby agents
return computeDensity(consideredAgents);
}
private Collection<Pedestrian> findNearbyPedestrians(final SimulationState state){
// TODO: find subset of pedestrians that are inside, or close to the points defined by the mesh
return null;
}
private double computeDensity(Collection<Pedestrian> agents){
//TODO: 1) loop over each point in the mesh
//TODO: 2) compute the density at this point
// TODO: NOTE: this is not correct at the moment, what I want is a Collection<double> (for each point), this
// is just for the sake to have a dummy.
return 0;
}
}
package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.flags.UsesMeasurementArea;
import org.vadere.state.attributes.processor.AttributesAreaDensityVoronoiProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
/**
* @author Daniel Lehmberg
*
* This processor writes density values at unstructured points of an arbitrary measurement area. It first computes
* the (triangular) mesh, writes the desciption of this mesh (for later data processing) and then forwards the
* the density compuation to AreaDensityMeshpointAlgorithm. Note that the points in the mesh are static over the
* entire simulation and are independent of pedestrian positions.
*
* With this processor it is possible to analyze/visualize pedestrian density evolution of any shape in the domain.
*
* See pull request !64 and issue #123 for details.
*
*/
@DataProcessorClass(label = "AreaDensityMeshpointProcessor")
public class AreaDensityMeshpointProcessor extends AreaDensityProcessor implements UsesMeasurementArea {
// TODO AreaDensityProcessor extends AreaDataProcessor<Double>, I actually need something along the lines of
// AreaDataProcessor<Collection<Double>> (for each point the computed density).
public AreaDensityMeshpointProcessor(){
super();
setAttributes(new AttributesAreaDensityVoronoiProcessor());
}
@Override
public void init(final ProcessorManager manager) {
super.init(manager);
// TODO: Compute the mesh according to the user settings (in AttributesAreaDensityMeshpointProcessor)
// TODO: There should be *no* points in obstacles
// TODO: save the mesh as a file (for later usage) -- the path to the directory should be accessible via the
// ProcessorManager
this.setAlgorithm(new AreaDensityMeshpointAlgorithm(getMeasurementArea(), false));
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesAreaDensityVoronoiProcessor());
}
return super.getAttributes();
}
@Override
public int[] getReferencedMeasurementAreaId() {
AttributesAreaDensityVoronoiProcessor att = (AttributesAreaDensityVoronoiProcessor) this.getAttributes();
return new int[]{att.getMeasurementAreaId(), att.getMeasurementAreaId()};
}
}
package org.vadere.state.attributes.processor;
public class AttributesAreaDensityMeshpointProcessor extends AttributesAreaProcessor {
// TODO: possible options for user setting see issue #123
// TODO: this is just a dummy, development in pull request !64
public double lengthMeshEdges(){
return 0;
}
}
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