use of gaiasky.interafce.ConsoleLogger in project gaiasky by langurmonkey.
the class OctreeGeneratorRun method run.
public void run() {
try {
if (outFolder == null) {
outFolder = System.getProperty("java.io.tmpdir");
}
if (!outFolder.endsWith("/"))
outFolder += "/";
Path outPath = Path.of(outFolder);
Files.createDirectories(outPath);
// Assets location
String ASSETS_LOC = Settings.ASSETS_LOC;
Gdx.files = new Lwjgl3Files();
// Add notification watch
new ConsoleLogger();
// Initialize number format
NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
// Initialize date format
DateFormatFactory.initialize(new DesktopDateFormatFactory());
// Initialize i18n
I18n.initialize(Path.of(ASSETS_LOC, "i18n/gsbundle"));
// Initialize configuration
Path dummyv = Path.of(ASSETS_LOC, "data/dummyversion");
if (!Files.exists(dummyv)) {
dummyv = Path.of(ASSETS_LOC, "dummyversion");
}
SettingsManager.initialize(new FileInputStream(Path.of(ASSETS_LOC, "conf/config.yaml").toFile()), new FileInputStream(dummyv.toFile()));
// Parallelism
if (parallelism > 0) {
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", String.valueOf(parallelism));
}
logger.info("Parallelism set to " + ForkJoinPool.commonPool().getParallelism());
OctreeNode root = generateOctree();
if (root != null) {
// Save arguments and structure
StringBuffer argStr = new StringBuffer();
for (int i = 0; i < arguments.length; i++) {
argStr.append(arguments[i]).append(" ");
}
try (PrintStream out = new PrintStream(new FileOutputStream(outFolder + "log"))) {
out.print(argStr);
out.println();
out.println();
for (MessageBean msg : NotificationsInterface.getHistorical()) {
out.println(msg.toString());
}
}
}
} catch (Exception e) {
logger.error(e);
}
}
use of gaiasky.interafce.ConsoleLogger in project gaiasky by langurmonkey.
the class OortGenerator method main.
public static void main(String[] args) {
try {
Gdx.files = new Lwjgl3Files();
// Initialize number format
NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
// Initialize date format
DateFormatFactory.initialize(new DesktopDateFormatFactory());
SettingsManager.initialize(new FileInputStream("../assets/conf/config.yaml"), new FileInputStream("../assets/data/dummyversion"));
I18n.initialize(new FileHandle(System.getenv("PROJECTS") + "/gaiasky/android/assets/i18n/gsbundle"));
// Add notif watch
new ConsoleLogger();
Array<double[]> oort = null;
oort = generateOort();
if (writeFile) {
writeToDisk(oort, "/tmp/");
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of gaiasky.interafce.ConsoleLogger in project gaiasky by langurmonkey.
the class Positions2DExtractor method main.
public static void main(String[] args) throws IOException {
Positions2DExtractor p2d = new Positions2DExtractor();
new ConsoleLogger();
I18n.initialize(new FileHandle(System.getenv("PROJECTS") + "/gaiasky/assets/i18n/gsbundle"));
Gdx.files = new Lwjgl3Files();
try {
NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
DateFormatFactory.initialize(new DesktopDateFormatFactory());
SettingsManager.initialize(false);
} catch (Exception e) {
Logger.getLogger(Positions2DExtractor.class).error(e);
}
p2d.process();
}
use of gaiasky.interafce.ConsoleLogger in project gaiasky by langurmonkey.
the class HeliotropicOrbitDataLoader method main.
public static void main(String[] args) {
HeliotropicOrbitDataLoader l = new HeliotropicOrbitDataLoader();
try {
// Assets location
String ASSETS_LOC = Settings.ASSETS_LOC;
// Logger
new ConsoleLogger();
Gdx.files = new Lwjgl3Files();
// Initialize number format
NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
// Initialize date format
DateFormatFactory.initialize(new DesktopDateFormatFactory());
SettingsManager.initialize(new FileInputStream(ASSETS_LOC + "/conf/config.yaml"), new FileInputStream(ASSETS_LOC + "/dummyversion"));
I18n.initialize(new FileHandle(ASSETS_LOC + "/i18n/gsbundle"));
// Initialize math manager
MathManager.initialize();
String inputFile = System.getProperty("user.home") + "/Downloads/orbit.JWST.heliotropic.csv";
String outputFile = System.getProperty("user.home") + "/Downloads/orbit.JWST.dat";
PointCloudData od = l.load(new FileInputStream(inputFile));
logger.info("Loaded and converted " + od.getNumPoints() + " orbit data points: " + inputFile);
OrbitDataWriter.writeOrbitData(outputFile, od);
logger.info("Results written successfully: " + outputFile);
} catch (Exception e) {
logger.error(e);
}
}
use of gaiasky.interafce.ConsoleLogger in project gaiasky by langurmonkey.
the class OrbitSamplerDataProvider method main.
public static void main(String[] args) {
try {
// Assets location
String ASSETS_LOC = Settings.ASSETS_LOC;
// Logger
new ConsoleLogger();
Gdx.files = new Lwjgl3Files();
// Initialize number format
NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
// Initialize date format
DateFormatFactory.initialize(new DesktopDateFormatFactory());
SettingsManager.initialize(new FileInputStream(ASSETS_LOC + "/conf/config.yaml"), new FileInputStream(ASSETS_LOC + "/dummyversion"));
I18n.initialize(new FileHandle(ASSETS_LOC + "/i18n/gsbundle"));
// Initialize math manager
MathManager.initialize();
OrbitSamplerDataProvider.writeData = true;
OrbitSamplerDataProvider me = new OrbitSamplerDataProvider();
Date now = new Date();
String[] bodies = new String[] { "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Moon", "Pluto" };
double[] periods = new double[] { 87.9691, 224.701, 365.256363004, 686.971, 4332.59, 10759.22, 30799.095, 60190.03, 27.321682, 90560.0 };
for (int i = 0; i < bodies.length; i++) {
String b = bodies[i];
double period = periods[i];
OrbitDataLoaderParameter param = new OrbitDataLoaderParameter(me.getClass(), b, now, true, period, 500);
me.load(null, param);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations