Skip to content

Commit

Permalink
CALCEPH integration (#85)
Browse files Browse the repository at this point in the history
* Initial CALCEPH integration

* solsys-calceph: Thread safe even when CALCEPH is not.

* A bit of cleanup

* Documentation for CALCEPH integration

* Fixes and tests for CALCEPH integration

* Test ephem files and automated CALCEPH testing (if integrated)

* Added test for get_planet_provider*()

* Further solsys-calceph test coverage

* Refactor CALCEPH_INTEGRATION to CALCEPH_SUPPORT

* test-super: Feature test macros for strcasecmp()

* Doc edits

* test-calceph: test semaphore functionality

* Doxygen edits

* naif.c: Tests and coverage

* Add novas_calceph_use_ids()

* Code structuring and streamlining
  • Loading branch information
attipaci authored Nov 9, 2024
1 parent 4997c38 commit 5082dca
Show file tree
Hide file tree
Showing 23 changed files with 1,427 additions and 118 deletions.
142 changes: 43 additions & 99 deletions .cproject
Original file line number Diff line number Diff line change
@@ -1,123 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.2126916097">
<storageModule
buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider"
id="cdt.managedbuild.toolchain.gnu.base.2126916097"
moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings />
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.2126916097" moduleId="org.eclipse.cdt.core.settings" name="Default">
<macros>
<stringMacro name="CALCEPH_SUPPORT" type="VALUE_TEXT" value="1"/>
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF"
point="org.eclipse.cdt.core.BinaryParser" />
<extension id="org.eclipse.cdt.core.GASErrorParser"
point="org.eclipse.cdt.core.ErrorParser" />
<extension id="org.eclipse.cdt.core.GmakeErrorParser"
point="org.eclipse.cdt.core.ErrorParser" />
<extension id="org.eclipse.cdt.core.GLDErrorParser"
point="org.eclipse.cdt.core.ErrorParser" />
<extension id="org.eclipse.cdt.core.CWDLocator"
point="org.eclipse.cdt.core.ErrorParser" />
<extension id="org.eclipse.cdt.core.GCCErrorParser"
point="org.eclipse.cdt.core.ErrorParser" />
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description=""
id="cdt.managedbuild.toolchain.gnu.base.2126916097"
name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo
id="cdt.managedbuild.toolchain.gnu.base.2126916097.1241896343"
name="/" resourcePath="">
<toolChain
id="cdt.managedbuild.toolchain.gnu.base.1979776327"
name="Linux GCC"
superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all"
binaryParser="org.eclipse.cdt.core.GNU_ELF"
id="cdt.managedbuild.target.gnu.platform.base.1322169932"
name="Debug Platform"
osList="linux,hpux,aix,qnx"
superClass="cdt.managedbuild.target.gnu.platform.base" />
<builder
id="cdt.managedbuild.target.gnu.builder.base.580482971"
keepEnvironmentInBuildfile="false"
managedBuildOn="false" name="Gnu Make Builder"
superClass="cdt.managedbuild.target.gnu.builder.base" />
<tool
id="cdt.managedbuild.tool.gnu.archiver.base.1226716055"
name="GCC Archiver"
superClass="cdt.managedbuild.tool.gnu.archiver.base" />
<tool
id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1270233007"
name="GCC C++ Compiler"
superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base" />
<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" />
<configuration buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.2126916097" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.2126916097.1241896343" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.1979776327" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="cdt.managedbuild.target.gnu.platform.base.1322169932" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder id="cdt.managedbuild.target.gnu.builder.base.580482971" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1226716055" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1270233007" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
<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" />
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1061272597" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.c.linker.base.1965833989"
name="GCC C Linker"
superClass="cdt.managedbuild.tool.gnu.c.linker.base">
<inputType
id="cdt.managedbuild.tool.gnu.c.linker.input.972517876"
superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput
kind="additionalinputdependency"
paths="$(USER_OBJS)" />
<additionalInput kind="additionalinput"
paths="$(LIBS)" />
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1965833989" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base">
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.972517876" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.cpp.linker.base.734261738"
name="GCC C++ Linker"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.base" />
<tool
id="cdt.managedbuild.tool.gnu.assembler.base.76755156"
name="GCC Assembler"
superClass="cdt.managedbuild.tool.gnu.assembler.base">
<inputType
id="cdt.managedbuild.tool.gnu.assembler.input.1601317039"
superClass="cdt.managedbuild.tool.gnu.assembler.input" />
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.734261738" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.76755156" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1601317039" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings" />
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="SuperNOVAS.null.21920899" name="SuperNOVAS" />
<project id="SuperNOVAS.null.21920899" name="SuperNOVAS"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders" />
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets" />
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true"
selectedProfileId="" />
<scannerConfigBuildInfo
instanceId="cdt.managedbuild.toolchain.gnu.base.2126916097;cdt.managedbuild.toolchain.gnu.base.2126916097.1241896343;cdt.managedbuild.tool.gnu.c.compiler.base.1147525170;cdt.managedbuild.tool.gnu.c.compiler.input.1061272597">
<autodiscovery enabled="true" problemReportingEnabled="true"
selectedProfileId="" />
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2126916097;cdt.managedbuild.toolchain.gnu.base.2126916097.1241896343;cdt.managedbuild.tool.gnu.c.compiler.base.1147525170;cdt.managedbuild.tool.gnu.c.compiler.input.1061272597">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/SuperNOVAS"/>
</configuration>
</storageModule>
</cproject>
5 changes: 5 additions & 0 deletions .settings/org.eclipse.cdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ doxygen/doxygen_use_javadoc_tags=true
doxygen/doxygen_use_pre_tag=false
doxygen/doxygen_use_structural_commands=false
eclipse.preferences.version=1
environment/project/cdt.managedbuild.toolchain.gnu.base.2126916097/CALCEPH_SUPPORT/delimiter=\:
environment/project/cdt.managedbuild.toolchain.gnu.base.2126916097/CALCEPH_SUPPORT/operation=append
environment/project/cdt.managedbuild.toolchain.gnu.base.2126916097/CALCEPH_SUPPORT/value=1
environment/project/cdt.managedbuild.toolchain.gnu.base.2126916097/append=true
environment/project/cdt.managedbuild.toolchain.gnu.base.2126916097/appendContributed=true
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]

Changes expected for the next bug-fix release, expected around 1 December 2024.
Expand All @@ -22,7 +23,24 @@ Changes expected for the next bug-fix release, expected around 1 December 2024.
gravitating bodies (other than the Sun and Earth). The added functions are `grav_redshift()`, `redhift_vrad()`,
`unredshift_vrad()`, `novas_z_add()`, and `novas_z_inv()`.

- #83: CALCEPH integration: `novas_use_calceph()` and/or `novas_use_calceph_planets()` to specify and use ephemeris
data via CALCEPH for Solar-system sources in general, and for major planets specifically; and
`novas_calceph_use_ids()` to specify whether `object.number` in `NOVAS_EPHEM_OBJECT` type objects is a NAIF ID
(default) or else a CALCEPH ID number of the Solar-system body. These functions are provided by the
`libsolsys-calceph.so[.1]` and/or `.a` plugin libraries, which are built contingent on the `CALCEPH_SUPPORT`
variable being set to 1 prior to the build. The build of the plugin module requires an accessible installation of
the CALCEPH development files (C headers and unversioned static or shared libraries depending on the needs of the
build).

- NOVAS-NAIF conversions for major planets (and Sun, Moon, SSB): `novas_to_naif_planet()` (planet centers),
`novas_to_dexxx_planet()` (mixed planet center/barycenter for DExxx ephemeris files), and the inverse
`naif_to_novas_planet()`.

- Added `get_planet_provider()` and `get_planet_provider_hp()` functions for convenience to return the `solarsystem()`
/ `solarsystem_hp()` type custom planet ephemeris provider functions currently configured, so they may be used
directly, outside of `ephemeris()` calls.


## [1.1.1] - 2024-10-28

Bug fix release. Nothing too scary, mainly just a collection of smaller fixes and improvements.
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ ifneq ($(BUILTIN_SOLSYS_EPHEM),1)
SHARED_TARGETS += $(LIB)/libsolsys-ephem.so
endif

ifeq ($(CALCEPH_SUPPORT),1)
CPPFLAGS += -DUSE_CALCEPH=1
SOLSYS_TARGETS += $(OBJ)/solsys-calceph.o
SHARED_TARGETS += $(LIB)/libsolsys-calceph.so
endif

# Default target for packaging with Linux distributions
.PHONY: distro
distro: $(SHARED_TARGETS) $(DOC_TARGETS)
Expand Down Expand Up @@ -106,6 +112,12 @@ $(LIB)/libsolsys1.so: $(LIB)/libsolsys1.so.$(SO_VERSION)

$(LIB)/libsolsys2.so: $(LIB)/libsolsys2.so.$(SO_VERSION)

$(LIB)/libsolsys3.so: $(LIB)/libsolsys2.so.$(SO_VERSION)

$(LIB)/libsolsys-ephem.so: $(LIB)/libsolsys-ephem.so.$(SO_VERSION)

$(LIB)/libsolsys-calceph.so: $(LIB)/libsolsys-calceph.so.$(SO_VERSION)

$(LIB)/libnovas.so: $(LIB)/libsupernovas.so

$(LIB)/libsolsys%.so.$(SO_VERSION): LDFLAGS += -L$(LIB) -lsupernovas
Expand All @@ -129,6 +141,11 @@ $(LIB)/libsolsys3.so.$(SO_VERSION): $(SRC)/solsys3.c | $(LIB)/libsupernovas.so
$(LIB)/libsolsys-ephem.so.$(SO_VERSION): BUILTIN_SOLSYS_EPHEM := 0
$(LIB)/libsolsys-ephem.so.$(SO_VERSION): $(SRC)/solsys-ephem.c | $(LIB)/libsupernovas.so

# Shared library: libsolsys-calceph.so.1 (standalone solsys2.c functionality)
$(LIB)/libsolsys-calceph.so.$(SO_VERSION): LDFLAGS += -lcalceph
$(LIB)/libsolsys-calceph.so.$(SO_VERSION): $(SRC)/solsys-calceph.c | $(LIB)/libsupernovas.so


# Static library: libnovas.a
$(LIB)/libnovas.a: $(OBJECTS) | $(LIB) Makefile

Expand Down
Loading

0 comments on commit 5082dca

Please sign in to comment.