Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

Commit c541cfe0 authored by BZoennchen's avatar BZoennchen

refactoring: remove generic but fixed data types from mesh element and...

refactoring: remove generic but fixed data types from mesh element and introduce the property concept.
parent d19861c2
......@@ -6,11 +6,8 @@ import java.util.function.Function;
import org.vadere.meshing.mesh.gen.PMesh;
import org.vadere.meshing.mesh.inter.IMesh;
import org.vadere.simulator.models.potential.solver.calculators.mesh.PotentialPoint;
import org.vadere.state.scenario.Agent;
import org.vadere.util.data.cellgrid.IPotentialPoint;
import org.vadere.util.geometry.shapes.IPoint;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
public abstract class SimulationModel<T extends DefaultSimulationConfig> extends DefaultModel {
......@@ -42,8 +39,8 @@ public abstract class SimulationModel<T extends DefaultSimulationConfig> extends
return config;
}
public IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?> getDiscretization() {
return new PMesh<IPotentialPoint, Object, Object>((x,y) -> new PotentialPoint(x,y));
public IMesh<?, ?, ?> getDiscretization() {
return new PMesh();
}
/*public double getPotential(final int x, final int y) {
......
......@@ -7,7 +7,6 @@ import org.vadere.meshing.mesh.inter.IMesh;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.ScenarioElement;
import org.vadere.state.scenario.Stairs;
import org.vadere.util.data.cellgrid.IPotentialPoint;
import org.vadere.util.geometry.shapes.Vector2D;
import org.vadere.util.geometry.shapes.VCircle;
import org.vadere.util.geometry.shapes.VLine;
......@@ -598,9 +597,9 @@ public abstract class DefaultRenderer {
protected void renderMesh(
@NotNull final Graphics2D g,
@NotNull final IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?> mesh,
@NotNull final IMesh<?, ?, ?> mesh,
@NotNull final VRectangle bound) {
MeshRenderer<? extends IPotentialPoint, ?, ?, ?, ?, ?> meshRenderer = new MeshRenderer<>(mesh);
MeshRenderer<?, ?, ?> meshRenderer = new MeshRenderer<>(mesh);
//meshRenderer.renderGraphics(g, bound);
}
......
......@@ -13,7 +13,6 @@ import org.vadere.simulator.models.potential.fields.IPotentialField;
import org.vadere.simulator.models.potential.fields.IPotentialFieldTarget;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Topography;
import org.vadere.util.data.cellgrid.IPotentialPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import java.util.function.Function;
......@@ -32,7 +31,7 @@ public class OnlineVisualization implements PassiveCallback {
public final IPotentialField potentialFieldTarget;
public final Agent selectedAgent;
public final IPotentialField potentialField;
public final Function<Agent, IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?>> discretizations;
public final Function<Agent, IMesh<?, ?, ?>> discretizations;
public ObservationAreaSnapshotData(
final double simTimeInSec,
......@@ -40,7 +39,7 @@ public class OnlineVisualization implements PassiveCallback {
@Nullable final IPotentialField potentialFieldTarget,
@Nullable final IPotentialField potentialField,
@Nullable final Agent selectedAgent,
@Nullable final Function<Agent, IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?>> discretizations) {
@Nullable final Function<Agent, IMesh<?, ?, ?>> discretizations) {
this.simTimeInSec = simTimeInSec;
this.scenario = scenario;
this.potentialFieldTarget = potentialFieldTarget;
......@@ -124,7 +123,7 @@ public class OnlineVisualization implements PassiveCallback {
synchronized (model.getDataSynchronizer()) {
/* Push new snapshot of the observation area to the draw thread. */
IPotentialField pft = (model.config.isShowTargetPotentialField() && potentialFieldTarget != null) ? potentialFieldTarget.getSolution() : null;
Function<Agent, IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?>> discretizations = (model.config.isShowTargetPotentielFieldMesh() && potentialFieldTarget != null) ? potentialFieldTarget.getDiscretization() : null;
Function<Agent, IMesh<?, ?, ?>> discretizations = (model.config.isShowTargetPotentielFieldMesh() && potentialFieldTarget != null) ? potentialFieldTarget.getDiscretization() : null;
IPotentialField pedPotentialField = null;
Agent selectedAgent = null;
......
......@@ -14,9 +14,7 @@ import org.vadere.gui.onlinevisualization.OnlineVisualization;
import org.vadere.meshing.mesh.gen.PMesh;
import org.vadere.meshing.mesh.inter.IMesh;
import org.vadere.simulator.models.potential.fields.IPotentialField;
import org.vadere.simulator.models.potential.solver.calculators.mesh.PotentialPoint;
import org.vadere.state.scenario.*;
import org.vadere.util.data.cellgrid.IPotentialPoint;
import org.vadere.util.geometry.shapes.IPoint;
import org.vadere.util.voronoi.VoronoiDiagram;
......@@ -37,7 +35,7 @@ public class OnlineVisualizationModel extends SimulationModel<DefaultSimulationC
private IPotentialField potentialField = null;
private Function<Agent, IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?>> discretizations = null;
private Function<Agent, IMesh<?, ?, ?>> discretizations = null;
private Agent agent = null;
......@@ -209,12 +207,12 @@ public class OnlineVisualizationModel extends SimulationModel<DefaultSimulationC
}
@Override
public IMesh<? extends IPotentialPoint, ?, ?, ?, ?, ?> getDiscretization() {
public IMesh<?, ?, ?> getDiscretization() {
if(agent != null && discretizations != null && config.isShowTargetPotentielFieldMesh() && agent.equals(getSelectedElement())) {
return discretizations.apply(agent);
}
return new PMesh<IPotentialPoint, Object, Object>((x, y) -> new PotentialPoint(x, y));
return new PMesh();
}
@Override
......
......@@ -15,7 +15,6 @@ import org.vadere.util.geometry.shapes.VPolygon;
import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.geometry.shapes.VShape;
import org.vadere.util.math.DistanceFunction;
import org.vadere.meshing.mesh.triangulation.improver.eikmesh.EikMeshPoint;
import org.vadere.meshing.mesh.gen.MeshPanel;
import org.vadere.meshing.mesh.triangulation.improver.eikmesh.impl.AEikMesh;
......@@ -53,21 +52,21 @@ public class RecordTriangulationMovie {
bbound,
obstacleShapes);
Function<AFace<Object>, Color> colorFunction1 = f -> {
Function<AFace, Color> colorFunction1 = f -> {
float q = Math.max(0.0f, Math.min(1.0f, (float) meshImprover.faceToQuality(f)));
return new Color(q, q, q);
};
Function<AFace<EikMeshPoint>, Color> colorFunction2 = f -> {
Function<AFace, Color> colorFunction2 = f -> {
return ColorHelper.numberToHurColor((float)f.getId() / meshImprover.getMesh().getNumberOfFaces());
};
//ColorHelper.numberToHurColor((float)f.getId() / meshImprover.getMesh().getNumberOfFaces());
//new ColorHelper(meshImprover.getMesh().getNumberOfFaces()).numberToColor(f.getId());
MeshRenderer<EikMeshPoint, Object, Object, AVertex<EikMeshPoint>, AHalfEdge<Object>, AFace<Object>> meshRenderer = new MeshRenderer<>(
MeshRenderer<AVertex, AHalfEdge, AFace> meshRenderer = new MeshRenderer<>(
meshImprover.getMesh(), f -> false, colorFunction1);
MeshPanel<EikMeshPoint, Object, Object, AVertex<EikMeshPoint>, AHalfEdge<Object>, AFace<Object>> distmeshPanel = new MeshPanel<>(
MeshPanel<AVertex, AHalfEdge, AFace> distmeshPanel = new MeshPanel<>(
meshRenderer, bbound.getWidth()*1000, bbound.getHeight()*1000);
JFrame frame = distmeshPanel.display();
......@@ -119,7 +118,7 @@ public class RecordTriangulationMovie {
}
public static void addPictures(Recorder recorder,
MeshRenderer<EikMeshPoint, Object, Object, AVertex<EikMeshPoint>, AHalfEdge<Object>, AFace<Object>> renderer,
MeshRenderer<AVertex, AHalfEdge, AFace> renderer,
int frames,
int width,
int height) throws IOException {
......
......@@ -46,7 +46,7 @@ public class ActionRenameScenario extends AbstractAction {
ProjectWriter.renameScenario(scenario, model.getCurrentProjectPath(), newName);
model.saveScenarioToDisk(scenario);
// remove and insert the element such that the table is still sorted by name
// remove and insertVertex the element such that the table is still sorted by name
model.getScenarioTableModel().replace(scenario, new VadereScenarioTableModel.VadereDisplay(scenario, VadereState.INITIALIZED));
model.refreshScenarioNames();
/*
......
......@@ -398,11 +398,11 @@ public class TopographyWindow extends JPanel {
getActionMap().put("copy-element", copyElementAction);
TopographyAction insertCopiedElementAction =
new ActionInsertCopiedElement("insert copied element", panelModel, undoSupport);
new ActionInsertCopiedElement("insertVertex copied element", panelModel, undoSupport);
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()),
"insert-copied-element");
getActionMap().put("insert-copied-element", insertCopiedElementAction);
"insertVertex-copied-element");
getActionMap().put("insertVertex-copied-element", insertCopiedElementAction);
// delete element
TopographyAction deleteElement =
......
......@@ -4,7 +4,7 @@ import org.vadere.meshing.mesh.impl.PSLG;
import org.vadere.meshing.mesh.triangulation.EdgeLengthFunctionApprox;
import org.vadere.meshing.mesh.triangulation.triangulator.impl.PRuppertsTriangulator;
import org.vadere.meshing.utils.io.poly.PolyGenerator;
import org.vadere.util.geometry.shapes.VPoint;
import java.io.IOException;
import java.io.InputStream;
......@@ -19,11 +19,11 @@ public class BackgroundMeshExamples {
PSLG pslg = PolyGenerator.toPSLGtoVShapes(inputStream);
double theta = 10;
PRuppertsTriangulator<VPoint, Double, Double> ruppert = new PRuppertsTriangulator<>(
PRuppertsTriangulator ruppert = new PRuppertsTriangulator(
pslg,
p -> Double.POSITIVE_INFINITY,
theta,
(x, y) -> new VPoint(x, y));
theta
);
EdgeLengthFunctionApprox edgeLengthFunctionApprox = new EdgeLengthFunctionApprox(pslg);
edgeLengthFunctionApprox.printPython();
......
package org.vadere.meshing.examples;
import org.vadere.meshing.mesh.gen.MeshPanel;
import org.vadere.meshing.mesh.impl.VPMesh;
import org.vadere.meshing.mesh.gen.PMesh;
import org.vadere.meshing.mesh.triangulation.triangulator.gen.GenRandomPointsSetTriangulator;
import org.vadere.util.geometry.shapes.VRectangle;
......@@ -20,7 +20,7 @@ public class DelaunayTriangulationExamples {
// define a random point set triangulator
int numberOfPoint = 5000;
GenRandomPointsSetTriangulator randomTriangulator = new GenRandomPointsSetTriangulator(new VPMesh(), numberOfPoint, bound);
GenRandomPointsSetTriangulator randomTriangulator = new GenRandomPointsSetTriangulator(new PMesh(), numberOfPoint, bound);
// fill in the points into the empty triangulation
randomTriangulator.generate();
......
package org.vadere.meshing.examples;
import org.vadere.meshing.mesh.gen.PMesh;
import org.vadere.meshing.mesh.gen.PMeshSuppliert;
import org.vadere.meshing.mesh.impl.PMeshPanel;
import org.vadere.meshing.mesh.inter.IMesh;
import org.vadere.meshing.mesh.inter.IPointConstructor;
import org.vadere.meshing.mesh.triangulation.IEdgeLengthFunction;
import org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.GenEikMesh;
......@@ -25,12 +23,9 @@ import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.geometry.shapes.VShape;
import org.vadere.util.math.IDistanceFunction;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -61,24 +56,24 @@ public class EikMeshExamples {
int numberOfPoints = 200;
double linePoints = (int)Math.sqrt(numberOfPoints)+5;
List<EikMeshPoint> points = new ArrayList<>();
List<VPoint> points = new ArrayList<>();
for(double i = 0; i < linePoints; i++) {
points.add(new EikMeshPoint(0.1, 0.1 + i / linePoints * (height-0.2), true));
points.add(new EikMeshPoint(0.1 + i / linePoints * (width-0.2), 0.1, true));
points.add(new EikMeshPoint(width-0.2, 0.1 + i / linePoints * (height-0.2), true));
points.add(new EikMeshPoint(0.1 + i / linePoints * (width-0.2), height-0.2, true));
points.add(new VPoint(0.1, 0.1 + i / linePoints * (height-0.2)));
points.add(new VPoint(0.1 + i / linePoints * (width-0.2), 0.1));
points.add(new VPoint(width-0.2, 0.1 + i / linePoints * (height-0.2)));
points.add(new VPoint(0.1 + i / linePoints * (width-0.2), height-0.2));
}
for(int i = 0; i < numberOfPoints-15; i++) {
points.add(new EikMeshPoint(1.5 + random.nextDouble() * (width-3), 1.5 + random.nextDouble() * (height-3)));
points.add(new VPoint(1.5 + random.nextDouble() * (width-3), 1.5 + random.nextDouble() * (height-3)));
}
var delaunayTriangulator = new PDelaunayTriangulator<>(points, (x, y) -> new EikMeshPoint(x, y, false));
var delaunayTriangulator = new PDelaunayTriangulator(points);
var triangulation = delaunayTriangulator.generate();
var improver = new PEikMeshGen<>(p -> 1.0, triangulation);
var panel = new PMeshPanel<>(triangulation.getMesh(), 500, 500);
var improver = new PEikMeshGen(p -> 1.0, triangulation);
var panel = new PMeshPanel(triangulation.getMesh(), 500, 500);
panel.display("A square mesh");
panel.repaint();
......@@ -121,13 +116,13 @@ public class EikMeshExamples {
IDistanceFunction d_r = IDistanceFunction.create(rect);
IDistanceFunction d = IDistanceFunction.substract(d_c, d_r);
double edgeLength = 0.03;
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
d,
p -> edgeLength + 0.5 * Math.abs(d.apply(p)),
edgeLength,
GeometryUtils.boundRelative(boundary.getPath()),
Arrays.asList(rect),
(x, y) -> new EikMeshPoint(x, y, false));
Arrays.asList(rect)
);
// generate the mesh
//meshImprover.generate();
......@@ -135,7 +130,7 @@ public class EikMeshExamples {
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
// (optional) define the gui to display the mesh
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
PMeshPanel meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
meshPanel.display("Geometry defined by shapes");
meshImprover.initialize();
......@@ -175,13 +170,13 @@ public class EikMeshExamples {
IDistanceFunction d_union = IDistanceFunction.union(IDistanceFunction.union(d1_c, d_r), d2_c);
IDistanceFunction d = IDistanceFunction.substract(d_b,d_union);
double edgeLength = 0.07;
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
d,
p -> edgeLength + 0.3 * Math.abs(d.apply(p)),
edgeLength,
GeometryUtils.boundRelative(boundary.getPath()),
Arrays.asList(rect),
(x, y) -> new EikMeshPoint(x, y, false));
Arrays.asList(rect)
);
// generate the mesh
//meshImprover.generate();
......@@ -189,7 +184,7 @@ public class EikMeshExamples {
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
// (optional) define the gui to display the mesh
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
PMeshPanel meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
var recorder = new MovRecorder<>(meshImprover, meshPanel.getMeshRenderer(), 1024, 800, meshImprover.getMesh().getBound());
recorder.record();
......@@ -271,13 +266,13 @@ public class EikMeshExamples {
// define the EikMesh-Improver
IEdgeLengthFunction h = p -> h0 + 0.3 * Math.abs(d.apply(p));
PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>(
PEikMeshGen meshImprover = new PEikMeshGen(
d,
h,
Arrays.asList(center),
h0,
bound,
(x, y) -> new EikMeshPoint(x, y, false));
bound
);
//meshImprover.setUseVirtualEdges(false);
//meshImprover.setAllowEdgeSplits(false);
......@@ -294,7 +289,7 @@ public class EikMeshExamples {
var meshSuppliert = PMeshSuppliert.defaultMeshSupplier;
var mesh = PolyGenerator.toMesh(inputStream, meshSuppliert);
var meshPanel = new PMeshPanel<>(mesh, 1000, 800);
var meshPanel = new PMeshPanel(mesh, 1000, 800);
// generate the mesh
......@@ -372,7 +367,7 @@ public class EikMeshExamples {
bound);
// (optional) define the gui to display the mesh
MeshPanel<EikMeshPoint, Object, Object, PVertex<EikMeshPoint, Object, Object>, PHalfEdge<EikMeshPoint, Object, Object>, PFace<EikMeshPoint, Object, Object>> meshPanel = new MeshPanel<>(
MeshPanel<PVertex, PHalfEdge, PFace> meshPanel = new MeshPanel<>(
meshImprover.getMesh(), 1000, 800);
// generate the mesh
......@@ -407,7 +402,7 @@ public class EikMeshExamples {
bound);
// (optional) define the gui to display the mesh
MeshPanel<EikMeshPoint, Object, Object, PVertex<EikMeshPoint, Object, Object>, PHalfEdge<EikMeshPoint, Object, Object>, PFace<EikMeshPoint, Object, Object>> meshPanel = new MeshPanel<>(
MeshPanel<PVertex, PHalfEdge, PFace> meshPanel = new MeshPanel<>(
meshImprover.getMesh(), 1000, 800);
// generate the mesh
......@@ -447,7 +442,7 @@ public class EikMeshExamples {
bound);
// (optional) define the gui to display the mesh
MeshPanel<EikMeshPoint, Object, Object, PVertex<EikMeshPoint, Object, Object>, PHalfEdge<EikMeshPoint, Object, Object>, PFace<EikMeshPoint, Object, Object>> meshPanel = new MeshPanel<>(
MeshPanel<PVertex, PHalfEdge, PFace> meshPanel = new MeshPanel<>(
meshImprover.getMesh(), 1000, 800);
// generate the mesh
......@@ -497,15 +492,15 @@ public class EikMeshExamples {
// like before but we have to add the point-constructor to the constructor of EikMesh and we use
// the more generic type PEikMeshGen instead of PEikMes!
PEikMeshGen<MyPoint, Object, Object> meshImprover = new PEikMeshGen<>(
PEikMeshGen meshImprover = new PEikMeshGen(
ringDistance,
edgeLengthFunction,
edgeLength,
bound,
pointConstructor);
bound
);
// (optional) define the gui to display the mesh
MeshPanel<MyPoint, Object, Object, PVertex<MyPoint, Object, Object>, PHalfEdge<MyPoint, Object, Object>, PFace<MyPoint, Object, Object>> meshPanel = new MeshPanel<>(
MeshPanel<PVertex, PHalfEdge, PFace> meshPanel = new MeshPanel<>(
meshImprover.getMesh(), 1000, 800);
meshPanel.display("User defined Points");
......
......@@ -67,13 +67,13 @@ public class EikMeshPlots {
points.add(new EikMeshPoint(random.nextDouble() * 10, random.nextDouble() * 10));
}
PDelaunayTriangulator<EikMeshPoint, Double, Double> dt = new PDelaunayTriangulator<>(points, (x, y) -> new EikMeshPoint(x, y));
PDelaunayTriangulator dt = new PDelaunayTriangulator(points);
dt.generate();
write(toTexDocument(TexGraphGenerator.toTikz(dt.getMesh(), f-> lightBlue, 1.0f)), "eikmesh_random_before");
VPolygon bound = dt.getMesh().toPolygon(dt.getMesh().getBorder());
var meshImprover = new PEikMeshGen<>(
var meshImprover = new PEikMeshGen(
p -> 1.0 + Math.abs(bound.distance(p)),
dt.getTriangulation()
);
......@@ -84,7 +84,7 @@ public class EikMeshPlots {
write(toTexDocument(TexGraphGenerator.toTikz(meshImprover.getMesh(), f-> lightBlue, 1.0f)), "eikmesh_random_after");
// display the mesh
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(dt.getMesh(), 1000, 1000);
PMeshPanel meshPanel = new PMeshPanel(dt.getMesh(), 1000, 1000);
meshPanel.display("Random Delaunay triangulation");
}
......@@ -100,17 +100,16 @@ public class EikMeshPlots {
// (3) use EikMesh to improve the mesh
double h0 = 5.0;
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
distanceFunction,
p -> h0 + 0.3 * Math.abs(distanceFunction.apply(p)),
h0,
new VRectangle(segmentBound.getBounds2D()),
pslg.getHoles(),
pointConstructor
pslg.getHoles()
);
meshImprover.generate();
var meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
var meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
write(toTexDocument(TexGraphGenerator.toTikz(meshImprover.getMesh(), f-> lightBlue, 1.0f)), "eikmesh_kaiserslautern_"+ Double.toString(h0).replace('.', '_'));
// display the mesh
......@@ -129,16 +128,15 @@ public class EikMeshPlots {
// (3) use EikMesh to improve the mesh
double h0 = 1.0;
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
distanceFunction,
p -> h0 + 0.5 * Math.abs(distanceFunction.apply(p)),
h0,
new VRectangle(segmentBound.getBounds2D()),
pslg.getHoles(),
pointConstructor
pslg.getHoles()
);
var meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
var meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
meshPanel.display("Combined distance functions " + h0);
while (!meshImprover.isFinished()) {
meshImprover.improve();
......@@ -162,7 +160,7 @@ public class EikMeshPlots {
write(toTexDocument(TexGraphGenerator.toTikz(meshImprover.getMesh(), f-> lightBlue, 10.0f)), "eikmesh_a_"+ Double.toString(h0).replace('.', '_'));
// display the mesh
var meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 1000);
var meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 1000);
meshPanel.display("A");
}
......@@ -176,13 +174,13 @@ public class EikMeshPlots {
IDistanceFunction d_b = IDistanceFunction.create(boundary);
IDistanceFunction d_union = IDistanceFunction.union(IDistanceFunction.union(d1_c, d_r), d2_c);
IDistanceFunction d = IDistanceFunction.substract(d_b,d_union);
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
d,
p -> h0 + 0.3 * Math.abs(d.apply(p)),
h0,
GeometryUtils.boundRelative(boundary.getPath()),
Arrays.asList(rect),
(x, y) -> new EikMeshPoint(x, y, false));
Arrays.asList(rect)
);
// generate the mesh
meshImprover.generate();
......@@ -190,7 +188,7 @@ public class EikMeshPlots {
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
// (optional) define the gui to display the mesh
var meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
var meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
write(toTexDocument(TexGraphGenerator.toTikz(meshImprover.getMesh(), f-> lightBlue, 10.0f)), "eikmesh_d_combined_"+ Double.toString(h0).replace('.', '_'));
// display the mesh
......@@ -204,13 +202,13 @@ public class EikMeshPlots {
IDistanceFunction d_c = IDistanceFunction.createDisc(0, 0, 0.5);
IDistanceFunction d_r = IDistanceFunction.create(rect);
IDistanceFunction d = IDistanceFunction.substract(d_c, d_r);
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
d,
p -> h0 + 0.3 * Math.abs(d.apply(p)),
h0,
GeometryUtils.boundRelative(boundary.getPath()),
Arrays.asList(rect),
(x, y) -> new EikMeshPoint(x, y, false));
Arrays.asList(rect)
);
// generate the mesh
meshImprover.generate();
......@@ -218,7 +216,7 @@ public class EikMeshPlots {
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
// (optional) define the gui to display the mesh
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
PMeshPanel meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
write(toTexDocument(TexGraphGenerator.toTikz(meshImprover.getMesh(), f-> lightBlue, 10.0f)), "eikmesh_disc_rect_non_uniform_"+ Double.toString(h0).replace('.', '_'));
// display the mesh
......@@ -232,13 +230,13 @@ public class EikMeshPlots {
IDistanceFunction d_c = IDistanceFunction.createDisc(0, 0, 0.5);
IDistanceFunction d_r = IDistanceFunction.create(rect);
IDistanceFunction d = IDistanceFunction.substract(d_c, d_r);
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
var meshImprover = new PEikMeshGen(
d,
p -> h0 + 0.3 * Math.abs(d.apply(p)),
h0,
GeometryUtils.boundRelative(boundary.getPath()),
Arrays.asList(rect),
(x, y) -> new EikMeshPoint(x, y, false));
Arrays.asList(rect)
);
// generate the mesh
meshImprover.generate();
......@@ -246,7 +244,7 @@ public class EikMeshPlots {
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
// (optional) define the gui to display the mesh
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
PMeshPanel meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
write(toTexDocument(TexGraphGenerator.toTikz(meshImprover.getMesh(), f-> lightBlue, 10.0f)), "eikmesh_disc_rect_sub_non_uniform_"+ Double.toString(h0).replace('.', '_'));
// display the mesh
......@@ -263,17 +261,17 @@ public class EikMeshPlots {
// define the EikMesh-Improver
IEdgeLengthFunction h = p -> h0;
PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>(
PEikMeshGen meshImprover = new PEikMeshGen(
d,
h,
Arrays.asList(center),
h0,
bound,
(x, y) -> new EikMeshPoint(x, y, false));
bound
);
// (optional) define the gui to display the mesh
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
PMeshPanel meshPanel = new PMeshPanel(meshImprover.getMesh(), 1000, 800);
// generate the mesh
meshImprover.generate();
......@@ -321,14 +319,13 @@ public class EikMeshPlots {
IDistanceFunction distanceFunction = IDistanceFunction.create(segmentBound, holes);
IEdgeLengthFunction h = p -> 0.01 /*+ 0.2*Math.abs(distanceFunction.apply(p))*/;
var ruppert = new PRuppertsTriangulator<EikMeshPoint, Double, Double>(
var ruppert = new PRuppertsTriangulator(
pslg,