From ff86e47ceb47dc0d6bb57a41c40df75d3c878c71 Mon Sep 17 00:00:00 2001 From: Peter Powers <pmpowers@usgs.gov> Date: Tue, 22 Mar 2016 09:52:36 -0600 Subject: [PATCH] new config identifiers for concurrency and curve value types --- src/org/opensha2/calc/CurveValue.java | 16 +++++++++++ src/org/opensha2/calc/ThreadCount.java | 38 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/org/opensha2/calc/CurveValue.java create mode 100644 src/org/opensha2/calc/ThreadCount.java diff --git a/src/org/opensha2/calc/CurveValue.java b/src/org/opensha2/calc/CurveValue.java new file mode 100644 index 000000000..108874d6c --- /dev/null +++ b/src/org/opensha2/calc/CurveValue.java @@ -0,0 +1,16 @@ +package org.opensha2.calc; + +/** + * Hazard curve value types. + * + * @author Peter Powers + */ +public enum CurveValue { + + /** Annual-rate. */ + ANNUAL_RATE, + + /** Poisson probability. */ + POISSON_PROBABILITY; + +} diff --git a/src/org/opensha2/calc/ThreadCount.java b/src/org/opensha2/calc/ThreadCount.java new file mode 100644 index 000000000..eaef8470f --- /dev/null +++ b/src/org/opensha2/calc/ThreadCount.java @@ -0,0 +1,38 @@ +package org.opensha2.calc; + +import java.util.concurrent.ExecutorService; + +/** + * The number of threads with which to intialize thread pools. Values reference + * the number of non-competing threads that could be supported on a particular + * system as determined by calling {@link Runtime#availableProcessors()}. + * + * @author Peter Powers + */ +public enum ThreadCount { + + /** + * A single thread. Use of a single thread will generally prevent an + * {@link ExecutorService} from being used, and all calculations will be run + * on the thread from which a program was called. + */ + ONE, + + /** + * Half of {@code ALL}. + */ + HALF, + + /** + * Two less than {@code ALL}. So as to not commandeer all available + * resources. + */ + N_MINUS_2, + + /** + * All possible non-competing threads. The number of threads will equal the + * number of available processors. + */ + ALL; + +} -- GitLab