Skip to content
Snippets Groups Projects
Commit 3ebdc53e authored by Daniel Schramm's avatar Daniel Schramm
Browse files

Own parallel implementation deleted and existing implementation used instead

parent e2fa67e0
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.vecmath.Point3d;
/**
......@@ -222,30 +220,11 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
@Override
public void visitHumanFace(HumanFace humanFace) {
final FeaturePoint featurePoint = humanFace.getFeaturePoints().get(featurePointType.getType());
final List<MeshFacet> facets = humanFace.getMeshModel().getFacets();
final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
humanFace.getMeshModel().compute(distanceVisitor, inParallel());
final FeaturePoint featurePoint = humanFace.getFeaturePoints().get(featurePointType.getType());
final PrioritySphere priorityVisitor = new PrioritySphere(featurePoint.getPosition(), 1 /*TODO TEMPORARY - sphere radius needs to be computed dynamically*/);
for (final MeshFacet comparedFacet: facets) { // For each mesh facet of the visited human face
if (inParallel() && distanceVisitor.isThreadSafe()) {
executor.execute(() -> comparedFacet.accept(distanceVisitor)); // Fork and continue
} else {
comparedFacet.accept(distanceVisitor); // Process immediately
}
if (inParallel() && priorityVisitor.isThreadSafe()) {
executor.execute(() -> comparedFacet.accept(priorityVisitor)); // Fork and continue
} else {
comparedFacet.accept(priorityVisitor); // Proces immediately
}
// Visitors store results into their internal structure
}
if (inParallel()) {
executor.shutdown();
while (!executor.isTerminated()){} // Wait until all computations are finished
}
humanFace.getMeshModel().compute(priorityVisitor, inParallel());
synchronized(this) {
// Retrieve results from the visitor's internal structure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment