Examples of RDProfiler


Examples of com.barrybecker4.simulation.reactiondiffusion.RDProfiler

    public void timeStep(final double dt) {

        int numThreads = parallelizer.getNumThreads();
        List<Runnable> workers = new ArrayList<Runnable>(numThreads + 1);
        int range = model_.getWidth() / numThreads;
        RDProfiler prof = RDProfiler.getInstance();

        prof.startConcurrentCalculationTime();
        for (int i = 0; i < (numThreads - 1); i++) {
            int offset = i * range;
            workers.add(new Worker(1 + offset, offset + range, dt));
        }

        int minXEdge = range * (numThreads - 1) + 1;
        int maxXEdge = model_.getWidth() - 2;
        workers.add(new Worker(minXEdge, maxXEdge, dt));

        // also add the border calculations in a separate thread.
        Runnable edgeWorker = new Runnable() {
            public void run() {
                algorithm_.computeNewEdgeValues(dt);
            }
        };
        workers.add(edgeWorker);

        // blocks until all Callables are done running.
        parallelizer.invokeAllRunnables(workers);
        prof.stopConcurrentCalculationTime();

        prof.startCommitChangesTime();
        model_.commitChanges();
        prof.stopCommitChangesTime();

        if (requestedNewSize != null) {
             model_.setSize(requestedNewSize);
             requestedNewSize = null;
             reset();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.