Skip to content

Commit

Permalink
ed_data and taylor_add_jet.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluescarni committed Dec 7, 2023
1 parent a3916f5 commit 303d4e9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 59 deletions.
46 changes: 37 additions & 9 deletions include/heyoka/taylor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,41 @@ HEYOKA_DLL_PUBLIC std::pair<taylor_dc_t, std::vector<std::uint32_t>>
taylor_decompose(const std::vector<std::pair<expression, expression>> &, const std::vector<expression> &);

template <typename>
HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet(llvm_state &, const std::string &, const std::vector<expression> &,
std::uint32_t, std::uint32_t, bool, bool,
const std::vector<expression> & = {}, bool = false, long long = 0);
taylor_dc_t taylor_add_jet(llvm_state &, const std::string &, const std::vector<expression> &, std::uint32_t,
std::uint32_t, bool, bool, const std::vector<expression> & = {}, bool = false,
long long = 0);

template <typename>
HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet(llvm_state &, const std::string &,
const std::vector<std::pair<expression, expression>> &, std::uint32_t,
std::uint32_t, bool, bool, const std::vector<expression> & = {},
bool = false, long long = 0);
taylor_dc_t taylor_add_jet(llvm_state &, const std::string &, const std::vector<std::pair<expression, expression>> &,
std::uint32_t, std::uint32_t, bool, bool, const std::vector<expression> & = {}, bool = false,
long long = 0);

// Prevent implicit instantiations.
#define HEYOKA_TAYLOR_ADD_JET_EXTERN_INST(F) \
extern template taylor_dc_t taylor_add_jet<F>(llvm_state &, const std::string &, const std::vector<expression> &, \
std::uint32_t, std::uint32_t, bool, bool, \
const std::vector<expression> &, bool, long long); \
extern template taylor_dc_t taylor_add_jet<F>( \
llvm_state &, const std::string &, const std::vector<std::pair<expression, expression>> &, std::uint32_t, \
std::uint32_t, bool, bool, const std::vector<expression> &, bool, long long);

HEYOKA_TAYLOR_ADD_JET_EXTERN_INST(float)
HEYOKA_TAYLOR_ADD_JET_EXTERN_INST(double)
HEYOKA_TAYLOR_ADD_JET_EXTERN_INST(long double)

#if defined(HEYOKA_HAVE_REAL128)

HEYOKA_TAYLOR_ADD_JET_EXTERN_INST(mppp::real128)

#endif

#if defined(HEYOKA_HAVE_REAL)

HEYOKA_TAYLOR_ADD_JET_EXTERN_INST(mppp::real)

#endif

#undef HEYOKA_TAYLOR_ADD_JET_EXTERN_INST

// Enum to represent the outcome of a stepping/propagate function.
enum class taylor_outcome : std::int64_t {
Expand Down Expand Up @@ -1001,7 +1027,7 @@ class HEYOKA_DLL_PUBLIC_INLINE_CLASS taylor_adaptive : public detail::taylor_ada

private:
// Struct implementing the data/logic for event detection.
struct HEYOKA_DLL_PUBLIC ed_data {
struct HEYOKA_DLL_PUBLIC_INLINE_CLASS ed_data {
// The working list type used during real root isolation.
using wlist_t = std::vector<std::tuple<T, T, detail::taylor_pwrap<T>>>;
// The type used to store the list of isolating intervals.
Expand Down Expand Up @@ -1325,6 +1351,7 @@ class HEYOKA_DLL_PUBLIC_INLINE_CLASS taylor_adaptive : public detail::taylor_ada
#define HEYOKA_TAYLOR_ADAPTIVE_EXTERN_INST(F) \
extern template class detail::taylor_adaptive_base<F, taylor_adaptive<F>>; \
extern template class taylor_adaptive<F>; \
extern template struct taylor_adaptive<F>::ed_data; \
extern template void taylor_adaptive<F>::finalise_ctor_impl( \
const std::vector<expression> &, std::vector<F>, std::optional<F>, std::optional<F>, bool, bool, \
std::vector<F>, std::vector<t_event_t>, std::vector<nt_event_t>, bool, std::optional<long long>); \
Expand Down Expand Up @@ -1473,7 +1500,7 @@ class HEYOKA_DLL_PUBLIC_INLINE_CLASS taylor_adaptive_batch

private:
// Struct implementing the data/logic for event detection.
struct HEYOKA_DLL_PUBLIC ed_data {
struct HEYOKA_DLL_PUBLIC_INLINE_CLASS ed_data {
// The working list type used during real root isolation.
using wlist_t = std::vector<std::tuple<T, T, detail::taylor_pwrap<T>>>;
// The type used to store the list of isolating intervals.
Expand Down Expand Up @@ -1857,6 +1884,7 @@ class HEYOKA_DLL_PUBLIC_INLINE_CLASS taylor_adaptive_batch
// Prevent implicit instantiations.
#define HEYOKA_TAYLOR_ADAPTIVE_BATCH_EXTERN_INST(F) \
extern template class taylor_adaptive_batch<F>; \
extern template struct taylor_adaptive_batch<F>::ed_data; \
extern template void taylor_adaptive_batch<F>::finalise_ctor_impl( \
const std::vector<expression> &, std::vector<F>, std::uint32_t, std::vector<F>, std::optional<F>, bool, bool, \
std::vector<F>, std::vector<t_event_t>, std::vector<nt_event_t>, bool); \
Expand Down
12 changes: 6 additions & 6 deletions src/detail/event_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,9 +1434,9 @@ void taylor_adaptive<T>::ed_data::detect_events(const T &h, std::uint32_t order,

// Explicit instantiation of the book-keeping structures for event detection
// in the scalar integrator.
template struct taylor_adaptive<float>::ed_data;
template struct taylor_adaptive<double>::ed_data;
template struct taylor_adaptive<long double>::ed_data;
template HEYOKA_DLL_PUBLIC struct taylor_adaptive<float>::ed_data;
template HEYOKA_DLL_PUBLIC struct taylor_adaptive<double>::ed_data;
template HEYOKA_DLL_PUBLIC struct taylor_adaptive<long double>::ed_data;

#if defined(HEYOKA_HAVE_REAL128)

Expand Down Expand Up @@ -2131,9 +2131,9 @@ void taylor_adaptive_batch<T>::ed_data::detect_events(const T *h_ptr, std::uint3

// Explicit instantiation of the book-keeping structures for event detection
// in the batch integrator.
template struct taylor_adaptive_batch<float>::ed_data;
template struct taylor_adaptive_batch<double>::ed_data;
template struct taylor_adaptive_batch<long double>::ed_data;
template HEYOKA_DLL_PUBLIC struct taylor_adaptive_batch<float>::ed_data;
template HEYOKA_DLL_PUBLIC struct taylor_adaptive_batch<double>::ed_data;
template HEYOKA_DLL_PUBLIC struct taylor_adaptive_batch<long double>::ed_data;

#if defined(HEYOKA_HAVE_REAL128)

Expand Down
59 changes: 15 additions & 44 deletions src/taylor_02.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,61 +2053,32 @@ taylor_dc_t taylor_add_jet(llvm_state &s, const std::string &name,
}

// Explicit instantiations.
template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<float>(llvm_state &, const std::string &,
const std::vector<expression> &, std::uint32_t,
std::uint32_t, bool, bool, const std::vector<expression> &,
bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<float>(llvm_state &, const std::string &,
const std::vector<std::pair<expression, expression>> &,
std::uint32_t, std::uint32_t, bool, bool,
const std::vector<expression> &, bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<double>(llvm_state &, const std::string &,
const std::vector<expression> &, std::uint32_t,
std::uint32_t, bool, bool,
const std::vector<expression> &, bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<double>(llvm_state &, const std::string &,
const std::vector<std::pair<expression, expression>> &,
std::uint32_t, std::uint32_t, bool, bool,
const std::vector<expression> &, bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<long double>(llvm_state &, const std::string &,
const std::vector<expression> &, std::uint32_t,
std::uint32_t, bool, bool,
const std::vector<expression> &, bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t
taylor_add_jet<long double>(llvm_state &, const std::string &, const std::vector<std::pair<expression, expression>> &,
std::uint32_t, std::uint32_t, bool, bool, const std::vector<expression> &, bool, long long);
#define HEYOKA_TAYLOR_ADD_JET_INST(F) \
template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<F>( \
llvm_state &, const std::string &, const std::vector<expression> &, std::uint32_t, std::uint32_t, bool, bool, \
const std::vector<expression> &, bool, long long); \
template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<F>( \
llvm_state &, const std::string &, const std::vector<std::pair<expression, expression>> &, std::uint32_t, \
std::uint32_t, bool, bool, const std::vector<expression> &, bool, long long);

HEYOKA_TAYLOR_ADD_JET_INST(float)
HEYOKA_TAYLOR_ADD_JET_INST(double)
HEYOKA_TAYLOR_ADD_JET_INST(long double)

#if defined(HEYOKA_HAVE_REAL128)

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<mppp::real128>(llvm_state &, const std::string &,
const std::vector<expression> &, std::uint32_t,
std::uint32_t, bool, bool,
const std::vector<expression> &, bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<mppp::real128>(
llvm_state &, const std::string &, const std::vector<std::pair<expression, expression>> &, std::uint32_t,
std::uint32_t, bool, bool, const std::vector<expression> &, bool, long long);
HEYOKA_TAYLOR_ADD_JET_INST(mppp::real128)

#endif

#if defined(HEYOKA_HAVE_REAL)

template HEYOKA_DLL_PUBLIC taylor_dc_t taylor_add_jet<mppp::real>(llvm_state &, const std::string &,
const std::vector<expression> &, std::uint32_t,
std::uint32_t, bool, bool,
const std::vector<expression> &, bool, long long);

template HEYOKA_DLL_PUBLIC taylor_dc_t
taylor_add_jet<mppp::real>(llvm_state &, const std::string &, const std::vector<std::pair<expression, expression>> &,
std::uint32_t, std::uint32_t, bool, bool, const std::vector<expression> &, bool, long long);
HEYOKA_TAYLOR_ADD_JET_INST(mppp::real)

#endif

#undef HEYOKA_TAYLOR_ADD_JET_INST

namespace detail
{

Expand Down

0 comments on commit 303d4e9

Please sign in to comment.