├── Jamfile ├── test ├── units │ ├── Jamfile │ ├── CMakeLists.txt │ └── length.cpp ├── time │ ├── Jamfile │ ├── CMakeLists.txt │ └── time_conversions.cpp ├── io │ ├── fits_sample_files │ │ ├── test_random_file.txt │ │ ├── fits_sample1.fits │ │ └── fits_sample3.fits │ ├── Jamfile │ ├── CMakeLists.txt │ ├── t_string_conversions.cpp │ ├── base_fixture.hpp │ ├── t_fits.cpp │ ├── t_primary_hdu.cpp │ ├── t_stream_reader.cpp │ ├── t_fits_reader.cpp │ ├── t_header.cpp │ ├── t_ascii_table.cpp │ ├── t_binary_table.cpp │ └── t_card_policy.cpp ├── CMakeLists.txt ├── Jamfile ├── coordinate │ ├── Jamfile │ ├── CMakeLists.txt │ ├── equatorial_ha_coord.cpp │ ├── galactic_coord.cpp │ ├── ecliptic_coord.cpp │ ├── equatorial_ra_coord.cpp │ └── horizon_coord.cpp └── header │ ├── main.cpp │ ├── Jamfile │ └── CMakeLists.txt ├── .github └── pull_request_template.md ├── include └── boost │ └── astronomy │ ├── coordinate │ ├── coord_sys │ │ ├── coordinate.hpp │ │ ├── coord_sys.hpp │ │ ├── geocentric.hpp │ │ ├── heliocentric.hpp │ │ ├── horizon_coord.hpp │ │ └── galactic_coord.hpp │ ├── rep │ │ ├── representation.hpp │ │ └── base_representation.hpp │ ├── diff │ │ ├── differential.hpp │ │ └── base_differential.hpp │ ├── ref_frame │ │ ├── frame.hpp │ │ ├── icrs.hpp │ │ ├── cirs.hpp │ │ └── base_frame.hpp │ ├── io │ │ └── io.hpp │ └── sky_point.hpp │ ├── time │ ├── parser.hpp │ └── time_conversions.hpp │ ├── detail │ └── is_base_template_of.hpp │ ├── io │ ├── extension_hdu.hpp │ ├── bitpix.hpp │ ├── string_conversion_utility.hpp │ ├── fits.hpp │ ├── table_extension.hpp │ ├── image_extension.hpp │ ├── default_hdus.hpp │ ├── fits_stream.hpp │ ├── primary_hdu.hpp │ └── column_data.hpp │ ├── units │ └── length.hpp │ └── exception │ └── fits_exception.hpp ├── .gitignore ├── .editorconfig ├── doc └── tutorials │ ├── coordinate │ ├── coordinate_conversion.md │ ├── euclidean_coordinate.md │ ├── motion.md │ ├── vector_operation.md │ ├── astronomical_coordinate.md │ └── astronomical_coordinate_operation.md │ └── index.md ├── License.txt ├── README.md ├── .clang-format ├── appveyor.yml └── CMakeLists.txt /Jamfile: -------------------------------------------------------------------------------- 1 | build-project test ; 2 | -------------------------------------------------------------------------------- /test/units/Jamfile: -------------------------------------------------------------------------------- 1 | import testing ; 2 | 3 | run length.cpp ; 4 | -------------------------------------------------------------------------------- /test/time/Jamfile: -------------------------------------------------------------------------------- 1 | import testing ; 2 | 3 | run time_conversions.cpp ; 4 | -------------------------------------------------------------------------------- /test/io/fits_sample_files/test_random_file.txt: -------------------------------------------------------------------------------- 1 | Hello World! . Boost is the best Open Source Organization in the World!!! 2 | -------------------------------------------------------------------------------- /test/io/fits_sample_files/fits_sample1.fits: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoostGSoC19/astronomy/HEAD/test/io/fits_sample_files/fits_sample1.fits -------------------------------------------------------------------------------- /test/io/fits_sample_files/fits_sample3.fits: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoostGSoC19/astronomy/HEAD/test/io/fits_sample_files/fits_sample3.fits -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(header) 2 | 3 | add_subdirectory(coordinate) 4 | 5 | add_subdirectory(units) 6 | 7 | add_subdirectory(time) 8 | 9 | add_subdirectory(io) 10 | -------------------------------------------------------------------------------- /test/Jamfile: -------------------------------------------------------------------------------- 1 | import testing ; 2 | 3 | project 4 | : requirements 5 | .. 6 | /boost/test//boost_unit_test_framework 7 | shared:BOOST_TEST_DYN_LINK=1 8 | ; 9 | 10 | 11 | build-project header ; 12 | build-project coordinate ; 13 | build-project units ; 14 | build-project io ; 15 | build-project time ; 16 | -------------------------------------------------------------------------------- /test/coordinate/Jamfile: -------------------------------------------------------------------------------- 1 | import testing ; 2 | 3 | run cartesian_representation.cpp ; 4 | run cartesian_differential.cpp ; 5 | run spherical_representation.cpp ; 6 | run spherical_differential.cpp ; 7 | run spherical_equatorial_representation.cpp ; 8 | run spherical_equatorial_differential.cpp ; 9 | run horizon_coord.cpp ; 10 | run galactic_coord.cpp ; 11 | run ecliptic_coord.cpp ; 12 | run equatorial_ra_coord.cpp ; 13 | run equatorial_ha_coord.cpp ; 14 | run utility.cpp ; 15 | 16 | -------------------------------------------------------------------------------- /test/units/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | foreach(_name 2 | length) 3 | set(_target test_units_${_name}) 4 | 5 | add_executable(${_target} "") 6 | target_sources(${_target} PRIVATE ${_name}.cpp) 7 | target_link_libraries(${_target} 8 | PRIVATE 9 | astronomy_compile_options 10 | astronomy_include_directories 11 | astronomy_dependencies) 12 | add_test(NAME test.astro.${_name} COMMAND ${_target}) 13 | 14 | unset(_name) 15 | unset(_target) 16 | endforeach() 17 | -------------------------------------------------------------------------------- /test/io/Jamfile: -------------------------------------------------------------------------------- 1 | using testing ; 2 | path-constant CURR_DIR : . ; 3 | 4 | run t_ascii_table.cpp : $(CURR_DIR) ; 5 | run t_binary_table.cpp : $(CURR_DIR) ; 6 | run t_card.cpp : $(CURR_DIR) ; 7 | run t_header.cpp : $(CURR_DIR) ; 8 | run t_primary_hdu.cpp : $(CURR_DIR) ; 9 | run t_fits.cpp : $(CURR_DIR) ; 10 | run t_stream_reader.cpp : $(CURR_DIR) ; 11 | run t_fits_reader.cpp : $(CURR_DIR) ; 12 | run t_data_conversions.cpp : $(CURR_DIR) ; 13 | run t_card_policy.cpp : $(CURR_DIR) ; 14 | run t_string_conversions.cpp : $(CURR_DIR) ; 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | foreach(_name 2 | time_conversions) 3 | set(_target test_coordinate_${_name}) 4 | 5 | add_executable(${_target} "") 6 | target_sources(${_target} PRIVATE ${_name}.cpp) 7 | target_link_libraries(${_target} 8 | PRIVATE 9 | astronomy_compile_options 10 | astronomy_include_directories 11 | astronomy_dependencies) 12 | add_test(NAME test.astro.${_name} COMMAND ${_target}) 13 | 14 | unset(_name) 15 | unset(_target) 16 | endforeach() 17 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Description 4 | 5 | 6 | 7 | ### References 8 | 9 | 10 | 11 | ### Tasklist 12 | 13 | 14 | 15 | - [ ] Add test case(s) 16 | - [ ] Ensure all CI builds pass 17 | - [ ] Review and approve 18 | -------------------------------------------------------------------------------- /test/header/main.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2019 Pranam Lashkari 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #define BOOST_ASTRONOMY_TEST_INCLUDE_HEADER() 9 | 10 | #include BOOST_ASTRONOMY_TEST_INCLUDE_HEADER() 11 | 12 | int main() 13 | { 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /include/boost/astronomy/coordinate/coord_sys/coordinate.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2018 Pranam Lashkari 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_COORDINATE_HPP 9 | #define BOOST_ASTRONOMY_COORDINATE_HPP 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #endif // !BOOST_ASTRONOMY_COORDINATE_HPP 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Prerequisites 3 | *.d 4 | 5 | # Compiled Object files 6 | *.slo 7 | *.lo 8 | *.o 9 | *.obj 10 | 11 | # Precompiled Headers 12 | *.gch 13 | *.pch 14 | 15 | # Compiled Dynamic libraries 16 | *.so 17 | *.dylib 18 | *.dll 19 | 20 | # Fortran module files 21 | *.mod 22 | *.smod 23 | 24 | # Compiled Static libraries 25 | *.lai 26 | *.la 27 | *.a 28 | *.lib 29 | 30 | # Executables 31 | *.exe 32 | *.out 33 | *.app 34 | 35 | # Builds 36 | /.vs 37 | /.vscode 38 | /build 39 | /.idea 40 | /cmake-build-debug 41 | /x64/Debug 42 | /out 43 | 44 | # CMakeSettings File 45 | /CMakeSettings.json 46 | 47 | # Project files 48 | /testing 49 | /Debug 50 | /astronomy.vcxproj.user 51 | /astronomy.vcxproj.filters 52 | /astronomy.vcxproj 53 | /astronomy.sln 54 | *.user 55 | *.project 56 | /ClassDiagram.cd 57 | 58 | -------------------------------------------------------------------------------- /include/boost/astronomy/coordinate/rep/representation.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2018 Pranam Lashkari 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_COORDINATE_REPRESENTATION_HPP 9 | #define BOOST_ASTRONOMY_COORDINATE_REPRESENTATION_HPP 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #endif // !BOOST_ASTRONOMY_COORDINATE_REPRESENTATION_HPP 16 | 17 | -------------------------------------------------------------------------------- /test/io/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | foreach(_name 2 | t_header 3 | t_card 4 | t_primary_hdu 5 | t_ascii_table 6 | t_binary_table 7 | t_fits 8 | t_stream_reader 9 | t_fits_reader 10 | t_data_conversions 11 | t_card_policy 12 | t_string_conversions 13 | ) 14 | set(_target test_fits_${_name}) 15 | 16 | add_executable(${_target} "") 17 | target_compile_definitions(${_target} PRIVATE SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") 18 | target_sources(${_target} PRIVATE ${_name}.cpp) 19 | target_link_libraries(${_target} 20 | PRIVATE 21 | astronomy_compile_options 22 | astronomy_include_directories 23 | astronomy_dependencies) 24 | add_test(NAME test.astro.${_name} COMMAND ${_target}) 25 | 26 | unset(_name) 27 | unset(_target) 28 | endforeach() 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/coordinate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | foreach(_name 2 | horizon_coord 3 | galactic_coord 4 | ecliptic_coord 5 | equatorial_ra_coord 6 | equatorial_ha_coord 7 | cartesian_representation 8 | cartesian_differential 9 | spherical_representation 10 | spherical_differential 11 | spherical_equatorial_representation 12 | spherical_equatorial_differential 13 | utility) 14 | set(_target test_coordinate_${_name}) 15 | 16 | add_executable(${_target} "") 17 | target_sources(${_target} PRIVATE ${_name}.cpp) 18 | target_link_libraries(${_target} 19 | PRIVATE 20 | astronomy_compile_options 21 | astronomy_include_directories 22 | astronomy_dependencies) 23 | add_test(NAME test.astro.${_name} COMMAND ${_target}) 24 | 25 | unset(_name) 26 | unset(_target) 27 | endforeach() 28 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | # 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_size = 4 8 | indent_style = space 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.{cpp,hpp}] 13 | guidelines = 100 14 | indent_size = 4 15 | indent_style = space 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.rst] 20 | guidelines = 100 21 | indent_size = 4 22 | indent_style = space 23 | max_line_length = 90 24 | trim_trailing_whitespace = true 25 | insert_final_newline = true 26 | 27 | [{Jamfile*,CMakeLists.txt,CMakeSettings.json,*.cmake}] 28 | guidelines = 100 29 | indent_size = 2 30 | indent_style = space 31 | trim_trailing_whitespace = true 32 | insert_final_newline = true 33 | 34 | [*.yml] 35 | indent_size = 2 36 | indent_style = space 37 | trim_trailing_whitespace = true 38 | insert_final_newline = true 39 | -------------------------------------------------------------------------------- /include/boost/astronomy/coordinate/diff/differential.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2018 Pranam Lashkari 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_COORDINATE_DIFFERENTIAL_HPP 9 | #define BOOST_ASTRONOMY_COORDINATE_DIFFERENTIAL_HPP 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #endif // !BOOST_ASTRONOMY_COORDINATE_DIFFERENTIAL_HPP 17 | 18 | -------------------------------------------------------------------------------- /include/boost/astronomy/coordinate/ref_frame/frame.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2018 Pranam Lashkari 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_COORDINATE_FRAME_HPP 9 | #define BOOST_ASTRONOMY_COORDINATE_FRAME_HPP 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #endif // !BOOST_ASTRONOMY_COORDINATE_FRAME_HPP 20 | 21 | -------------------------------------------------------------------------------- /doc/tutorials/coordinate/coordinate_conversion.md: -------------------------------------------------------------------------------- 1 | # Coordinate Conversions 2 | 3 | The following image can explain the relation between cartesian and spherical representation. 4 | ![coordinate relation](coordinate_relation.svg) 5 | 6 | Converting one coordinate to another coordinate is really easy. The system is developed in such a way that all the conversions are done implicitly. 7 | 8 | ## Example: 9 | ```c++ 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | using namespace boost::astronomy::coordinate; 17 | using namespace boost::units; 18 | using namespace boost::units::si; 19 | 20 | int main() 21 | { 22 | auto point1 = make_cartesian_representation(10.0*meter, 20.0*meter, 30.0*meter); 23 | 24 | auto point2 = make_spherical_representation(point1); 25 | 26 | spherical_representation, quantity, 27 | quantity> point3(point1); 28 | 29 | auto point4 = make_cartesian_representation(point3); 30 | std::cin.get(); 31 | return 0; 32 | } 33 | ``` 34 | [Previous](coordinate_point.md) | [Next](vector_operation.md) 35 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /doc/tutorials/coordinate/euclidean_coordinate.md: -------------------------------------------------------------------------------- 1 | # Euclidean Coordinate 2 | 3 | Astronomy is a field which often deals with mathematics and especially when we are talking about the observations, geometry is used for keeping the data of the object's position. 4 | 5 | In geometry Euclidean space has a really important part. It allows us to represent the position of a point or a vector. There are many different representations of it. (e.g: cartesian, cylindrical, spherical etc..) 6 | 7 | All the representation classes use [boost::geometry::model::point](https://www.boost.org/doc/libs/1_67_0/libs/geometry/doc/html/geometry/reference/models/model_point.html) as their underlying classes to store the component data. These representation classes are only wrappers around boost.geometry. 8 | 9 | ## Supported Representation in this library: 10 | 1. Cartesian Representation 11 | 2. Spherical Representation 12 | 3. Equatorial Representation 13 | 14 | >**Note:** While using this library we insist you use Equatorial Representation only when you are using it for locations on earth with longitude and latitude. 15 | 16 | To import all the representation, following is required: 17 | 18 | ```c++ 19 | #include 20 | ``` 21 | 22 | ### References: 23 | * https://en.wikipedia.org/wiki/Coordinate_system 24 | * https://en.wikipedia.org/wiki/Euclidean_space 25 | 26 | [Previous](../index.md) | [Next](coordinate_point.md) 27 | -------------------------------------------------------------------------------- /test/header/Jamfile: -------------------------------------------------------------------------------- 1 | import os ; 2 | import path ; 3 | import regex ; 4 | 5 | rule generate_self_contained_headers ( headers_subpath * : exclude_subpaths * ) 6 | { 7 | # On CI services, test the self-contained headers on-demand only to avoid build timeouts 8 | # CI environment is common for Travis CI, AppVeyor, CircleCI, etc. 9 | # For example: 10 | # if ! [ os.environ CI ] || [ os.environ TEST_HEADERS ] { 11 | # alias self_contained_headers : [ generate_self_contained_headers ] ; 12 | # } 13 | 14 | local targets ; 15 | 16 | # NOTE: All '/' in test names are replaced with '-' because apparently 17 | # test scripts have a problem with test names containing slashes. 18 | 19 | local top_headers_path = [ path.make $(BOOST_ROOT)/libs/astronomy/include/boost/astronomy ] ; 20 | 21 | for local file in [ path.glob-tree $(top_headers_path)/$(headers_subpath) : *.hpp : $(exclude_subpaths) ] 22 | { 23 | local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ; 24 | local target_name = [ regex.replace h/$(rel_file) "/" "-" ] ; 25 | local target_name = [ regex.replace $(target_name) "\.hpp" "" ] ; 26 | targets += [ 27 | compile $(BOOST_ROOT)/libs/astronomy/test/header/main.cpp 28 | : "BOOST_ASTRONOMY_TEST_HEADER=$(rel_file)" $(file) 29 | : $(target_name) 30 | ] ; 31 | } 32 | 33 | return $(targets) ; 34 | } 35 | 36 | alias headers : [ generate_self_contained_headers coordinate exception io units : detail ] ; 37 | -------------------------------------------------------------------------------- /doc/tutorials/index.md: -------------------------------------------------------------------------------- 1 | # Astronomy library 2 | 3 | ## **Introduction** 4 | 5 | Development of Astronomy library started as a part Google Summer of Code 2018 under mentor organization **Boost C++ Library** and mentor/guide **Vinícius dos Santos Oliveira**. 6 | 7 | This library provides basic functionalities which are required daily in the field of astronomy. 8 | 9 | **Scope of this library:** 10 | 1. Coordinate system 11 | 2. FITS file handling 12 | 13 | We are planning to expand this in the future to support more features. 14 | 15 | ## Prerequisites 16 | * Minimum C++11 is required 17 | * Familiarity with the boost.geometry (recommended but not necessary) 18 | * Knowledge of the coordinate system 19 | * Knowledge of File handling with C++ 20 | * Knowledge of C++ templates 21 | 22 | ## Limitations 23 | * Limited functionality for FITS file 24 | 25 | ## **Index** 26 | 1. Coordinate System 27 | * [1.1 Euclidean Coordinate Systems](coordinate/euclidean_coordinate.md) 28 | * [1.1.1 Creating a coordinate point (Cartesian, Spherical, Equatorial)](coordinate/coordinate_point.md) 29 | * [1.1.2 Conversions of coordinate systems](coordinate/coordinate_conversion.md) 30 | * [1.1.3 Operations on vector](coordinate/vector_operation.md) 31 | * [1.2 Motion in Euclidean Space](coordinate/motion.md) 32 | * [1.3 Astronomical Coordinate System](coordinate/astronomical_coordinate.md) 33 | * [1.3.1 Creating celestial points](coordinate/astronomical_coordinate.md) 34 | * [1.3.2 Operations on Celestial points](coordinate/astronomical_coordinate_operation.md) 35 | 2. FITS File Handling 36 | * 2.1 Reading FITS 37 | * 2.1.1 Accessing headers 38 | * 2.1.1 Accessing data 39 | 40 | [Next](coordinate/euclidean_coordinate.md) 41 | -------------------------------------------------------------------------------- /include/boost/astronomy/coordinate/coord_sys/coord_sys.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2020 Syed Ali Hasan 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_COORD_SYS_HPP 9 | #define BOOST_ASTRONOMY_COORD_SYS_HPP 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace boost { namespace astronomy { namespace coordinate { 20 | 21 | namespace bg = boost::geometry; 22 | 23 | typedef bg::degree degree; 24 | typedef bg::radian radian; 25 | 26 | template 27 | < 28 | std::size_t DimensionCount, 29 | typename CoordinateSystem, 30 | typename CoordinateType=double 31 | > 32 | struct coord_sys 33 | { 34 | ///@cond INTERNAL 35 | BOOST_STATIC_ASSERT_MSG((DimensionCount == 2), 36 | "DimensionCount is expected to be 2"); 37 | BOOST_STATIC_ASSERT_MSG((std::is_arithmetic::value), 38 | "Coordinate Type must be an arithmetic type"); 39 | ///@endcond 40 | protected: 41 | bg::model::point point; 42 | 43 | public: 44 | typedef CoordinateSystem system; 45 | typedef CoordinateType type; 46 | 47 | bg::model::point get_point() const 48 | { 49 | return this->point; 50 | } 51 | }; //coord_sys 52 | 53 | }}} 54 | 55 | #endif //BOOST_ASTRONOMY_COORD_SYS_HPP 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # astronomy 2 | Astronomy Library for C++ 3 | 4 | [![Gitter](https://badges.gitter.im/BoostGSoC19/astronomy.svg)](https://gitter.im/BoostGSoC19/astronomy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 5 | 6 |
| Travis CI | Azure Pipelines | AppVeyor 7 | -----------|-----------------|-----------------|----------------- 8 | | master | [![Build Status](https://travis-ci.com/BoostGSoC19/astronomy.svg?branch=master)](https://travis-ci.com/BoostGSoC19/astronomy) | [![Build Status](https://dev.azure.com/lpranam/lpranam/_apis/build/status/BoostGSoC19.astronomy?branchName=master)](https://dev.azure.com/lpranam/lpranam/_build/latest?definitionId=2&branchName=master) | [![Build status](https://ci.appveyor.com/api/projects/status/3t4bh6vnwjfycwqe/branch/master?svg=true)](https://ci.appveyor.com/project/lpranam/astronomy-il73i/branch/master) | 9 | | develop | [![Build Status](https://travis-ci.com/BoostGSoC19/astronomy.svg?branch=develop)](https://travis-ci.com/BoostGSoC19/astronomy) | [![Build Status](https://dev.azure.com/lpranam/lpranam/_apis/build/status/BoostGSoC19.astronomy?branchName=develop)](https://dev.azure.com/lpranam/lpranam/_build/latest?definitionId=2&branchName=develop) | [![Build status](https://ci.appveyor.com/api/projects/status/3t4bh6vnwjfycwqe/branch/develop?svg=true)](https://ci.appveyor.com/project/lpranam/astronomy-il73i/branch/develop) | 10 | | gsoc19 | [![Build Status](https://travis-ci.com/BoostGSoC19/astronomy.svg?branch=gsoc19)](https://travis-ci.com/BoostGSoC19/astronomy) | [![Build Status](https://dev.azure.com/lpranam/lpranam/_apis/build/status/BoostGSoC19.astronomy?branchName=gsoc19)](https://dev.azure.com/lpranam/lpranam/_build/latest?definitionId=2&branchName=gsoc19) | [![Build status](https://ci.appveyor.com/api/projects/status/3t4bh6vnwjfycwqe/branch/gsoc19?svg=true)](https://ci.appveyor.com/project/lpranam/astronomy-il73i/branch/gsoc19) | 11 | -------------------------------------------------------------------------------- /include/boost/astronomy/time/parser.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2020 Syed Ali Hasan 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_PARSER_HPP 9 | #define BOOST_ASTRONOMY_PARSER_HPP 10 | 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | struct decimal_hour { 17 | private: 18 | double dh = 0; 19 | 20 | double time = 0; 21 | long int hours = 0; 22 | double minutesRemainder = 0; 23 | long int minutes = 0; 24 | double secondsRemainder = 0; 25 | double seconds = 0; 26 | 27 | public: 28 | decimal_hour(double const& d){ 29 | dh = d; 30 | 31 | time = dh; 32 | hours = (long int)time; 33 | minutesRemainder = (time - hours) * 60; 34 | minutes = (long int)minutesRemainder; 35 | secondsRemainder = (minutesRemainder - minutes) * 60; 36 | seconds = secondsRemainder; 37 | } 38 | 39 | decimal_hour(double const& h,double const& m,double const& s){ 40 | dh = h + m/60 + s/(60*60); 41 | } 42 | 43 | double get() const{ 44 | return dh; 45 | } 46 | 47 | long int get_hours() const{ 48 | return hours; 49 | } 50 | 51 | long int get_minutes() const{ 52 | return minutes; 53 | } 54 | 55 | double get_seconds() const{ 56 | return seconds; 57 | } 58 | }; 59 | 60 | std::ostream& operator << (std::ostream &out, decimal_hour const& dh) 61 | { 62 | std::string time_string = std::to_string(dh.get_hours()) + "h " + std::to_string(dh.get_minutes()) + "m " + std::to_string(dh.get_seconds()) + "s "; 63 | return out << "Hours: " << time_string; 64 | } 65 | 66 | #endif //BOOST_ASTRONOMY_PARSER_HPP 67 | -------------------------------------------------------------------------------- /include/boost/astronomy/detail/is_base_template_of.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright 2018 Pranam Lashkari 3 | 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) 6 | =============================================================================*/ 7 | 8 | #ifndef BOOST_ASTRONOMY_DETAIL_IS_BASE_TEMPLATE_OF_HPP 9 | #define BOOST_ASTRONOMY_DETAIL_IS_BASE_TEMPLATE_OF_HPP 10 | 11 | #include 12 | #include 13 | 14 | 15 | namespace boost { namespace astronomy { namespace detail { 16 | 17 | ///@cond INTERNAL 18 | // structure to provide support like std::is_base_of for template base classes 19 | template