diff --git a/common-tools/cnuphys/swimmer/src/main/java/cnuphys/rk4/RungeKutta.java b/common-tools/cnuphys/swimmer/src/main/java/cnuphys/rk4/RungeKutta.java index 667a48473f..f362f412b2 100644 --- a/common-tools/cnuphys/swimmer/src/main/java/cnuphys/rk4/RungeKutta.java +++ b/common-tools/cnuphys/swimmer/src/main/java/cnuphys/rk4/RungeKutta.java @@ -2,6 +2,7 @@ import java.util.ArrayDeque; import java.util.List; +import java.util.concurrent.ConcurrentLinkedQueue; /** * Static methods for Runge-Kutta 4 integration, including a constant stepsize @@ -1062,6 +1063,42 @@ private int driver(double yo[], // A uniform step size advancer class UniformAdvance implements IAdvance { + static class State { + double k2[]; + double k3[]; + double k4[]; + double ytemp[]; + State(int dim) { + k2 = new double[dim]; + k3 = new double[dim]; + k4 = new double[dim]; + ytemp = new double[dim]; + } + State reset() { + for (int i=0; i { + StatePool(int size, int dim) { + for (int i=0; i