Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the default threshold level of the elp2000 theory to 1e-6 #364

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/heyoka/model/elp2000.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ std::vector<expression> elp2000_spherical(const KwArgs &...kw_args)
{
// NOTE: we re-use detail::vsop2013_common_opts() here because the keyword options
// for ELP2000 are the same.
return std::apply(detail::elp2000_spherical_impl, detail::vsop2013_common_opts(kw_args...));
return std::apply(detail::elp2000_spherical_impl, detail::vsop2013_common_opts(1e-6, kw_args...));
}

template <typename... KwArgs>
std::vector<expression> elp2000_cartesian(const KwArgs &...kw_args)
{
return std::apply(detail::elp2000_cartesian_impl, detail::vsop2013_common_opts(kw_args...));
return std::apply(detail::elp2000_cartesian_impl, detail::vsop2013_common_opts(1e-6, kw_args...));
}

template <typename... KwArgs>
std::vector<expression> elp2000_cartesian_e2000(const KwArgs &...kw_args)
{
return std::apply(detail::elp2000_cartesian_e2000_impl, detail::vsop2013_common_opts(kw_args...));
return std::apply(detail::elp2000_cartesian_e2000_impl, detail::vsop2013_common_opts(1e-6, kw_args...));
}

template <typename... KwArgs>
std::vector<expression> elp2000_cartesian_fk5(const KwArgs &...kw_args)
{
return std::apply(detail::elp2000_cartesian_fk5_impl, detail::vsop2013_common_opts(kw_args...));
return std::apply(detail::elp2000_cartesian_fk5_impl, detail::vsop2013_common_opts(1e-6, kw_args...));
}

HEYOKA_DLL_PUBLIC std::array<double, 2> get_elp2000_mus();
Expand Down
14 changes: 7 additions & 7 deletions include/heyoka/model/vsop2013.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace detail

// Common options for the vsop2013 functions.
template <typename... KwArgs>
auto vsop2013_common_opts(const KwArgs &...kw_args)
auto vsop2013_common_opts(double def_thresh, const KwArgs &...kw_args)
{
igor::parser p{kw_args...};

Expand All @@ -44,12 +44,12 @@ auto vsop2013_common_opts(const KwArgs &...kw_args)
}
}();

// Threshold value (defaults to 1e-9).
auto thresh = [&p]() -> double {
// Threshold value.
auto thresh = [&]() -> double {
if constexpr (p.has(kw::thresh)) {
return std::forward<decltype(p(kw::thresh))>(p(kw::thresh));
} else {
return 1e-9;
return def_thresh;
}
}();

Expand All @@ -65,23 +65,23 @@ HEYOKA_DLL_PUBLIC std::vector<expression> vsop2013_cartesian_icrf_impl(std::uint
template <typename... KwArgs>
expression vsop2013_elliptic(std::uint32_t pl_idx, std::uint32_t var_idx, const KwArgs &...kw_args)
{
auto [time_expr, thresh] = detail::vsop2013_common_opts(kw_args...);
auto [time_expr, thresh] = detail::vsop2013_common_opts(1e-9, kw_args...);

return detail::vsop2013_elliptic_impl(pl_idx, var_idx, std::move(time_expr), thresh);
}

template <typename... KwArgs>
std::vector<expression> vsop2013_cartesian(std::uint32_t pl_idx, const KwArgs &...kw_args)
{
auto [time_expr, thresh] = detail::vsop2013_common_opts(kw_args...);
auto [time_expr, thresh] = detail::vsop2013_common_opts(1e-9, kw_args...);

return detail::vsop2013_cartesian_impl(pl_idx, std::move(time_expr), thresh);
}

template <typename... KwArgs>
std::vector<expression> vsop2013_cartesian_icrf(std::uint32_t pl_idx, const KwArgs &...kw_args)
{
auto [time_expr, thresh] = detail::vsop2013_common_opts(kw_args...);
auto [time_expr, thresh] = detail::vsop2013_common_opts(1e-9, kw_args...);

return detail::vsop2013_cartesian_icrf_impl(pl_idx, std::move(time_expr), thresh);
}
Expand Down