Skip to content

Commit

Permalink
Use solarsystem() / solarsystem_hp() if no DEFAULT_SOLSYS
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Feb 25, 2024
1 parent 0c39243 commit 8f4d2a8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1147525170" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.490761690" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="DEFAULT_SOLSYS=3"/>
<listOptionValue builtIn="false" value="THREAD_LOCAL=__thread"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1061272597" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
Expand Down
2 changes: 1 addition & 1 deletion include/novas.h
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ int hor_to_itrs(const on_surface *location, double az, double za, double *itrs);
}

# ifndef THREAD_LOCAL
# if __STDC_VERSION__ > 201112L
# if __STDC_VERSION__ >= 201112L
# define THREAD_LOCAL _Thread_local ///< C11 standard for thread local variables
# elif __GNUC__ >= 3 && __GNUC_MINOR__ >= 3
# define THREAD_LOCAL __thread ///< pre C11 gcc >= 3.3 standard for thread-local variables
Expand Down
9 changes: 9 additions & 0 deletions src/novas.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ static THREAD_LOCAL novas_nutation_provider nutate_lp = nu2000k;

static THREAD_LOCAL int is_case_sensitive = 0; ///< (boolean) whether object names are case-sensitive.

#ifndef DEFAULT_SOLSYS
# define DEFAULT_SOLSYS 0
#endif

#if !DEFAULT_SOLSYS
novas_planet_provider default_planetcalc = (novas_planet_provider) solarsystem;
novas_planet_provider_hp default_planetcalc_hp = (novas_planet_provider_hp) solarsystem_hp;
#endif

/**
* Enables or disables reporting errors and traces to the standard error stream. The debug setting is specific
* to the thread from which the call is made, and will not change the debug mode for other threads.
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include ../config.mk
CFLAGS = -I../include -O0 -g -pg -fprofile-arcs -ftest-coverage
LDFLAGS += -fprofile-arcs -ftest-coverage -lm

CFLAGS += -DDEFAULT_SOLSYS=3 -DDEFAULT_CIO_LOCATOR_FILE=\"cio_ra.bin\"
CFLAGS += -DDEFAULT_SOLSYS=0 -DDEFAULT_CIO_LOCATOR_FILE=\"cio_ra.bin\"

#OBJECTS := $(subst obj/,,$(OBJECTS))
OBJECTS := novas.o nutation.o solsys3.o
Expand Down
2 changes: 1 addition & 1 deletion test/src/test-errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ static int test_grav_def() {

if(check("grav_def:sun", 13, grav_def(NOVAS_JD_J2000, NOVAS_OBSERVER_AT_GEOCENTER, NOVAS_FULL_ACCURACY, p, po, p))) n++;

fprintf(stderr, ">> Now expecting an error and trace next:");
fprintf(stderr, ">>> Expecting an error and trace...\n");
novas_debug(NOVAS_DEBUG_EXTRA);
enable_earth_sun_hp(1);
if(check("grav_def:planets", 12, grav_def(NOVAS_JD_J2000, NOVAS_OBSERVER_AT_GEOCENTER, NOVAS_FULL_ACCURACY, p, po, p))) n++;
Expand Down
2 changes: 1 addition & 1 deletion test/src/test-super.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ static int test_ephem_provider() {

if(!is_ok("planet_provider:ephemeris", ephemeris(tdb2, &body, NOVAS_HELIOCENTER, NOVAS_FULL_ACCURACY, p, v))) goto cleanup; // @suppress("Goto statement used")
if(o == NOVAS_BARYCENTER) {
fprintf(stderr, " Expecing diffent A/B, twice:\n");
fprintf(stderr, ">>> Expecting diffent A/B, twice:\n");
if(!is_ok("planet_provider:check_pos", !check_equal_pos(p, p0, 1e-9 * vlen(p0)))) goto cleanup; // @suppress("Goto statement used")
if(!is_ok("planet_provider:check_vel", !check_equal_pos(v, v0, 1e-9 * vlen(v0)))) goto cleanup; // @suppress("Goto statement used")
fprintf(stderr, " OK.\n");
Expand Down

0 comments on commit 8f4d2a8

Please sign in to comment.