10.12., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 838a2233 authored by Marion Goedel's avatar Marion Goedel

Added ParallelWorkerUtil from GradientNavigationModel to SocialForceModel

parent dbcf835e
Pipeline #311014 passed with stages
in 129 minutes and 39 seconds
......@@ -21,6 +21,7 @@ import org.vadere.state.scenario.Target;
import org.vadere.state.types.GradientProviderType;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape;
import org.vadere.util.parallel.ParallelWorkerUtil;
import java.util.*;
......@@ -38,12 +39,12 @@ public class SocialForceModel extends ODEModel<Pedestrian, AttributesAgent> {
@Deprecated
public SocialForceModel(Domain domain, AttributesSFM attributes,
PotentialFieldObstacle potentialFieldObstacle,
PotentialFieldAgent potentialFieldPedestrian,
IPotentialFieldTargetGrid potentialFieldTarget,
AttributesAgent attributesPedestrian, Random random) {
PotentialFieldObstacle potentialFieldObstacle,
PotentialFieldAgent potentialFieldPedestrian,
IPotentialFieldTargetGrid potentialFieldTarget,
AttributesAgent attributesPedestrian, Random random) {
super(Pedestrian.class, domain, IntegratorFactory.createFirstOrderIntegrator(attributes
.getAttributesODEIntegrator()), new SFMEquations(),
.getAttributesODEIntegrator()), new SFMEquations(),
attributesPedestrian, random);
this.attributes = attributes;
this.targets = new TreeMap<>();
......@@ -63,7 +64,7 @@ public class SocialForceModel extends ODEModel<Pedestrian, AttributesAgent> {
@Override
public void initialize(List<Attributes> modelAttributesList, Domain domain,
AttributesAgent attributesPedestrian, Random random) {
AttributesAgent attributesPedestrian, Random random) {
this.attributes = Model.findAttributes(modelAttributesList, AttributesSFM.class);
......@@ -124,6 +125,15 @@ public class SocialForceModel extends ODEModel<Pedestrian, AttributesAgent> {
@Override
public void preLoop(final double state) {
super.preLoop(state);
// setup thread pool if it is not setup already
int WORKERS_COUNT = 16;// pedestrians.keySet().size();
ParallelWorkerUtil.setup(WORKERS_COUNT);
}
@Override
public void postLoop(final double simTimeInSec) {
super.postLoop(simTimeInSec);
ParallelWorkerUtil.shutdown();
}
@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