This commit is contained in:
Timur A. Fatkhullin 2025-04-11 18:16:32 +03:00
parent 8ca8183cb8
commit 33d7800a62
2 changed files with 51 additions and 18 deletions

View File

@ -101,38 +101,50 @@ struct MccMountSiteInfo {
typedef double mnt_site_coord_t;
typedef double mnt_site_elev_t;
mnt_site_coord_t latitude; // in radians
mnt_site_coord_t longitude; // in radians (positive to the East)
mnt_site_elev_t elevation; // in meters
mnt_site_coord_t latitude{0.0}; // in radians
mnt_site_coord_t longitude{0.0}; // in radians (positive to the East)
mnt_site_elev_t elevation{0.0}; // in meters
std::string_view name;
std::string_view name{"ALL-ZERO"}; // just a human-readable name
};
enum class MccMountType : uint8_t { GERMAN_TYPE, FORK_TYPE, CROSSAXIS_TYPE, ALTAZ_TYPE };
template <MccMountType TYPE>
static constexpr std::string_view MccMountTypeStr = TYPE == MccMountType::GERMAN_TYPE ? "GERMAN"
: TYPE == MccMountType::FORK_TYPE ? "FORK"
: TYPE == MccMountType::CROSSAXIS_TYPE ? "CROSSAXIS"
: TYPE == MccMountType::ALTAZ_TYPE ? "ALTAZ"
: "UNKNOWN";
/* MOUNT CONFIGURATION BASE CLASS */
struct MccMountConfig {
std::string leap_seconds_filename{}; // empty to use hardcoded default value!
std::string earth_orient_filename{}; // empty to use hardcoded default value!
MccMountSiteInfo siteInfo{.latitude = 0.0, .longitude = 0.0, .elevation = 0.0, .name{"ALL-ZERO"}};
};
/* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */
enum class MccMountType : uint8_t { GERMAN_TYPE, FORK_TYPE, CROSSAXIS_TYPE, ALTAZ_TYPE };
// implements a Finite State Machine Pattern
template <MccMountType MOUNT_TYPE>
template <MccMountType MOUNT_TYPE, std::derived_from<MccMountConfig> CONFIG_TYPE = MccMountConfig>
class MccMount : public utils::MccSpdlogLogger
{
typedef double mnt_coord_t;
typedef double mnt_speed_t;
typedef double time_point_t;
public:
static constexpr MccMountType mountType = MOUNT_TYPE;
static constexpr std::string_view mountTypeStr = MccMountTypeStr<MOUNT_TYPE>;
typedef CONFIG_TYPE mount_config_t;
enum IersDatabaseType { IERS_DB_LEAPSECS, IERS_DB_EARTH_ORIENT };
struct mount_config_t {
std::string leap_seconds_filename{}; // empty to use hardcoded default value!
std::string earth_orient_filename{}; // empty to use hardcoded default value!
};
/* Constructors and destructor */
MccMount(traits::mcc_input_char_range auto const& logger_mark = "[MOUNT]",
@ -237,6 +249,23 @@ public:
}
// prohibited zone related methods
bool pzCheck(traits::mcc_real_or_char_range auto const& xcoord, traits::mcc_real_or_char_range auto const& ycoord)
{
return true;
}
auto pzPredict(traits::mcc_systime_c auto const& time_point,
traits::mcc_real_or_char_range auto const& xcoord,
traits::mcc_real_or_char_range auto const& ycoord)
{
using d_t = std::remove_cvref_t<decltype(time_point)>::duration;
return d_t::max();
}
// IERS databases updater
bool updateIERSDatabase(IersDatabaseType type)

View File

@ -8,7 +8,10 @@
#include <chrono>
#include <fstream>
#ifdef VEC_XSIMD
#include <xsimd/xsimd.hpp>
#endif
#include "mcc_traits.h"
#include "mount_astrom_default.h"
@ -23,9 +26,10 @@ namespace erfa
namespace mcc::traits
{
#ifdef VEC_XSIMD
template <typename T>
concept mcc_scalar_or_simd_c = xsimd::is_batch<T>::value || std::is_arithmetic_v<T>;
#endif
template <typename T>
concept mcc_real_scalar_or_real_range_c =