In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

Commit 029e6a91 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

before avoiding the copy of rich objects

parent da4cdd55
Pipeline #266888 failed with stages
in 3 minutes and 9 seconds
...@@ -1376,7 +1376,7 @@ public interface IMesh<V extends IVertex, E extends IHalfEdge, F extends IFace> ...@@ -1376,7 +1376,7 @@ public interface IMesh<V extends IVertex, E extends IHalfEdge, F extends IFace>
V v1 = getVertex(e1); V v1 = getVertex(e1);
V v2 = getVertex(e2); V v2 = getVertex(e2);
V v3 = getVertex(e3); V v3 = getVertex(e3);
return GeometryUtils.getTriangleMidpoint(v1.getX(), v1.getY(), v2.getX(), v2.getY(), v3.getX(), v3.getY()); return GeometryUtils.getTriangleMidpoint(getX(v1), getX(v1), getX(v2), getY(v2), getX(v3), getY(v3));
} }
/** /**
......
...@@ -3011,6 +3011,29 @@ public interface ITriConnectivity<V extends IVertex, E extends IHalfEdge, F exte ...@@ -3011,6 +3011,29 @@ public interface ITriConnectivity<V extends IVertex, E extends IHalfEdge, F exte
} }
} }
default boolean contains(final double x, final double y, @NotNull final F face) {
if(!getMesh().isBoundary(face)) {
E e1 = getMesh().getEdge(face);
V v1 = getMesh().getVertex(e1);
V v2 = getMesh().getTwinVertex(e1);
V v3 = getMesh().getVertex(getMesh().getNext(e1));
double x1 = getMesh().getX(v1);
double y1 = getMesh().getY(v1);
double x2 = getMesh().getX(v2);
double y2 = getMesh().getY(v2);
double x3 = getMesh().getX(v3);
double y3 = getMesh().getY(v3);
return !GeometryUtils.isRightOf(x1, y1, x2, y2, x, y) &&
!GeometryUtils.isRightOf(x2, y2, x3, y3, x, y) &&
!GeometryUtils.isRightOf(x3, y3, x1, y1, x, y);
} else {
return IPolyConnectivity.super.contains(x, y, face);
}
}
/*default V locateNearestNeighbour(double x1, double y1, F face) { /*default V locateNearestNeighbour(double x1, double y1, F face) {
assert isInsideCircumscribedCycle(face, x1, y1); assert isInsideCircumscribedCycle(face, x1, y1);
......
...@@ -47,7 +47,7 @@ public class OfflineTopographyController { ...@@ -47,7 +47,7 @@ public class OfflineTopographyController {
} }
// add bounding box // add bounding box
protected void prepareTopography() { protected void prepareTopography(final AttributesFloorField attributesFloorField) {
// add boundaries // add boundaries
if (domain.getTopography().isBounded() && !domain.getTopography().hasBoundary()) { if (domain.getTopography().isBounded() && !domain.getTopography().hasBoundary()) {
for(Obstacle obstacle : Topography.createObstacleBoundary(domain.getTopography())) { for(Obstacle obstacle : Topography.createObstacleBoundary(domain.getTopography())) {
...@@ -73,7 +73,7 @@ public class OfflineTopographyController { ...@@ -73,7 +73,7 @@ public class OfflineTopographyController {
PotentialFieldDistancesBruteForce distanceField = new PotentialFieldDistancesBruteForce( PotentialFieldDistancesBruteForce distanceField = new PotentialFieldDistancesBruteForce(
getTopography().getObstacles().stream().map(obs -> obs.getShape()).collect(Collectors.toList()), getTopography().getObstacles().stream().map(obs -> obs.getShape()).collect(Collectors.toList()),
new VRectangle(getTopography().getBounds()), new VRectangle(getTopography().getBounds()),
new AttributesFloorField(), cache); attributesFloorField, cache);
getTopography().setObstacleDistanceFunction(iPoint -> -distanceField.getPotential(iPoint, null)); getTopography().setObstacleDistanceFunction(iPoint -> -distanceField.getPotential(iPoint, null));
......
package org.vadere.simulator.control.scenarioelements; package org.vadere.simulator.control.scenarioelements;
import org.vadere.simulator.models.DynamicElementFactory; import org.vadere.simulator.models.DynamicElementFactory;
import org.vadere.simulator.models.Model;
import org.vadere.simulator.projects.Domain; import org.vadere.simulator.projects.Domain;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.models.AttributesFloorField;
import org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography; import org.vadere.state.scenario.Topography;
import java.util.List;
import java.util.Random; import java.util.Random;
public class TopographyController extends OfflineTopographyController { public class TopographyController extends OfflineTopographyController {
...@@ -22,8 +27,8 @@ public class TopographyController extends OfflineTopographyController { ...@@ -22,8 +27,8 @@ public class TopographyController extends OfflineTopographyController {
return this.domain.getTopography(); return this.domain.getTopography();
} }
public void preLoop(double simTimeInSec) { public void preLoop(double simTimeInSec, List<Attributes> attributesList) {
prepareTopography(); prepareTopography(Model.findAttributes(attributesList, AttributesFloorField.class));
createAgentWrapperPedestrians(); createAgentWrapperPedestrians();
} }
......
...@@ -201,7 +201,7 @@ public class Simulation { ...@@ -201,7 +201,7 @@ public class Simulation {
} }
simulationState = initialSimulationState(); simulationState = initialSimulationState();
topographyController.preLoop(simTimeInSec); topographyController.preLoop(simTimeInSec, scenarioStore.getAttributesList());
isRunSimulation = true; isRunSimulation = true;
simTimeInSec = startTimeInSec; simTimeInSec = startTimeInSec;
......
...@@ -43,6 +43,6 @@ public class Domain { ...@@ -43,6 +43,6 @@ public class Domain {
} }
public Domain clone() { public Domain clone() {
return new Domain(floorFieldMesh.clone(), backgroundMesh.clone(), topography.clone()); return new Domain(floorFieldMesh == null ? null : floorFieldMesh.clone(), backgroundMesh == null ? null : backgroundMesh.clone(), topography.clone());
} }
} }
...@@ -372,9 +372,9 @@ public class CellGrid { ...@@ -372,9 +372,9 @@ public class CellGrid {
VPoint gridPointCoord = pointToCoord(gridPoint); VPoint gridPointCoord = pointToCoord(gridPoint);
double z1 = getValue(gridPoint).potential; double z1 = getValue(gridPoint).potential;
double z2 = getValue(new Point(gridPoint.x + incX, gridPoint.y)).potential; double z2 = getValue(gridPoint.x + incX, gridPoint.y).potential;
double z3 = getValue(new Point(gridPoint.x + incX, gridPoint.y + incY)).potential; double z3 = getValue(gridPoint.x + incX, gridPoint.y + incY).potential;
double z4 = getValue(new Point(gridPoint.x, gridPoint.y + incY)).potential; double z4 = getValue(gridPoint.x, gridPoint.y + incY).potential;
double t = (pos.getX() - gridPointCoord.x) / getResolution(); double t = (pos.getX() - gridPointCoord.x) / getResolution();
double u = (pos.getY() - gridPointCoord.y) / getResolution(); double u = (pos.getY() - gridPointCoord.y) / getResolution();
......
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