Switch to gradle build

user: Alexander Nozik <altavir@gmail.com>
This commit is contained in:
Alexander Nozik 2016-05-08 18:44:14 +03:00
parent 9bb67f5691
commit 8e517aeecb
3 changed files with 8 additions and 12 deletions

View File

@ -11,7 +11,6 @@ import java.util.stream.Stream;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.SphericalCoordinates; import org.apache.commons.math3.geometry.euclidean.threed.SphericalCoordinates;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.random.JDKRandomGenerator;
import org.apache.commons.math3.random.MersenneTwister; import org.apache.commons.math3.random.MersenneTwister;
import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.RandomGenerator;
import org.apache.commons.math3.random.SynchronizedRandomGenerator; import org.apache.commons.math3.random.SynchronizedRandomGenerator;
@ -29,7 +28,7 @@ public class ElectronTrappingSimulator {
double Elow = 14000d; double Elow = 14000d;
double thetaTransport = 24.107064 / 180 * Math.PI; double thetaTransport = 24.107064 / 180 * Math.PI;
double thetaPinch = 19.481097 / 180 * Math.PI; double thetaPinch = 19.481097 / 180 * Math.PI;
public ElectronTrappingSimulator() { public ElectronTrappingSimulator() {
generator = new SynchronizedRandomGenerator(new MersenneTwister()); generator = new SynchronizedRandomGenerator(new MersenneTwister());
@ -159,7 +158,7 @@ public class ElectronTrappingSimulator {
double phi = generator.nextDouble()* 2 * Math.PI; double phi = generator.nextDouble()* 2 * Math.PI;
//Создаем начальный вектор в сферических координатах //Создаем начальный вектор в сферических координатах
SphericalCoordinates init = new SphericalCoordinates(1, 0, theta + dTheta); SphericalCoordinates init = new SphericalCoordinates(1, 0, theta + dTheta);
// Задаем вращение относительно оси, перпендикулярной исходному вектору // Задаем вращение относительно оси, перпендикулярной исходному вектору
SphericalCoordinates rotate = new SphericalCoordinates(1, 0, theta); SphericalCoordinates rotate = new SphericalCoordinates(1, 0, theta);
// поворачиваем исходный вектор на dTheta // поворачиваем исходный вектор на dTheta
Rotation rot = new Rotation(rotate.getCartesian(), phi); Rotation rot = new Rotation(rotate.getCartesian(), phi);

View File

@ -16,7 +16,6 @@
package inr.numass.trapping; package inr.numass.trapping;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.PrintWriter;
import static java.lang.Integer.valueOf; import static java.lang.Integer.valueOf;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -17,15 +17,13 @@ public class Trapping {
File file = new File(args[0]); File file = new File(args[0]);
out = new PrintStream(file); out = new PrintStream(file);
} else { } else {
} }
double E = 18000d; double E = 18000d;
System.out.println(); System.out.println();
// System.setProperty("jna.library.path", "d:\\projects\\Trapping\\target\\classes\\win32-amd64\\libScatter.dll");
ElectronTrappingSimulator simulator = new ElectronTrappingSimulator(); ElectronTrappingSimulator simulator = new ElectronTrappingSimulator();
simulator.setFields(0.6, 3.6, 7.2); simulator.setFields(0.6, 3.6, 7.2);
// ElectronTrappingSimulator.SimulaionResult result;
int accepted = 0; int accepted = 0;
int pass = 0; int pass = 0;
@ -33,18 +31,18 @@ public class Trapping {
int lowE = 0; int lowE = 0;
simulator.scatter.counter.resetAll(); simulator.scatter.counter.resetAll();
List<ElectronTrappingSimulator.SimulaionResult> results = simulator.simulateAll(E, 10000); List<ElectronTrappingSimulator.SimulaionResult> results = simulator.simulateAll(E, (int) 1e6);
simulator.scatter.counter.print(System.out); simulator.scatter.counter.print(System.out);
System.out.printf("%nSimulation complete.%n%n"); System.out.printf("%nSimulation complete.%n%n");
for (ElectronTrappingSimulator.SimulaionResult res : results) { for (ElectronTrappingSimulator.SimulaionResult res : results) {
if (out != null) {
ElectronTrappingSimulator.printOne(System.out, res);
}
switch (res.state) { switch (res.state) {
case ACCEPTED: case ACCEPTED:
// ElectronTrappingSimulator.printOne(System.out, res); // ElectronTrappingSimulator.printOne(System.out, res);
if (out != null) {
ElectronTrappingSimulator.printOne(out, res);
}
accepted++; accepted++;
break; break;
case LOWENERGY: case LOWENERGY: