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 4d14df94 authored by Zoennchen's avatar Zoennchen Committed by Benedikt Zoennchen

further improvements of the GPU DistMesh alg. There is still a bug!

parent 07abbe58
......@@ -15,9 +15,8 @@ import java.util.Collection;
*/
public class CLGatherer {
public static <P extends IPoint> DoubleBuffer getVerticesD(@NotNull final AMesh<P> mesh) {
public static <P extends IPoint> DoubleBuffer getVerticesD(@NotNull final AMesh<P> mesh, @NotNull final DoubleBuffer vertexBuffer) {
Collection<AVertex<P>> vertices = mesh.getVertices();
DoubleBuffer vertexBuffer = MemoryUtil.memAllocDouble(vertices.size()*2);
int index = 0;
for(AVertex<P> vertex : vertices) {
assert index/2.0 == vertex.getId();
......@@ -29,9 +28,14 @@ public class CLGatherer {
return vertexBuffer;
}
public static <P extends IPoint> FloatBuffer getVerticesF(@NotNull final AMesh<P> mesh) {
public static <P extends IPoint> DoubleBuffer getVerticesD(@NotNull final AMesh<P> mesh) {
Collection<AVertex<P>> vertices = mesh.getVertices();
return getVerticesD(mesh, MemoryUtil.memAllocDouble(vertices.size()*2));
}
public static <P extends IPoint> FloatBuffer getVerticesF(@NotNull final AMesh<P> mesh, @NotNull final FloatBuffer vertexBuffer) {
Collection<AVertex<P>> vertices = mesh.getVertices();
FloatBuffer vertexBuffer = MemoryUtil.memAllocFloat(vertices.size()*2);
int index = 0;
for(AVertex<P> vertex : vertices) {
assert index/2.0 == vertex.getId();
......@@ -43,6 +47,11 @@ public class CLGatherer {
return vertexBuffer;
}
public static <P extends IPoint> FloatBuffer getVerticesF(@NotNull final AMesh<P> mesh) {
Collection<AVertex<P>> vertices = mesh.getVertices();
return getVerticesF(mesh, MemoryUtil.memAllocFloat(vertices.size()*2));
}
// TODO: maybe remove duplicated edges
public static <P extends IPoint> IntBuffer getEdges(@NotNull final AMesh<P> mesh) {
Collection<AHalfEdge<P>> edges = mesh.getEdges();
......
......@@ -101,12 +101,12 @@ public class CLPSMeshing implements IPSMeshing {
step(true);
}
public void step(boolean flipAll) {
public boolean step(boolean flipAll) {
minDeltaTravelDistance = Double.MAX_VALUE;
illegalMovement = false;
//log.info(scalingFactor);
clDistMesh.step(flipAll);
//flipEdges();
//retriangulate();
......@@ -133,6 +133,7 @@ public class CLPSMeshing implements IPSMeshing {
}
numberOfIterations++;
return clDistMesh.step(flipAll);
/*log.info("#illegalMovementTests: " + numberOfIllegalMovementTests);
log.info("#retriangulations: " + numberOfRetriangulations);
log.info("#steps: " + numberOfIterations);
......@@ -180,14 +181,17 @@ public class CLPSMeshing implements IPSMeshing {
//Set<MeshPoint> points = getMesh().getVertices().stream().map(vertex -> getMesh().getPoint(vertex)).collect(Collectors.toSet());
//removeLowQualityTriangles();
triangulation = ITriangulation.createATriangulation(IPointLocator.Type.DELAUNAY_HIERARCHY, getMesh().getPoints(), (x, y) -> new MeshPoint(x, y, false));
// removeTrianglesInsideObstacles();
removeTrianglesInsideObstacles();
triangulation.finalize();
if(clDistMesh != null) {
clDistMesh.finish();
}
clDistMesh = new CLDistMesh<>((AMesh<MeshPoint>) triangulation.getMesh());
clDistMesh.init();
else {
}
clDistMesh = new CLDistMesh<>((AMesh<MeshPoint>) triangulation.getMesh());
clDistMesh.init();
}
private void removeLowQualityTriangles() {
......
......@@ -48,7 +48,7 @@ public class TestEnhancedVersion3 extends JFrame {
int counter = 0;
long time = 0;
while (counter <= 1000) {
while (counter <= 300) {
//obscuteTriangles = meshGenerator.getTriangles().stream().filter(tri -> tri.isNonAcute()).count();
//PriorityQueue<PFace<MeshPoint>> priorityQueue = meshGenerator.getQuailties();
//avgQuality = priorityQueue.stream().reduce(0.0, (aDouble, meshPointPFace) -> aDouble + meshGenerator.faceToQuality(meshPointPFace), (d1, d2) -> d1 + d2) / priorityQueue.size();
......
......@@ -44,7 +44,7 @@ public class TestEnhancedVersion4 extends JFrame {
while (counter <= 400) {
while (counter < 1) {
//obscuteTriangles = meshGenerator.getTriangles().stream().filter(tri -> tri.isNonAcute()).count();
//PriorityQueue<PFace<MeshPoint>> priorityQueue = meshGenerator.getQuailties();
//avgQuality = priorityQueue.stream().reduce(0.0, (aDouble, meshPointPFace) -> aDouble + meshGenerator.faceToQuality(meshPointPFace), (d1, d2) -> d1 + d2) / priorityQueue.size();
......@@ -54,26 +54,32 @@ public class TestEnhancedVersion4 extends JFrame {
System.out.println("lowest quality ("+counter+"):"+ meshGenerator.faceToQuality(face));
}*/
long ms = System.currentTimeMillis();
if(counter < 100) {
meshGenerator.step(false);
}
else {
meshGenerator.step(true);
//meshGenerator.refresh();
//meshGenerator.retriangulate();
if(meshGenerator.step(true)) {
//meshGenerator.refresh();
meshGenerator.retriangulate();
}
meshGenerator.refresh();
/*if(meshGenerator.step(true)) {
meshGenerator.refresh();
meshGenerator.retriangulate();
}*/
ms = System.currentTimeMillis() - ms;
time += ms;
System.out.println("Step-Time: " + ms);
meshGenerator.refresh();
distmeshPanel.update();
distmeshPanel.repaint();
if(counter < 100) {
/*if(counter < 50) {
meshGenerator.retriangulate();
}
}*/
counter++;
/*try {
Thread.sleep(2000);
......
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