From d64c37f6f24abbfb7e02b8f9ea670a9b5e794f2e Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Sat, 24 Mar 2012 00:54:50 +0100 Subject: Initial commit. This version doesn't do much but evaluate VSOP87/Smart97 series. --- org/madore/ephem/Smart97.java | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 org/madore/ephem/Smart97.java (limited to 'org/madore/ephem/Smart97.java') diff --git a/org/madore/ephem/Smart97.java b/org/madore/ephem/Smart97.java new file mode 100644 index 0000000..3fa2b80 --- /dev/null +++ b/org/madore/ephem/Smart97.java @@ -0,0 +1,46 @@ +package org.madore.ephem; + +import java.util.List; +import java.util.ArrayList; +import java.util.EnumMap; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.BufferedReader; + +public final class Smart97 { + + public static enum Variable { + CHI("chi"), P("p"), EPSILON("epsilon"), + PHI("phi"), OMEGA("omega"), SIDTIME("sidtime"); + final String name; + Variable(String name) { this.name = name; } + } + + private static EnumMap data = new EnumMap(Variable.class); + + public static Comput.SumPoissonTerms getFunc(Variable v) { + if ( ! data.containsKey(v) ) { + List series = new ArrayList(); + try { + InputStream str = Smart97.class.getResourceAsStream("smart97-simp.dat"); + BufferedReader in = new BufferedReader(new InputStreamReader(str, "utf-8")); + String s; + while ( ( s = in.readLine() ) != null ) { + String[] fields = s.split("\t"); + if ( ! fields[0].equals("orient") || ! fields[1].equals(v.name) ) + continue; + int deg = Integer.parseInt(fields[2]); + double c = Double.parseDouble(fields[3]); + double phi = Double.parseDouble(fields[4]); + double om = Double.parseDouble(fields[5]); + series.add(Comput.PoissonTerm.cphi(deg, c, phi, om)); + } + } catch ( Exception e ) { + throw new RuntimeException(e); + } + data.put(v, new Comput.SumPoissonTerms(series)); + } + return data.get(v); + } + +} -- cgit v1.2.3