Initial Commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2011 Hartmut Kaiser
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_PHOENIX_PREPROCESSED_FUNCTION_OPERATOR)
|
||||
#define BOOST_PHOENIX_PREPROCESSED_FUNCTION_OPERATOR
|
||||
|
||||
#if BOOST_PHOENIX_LIMIT <= 10
|
||||
#include <boost/phoenix/function/detail/cpp03/preprocessed/function_operator_10.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 20
|
||||
#include <boost/phoenix/function/detail/cpp03/preprocessed/function_operator_20.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 30
|
||||
#include <boost/phoenix/function/detail/cpp03/preprocessed/function_operator_30.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 40
|
||||
#include <boost/phoenix/function/detail/cpp03/preprocessed/function_operator_40.hpp>
|
||||
#elif BOOST_PHOENIX_LIMIT <= 50
|
||||
#include <boost/phoenix/function/detail/cpp03/preprocessed/function_operator_50.hpp>
|
||||
#else
|
||||
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SINGLE_VIEW_DEREF_IMPL_05052005_0258)
|
||||
#define BOOST_FUSION_SINGLE_VIEW_DEREF_IMPL_05052005_0258
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<single_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
BOOST_MPL_ASSERT((mpl::equal_to<typename Iterator::position, mpl::int_<0> >));
|
||||
typedef typename Iterator::value_type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return i.view.val;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
#include "decodedtext.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
|
||||
extern "C" {
|
||||
bool stdmsg_(char const * msg, bool contest_mode, char const * mygrid, int len_msg, int len_grid);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
QRegularExpression words_re {R"(^(?:(?<word1>(?:CQ|DE|QRZ)(?:\s?DX|\s(?:[A-Z]{2}|\d{3}))|[A-Z0-9/]+)\s)(?:(?<word2>[A-Z0-9/]+)(?:\s(?<word3>[-+A-Z0-9]+)(?:\s(?<word4>(?:OOO|(?!RR73)[A-R]{2}[0-9]{2})))?)?)?)"};
|
||||
}
|
||||
|
||||
DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString const& my_grid)
|
||||
: string_ {the_string.left (the_string.indexOf (QChar::Nbsp))} // discard appended info
|
||||
, padding_ {string_.indexOf (" ") > 4 ? 2 : 0} // allow for
|
||||
// seconds
|
||||
, contest_mode_ {contest_mode}
|
||||
, message_ {string_.mid (column_qsoText + padding_).trimmed ()}
|
||||
, is_standard_ {false}
|
||||
{
|
||||
if (message_.length() >= 1)
|
||||
{
|
||||
message_ = message_.left (21).remove (QRegularExpression {"[<>]"});
|
||||
int i1 = message_.indexOf ('\r');
|
||||
if (i1 > 0)
|
||||
{
|
||||
message_ = message_.left (i1 - 1);
|
||||
}
|
||||
if (message_.contains (QRegularExpression {"^(CQ|QRZ)\\s"}))
|
||||
{
|
||||
// TODO this magic position 16 is guaranteed to be after the
|
||||
// last space in a decoded CQ or QRZ message but before any
|
||||
// appended DXCC entity name or worked before information
|
||||
auto eom_pos = message_.indexOf (' ', 16);
|
||||
// we always want at least the characters to position 16
|
||||
if (eom_pos < 16) eom_pos = message_.size () - 1;
|
||||
// remove DXCC entity and worked B4 status. TODO need a better way to do this
|
||||
message_ = message_.left (eom_pos + 1);
|
||||
}
|
||||
// stdmsg is a fortran routine that packs the text, unpacks it
|
||||
// and compares the result
|
||||
auto message_c_string = message_.toLocal8Bit ();
|
||||
message_c_string += QByteArray {22 - message_c_string.size (), ' '};
|
||||
auto grid_c_string = my_grid.toLocal8Bit ();
|
||||
grid_c_string += QByteArray {6 - grid_c_string.size (), ' '};
|
||||
is_standard_ = stdmsg_ (message_c_string.constData ()
|
||||
, contest_mode_
|
||||
, grid_c_string.constData ()
|
||||
, 22, 6);
|
||||
}
|
||||
};
|
||||
|
||||
QStringList DecodedText::messageWords () const
|
||||
{
|
||||
if (is_standard_)
|
||||
{
|
||||
// extract up to the first four message words
|
||||
return words_re.match (message_).capturedTexts ();
|
||||
}
|
||||
// simple word split for free text messages
|
||||
auto words = message_.split (' ', QString::SkipEmptyParts);
|
||||
// add whole message as item 0 to mimic RE capture list
|
||||
words.prepend (message_);
|
||||
return words;
|
||||
}
|
||||
|
||||
QString DecodedText::CQersCall() const
|
||||
{
|
||||
QRegularExpression callsign_re {R"(^(CQ|DE|QRZ)(\s?DX|\s([A-Z]{2}|\d{3}))?\s(?<callsign>[A-Z0-9/]{2,})(\s[A-R]{2}[0-9]{2})?)"};
|
||||
return callsign_re.match (message_).captured ("callsign");
|
||||
}
|
||||
|
||||
|
||||
bool DecodedText::isJT65() const
|
||||
{
|
||||
return string_.indexOf("#") == column_mode + padding_;
|
||||
}
|
||||
|
||||
bool DecodedText::isJT9() const
|
||||
{
|
||||
return string_.indexOf("@") == column_mode + padding_;
|
||||
}
|
||||
|
||||
bool DecodedText::isTX() const
|
||||
{
|
||||
int i = string_.indexOf("Tx");
|
||||
return (i >= 0 && i < 15); // TODO guessing those numbers. Does Tx ever move?
|
||||
}
|
||||
|
||||
bool DecodedText::isLowConfidence () const
|
||||
{
|
||||
return QChar {'?'} == string_.mid (padding_ + column_qsoText + 21, 1);
|
||||
}
|
||||
|
||||
int DecodedText::frequencyOffset() const
|
||||
{
|
||||
return string_.mid(column_freq + padding_,4).toInt();
|
||||
}
|
||||
|
||||
int DecodedText::snr() const
|
||||
{
|
||||
int i1=string_.indexOf(" ")+1;
|
||||
return string_.mid(i1,3).toInt();
|
||||
}
|
||||
|
||||
float DecodedText::dt() const
|
||||
{
|
||||
return string_.mid(column_dt + padding_,5).toFloat();
|
||||
}
|
||||
|
||||
/*
|
||||
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
||||
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
||||
2343 -7 0.3 815 # KK4DSD W7VP -16
|
||||
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
||||
|
||||
0605 Tx 1259 # CQ VK3ACF QF22
|
||||
*/
|
||||
|
||||
// find and extract any report. Returns true if this is a standard message
|
||||
bool DecodedText::report(QString const& myBaseCall, QString const& dxBaseCall, /*mod*/QString& report) const
|
||||
{
|
||||
if (message_.size () < 1) return false;
|
||||
|
||||
QStringList const& w = message_.split(" ",QString::SkipEmptyParts);
|
||||
if (w.size ()
|
||||
&& is_standard_ && (w[0] == myBaseCall
|
||||
|| w[0].endsWith ("/" + myBaseCall)
|
||||
|| w[0].startsWith (myBaseCall + "/")
|
||||
|| (w.size () > 1 && !dxBaseCall.isEmpty ()
|
||||
&& (w[1] == dxBaseCall
|
||||
|| w[1].endsWith ("/" + dxBaseCall)
|
||||
|| w[1].startsWith (dxBaseCall + "/")))))
|
||||
{
|
||||
QString tt="";
|
||||
if(w.size() > 2) tt=w[2];
|
||||
bool ok;
|
||||
auto i1=tt.toInt(&ok);
|
||||
if (ok and i1>=-50 and i1<50)
|
||||
{
|
||||
report = tt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tt.mid(0,1)=="R")
|
||||
{
|
||||
i1=tt.mid(1).toInt(&ok);
|
||||
if(ok and i1>=-50 and i1<50)
|
||||
{
|
||||
report = tt.mid(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return is_standard_;
|
||||
}
|
||||
|
||||
// get the first text word, usually the call
|
||||
QString DecodedText::call() const
|
||||
{
|
||||
return words_re.match (message_).captured ("word1");
|
||||
}
|
||||
|
||||
// get the second word, most likely the de call and the third word, most likely grid
|
||||
void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) const
|
||||
{
|
||||
auto const& match = words_re.match (message_);
|
||||
call = match.captured ("word2");
|
||||
grid = match.captured ("word3");
|
||||
if (contest_mode_ && "R" == grid)
|
||||
{
|
||||
grid = match.captured ("word4");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned DecodedText::timeInSeconds() const
|
||||
{
|
||||
return 3600 * string_.mid (column_time, 2).toUInt ()
|
||||
+ 60 * string_.mid (column_time + 2, 2).toUInt()
|
||||
+ (padding_ ? string_.mid (column_time + 2 + padding_, 2).toUInt () : 0U);
|
||||
}
|
||||
|
||||
/*
|
||||
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
||||
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
||||
2343 -7 0.3 815 # KK4DSD W7VP -16
|
||||
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
||||
|
||||
0605 Tx 1259 # CQ VK3ACF QF22
|
||||
*/
|
||||
|
||||
QString DecodedText::report() const // returns a string of the SNR field with a leading + or - followed by two digits
|
||||
{
|
||||
int sr = snr();
|
||||
if (sr<-50)
|
||||
sr = -50;
|
||||
else
|
||||
if (sr > 49)
|
||||
sr = 49;
|
||||
|
||||
QString rpt;
|
||||
rpt.sprintf("%d",abs(sr));
|
||||
if (sr > 9)
|
||||
rpt = "+" + rpt;
|
||||
else
|
||||
if (sr >= 0)
|
||||
rpt = "+0" + rpt;
|
||||
else
|
||||
if (sr >= -9)
|
||||
rpt = "-0" + rpt;
|
||||
else
|
||||
rpt = "-" + rpt;
|
||||
return rpt;
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP
|
||||
#define BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
#
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
#include <boost/interprocess/creation_tags.hpp>
|
||||
#include <boost/interprocess/permissions.hpp>
|
||||
#include <boost/interprocess/detail/shared_dir_helpers.hpp>
|
||||
#include <boost/interprocess/sync/windows/sync_utils.hpp>
|
||||
#include <boost/interprocess/errors.hpp>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
#include <string>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace interprocess {
|
||||
namespace ipcdetail {
|
||||
|
||||
class windows_named_sync_interface
|
||||
{
|
||||
public:
|
||||
virtual std::size_t get_data_size() const = 0;
|
||||
virtual const void *buffer_with_final_data_to_file() = 0;
|
||||
virtual const void *buffer_with_init_data_to_file() = 0;
|
||||
virtual void *buffer_to_store_init_data_from_file() = 0;
|
||||
virtual bool open(create_enum_t creation_type, const char *id_name) = 0;
|
||||
virtual void close() = 0;
|
||||
virtual ~windows_named_sync_interface() = 0;
|
||||
};
|
||||
|
||||
inline windows_named_sync_interface::~windows_named_sync_interface()
|
||||
{}
|
||||
|
||||
class windows_named_sync
|
||||
{
|
||||
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
|
||||
|
||||
//Non-copyable
|
||||
windows_named_sync(const windows_named_sync &);
|
||||
windows_named_sync &operator=(const windows_named_sync &);
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
|
||||
public:
|
||||
windows_named_sync();
|
||||
void open_or_create(create_enum_t creation_type, const char *name, const permissions &perm, windows_named_sync_interface &sync_interface);
|
||||
void close(windows_named_sync_interface &sync_interface);
|
||||
|
||||
static bool remove(const char *name);
|
||||
|
||||
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
|
||||
private:
|
||||
void *m_file_hnd;
|
||||
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
};
|
||||
|
||||
inline windows_named_sync::windows_named_sync()
|
||||
: m_file_hnd(winapi::invalid_handle_value)
|
||||
{}
|
||||
|
||||
inline void windows_named_sync::close(windows_named_sync_interface &sync_interface)
|
||||
{
|
||||
const std::size_t buflen = sync_interface.get_data_size();
|
||||
const std::size_t sizeof_file_info = sizeof(sync_id::internal_type) + buflen;
|
||||
winapi::interprocess_overlapped overlapped;
|
||||
if(winapi::lock_file_ex
|
||||
(m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){
|
||||
if(winapi::set_file_pointer_ex(m_file_hnd, sizeof(sync_id::internal_type), 0, winapi::file_begin)){
|
||||
const void *buf = sync_interface.buffer_with_final_data_to_file();
|
||||
|
||||
unsigned long written_or_read = 0;
|
||||
if(winapi::write_file(m_file_hnd, buf, buflen, &written_or_read, 0)){
|
||||
//...
|
||||
}
|
||||
}
|
||||
}
|
||||
sync_interface.close();
|
||||
if(m_file_hnd != winapi::invalid_handle_value){
|
||||
winapi::close_handle(m_file_hnd);
|
||||
m_file_hnd = winapi::invalid_handle_value;
|
||||
}
|
||||
}
|
||||
|
||||
inline void windows_named_sync::open_or_create
|
||||
( create_enum_t creation_type
|
||||
, const char *name
|
||||
, const permissions &perm
|
||||
, windows_named_sync_interface &sync_interface)
|
||||
{
|
||||
std::string aux_str(name);
|
||||
m_file_hnd = winapi::invalid_handle_value;
|
||||
//Use a file to emulate POSIX lifetime semantics. After this logic
|
||||
//we'll obtain the ID of the native handle to open in aux_str
|
||||
{
|
||||
create_shared_dir_cleaning_old_and_get_filepath(name, aux_str);
|
||||
//Create a file with required permissions.
|
||||
m_file_hnd = winapi::create_file
|
||||
( aux_str.c_str()
|
||||
, winapi::generic_read | winapi::generic_write
|
||||
, creation_type == DoOpen ? winapi::open_existing :
|
||||
(creation_type == DoCreate ? winapi::create_new : winapi::open_always)
|
||||
, 0
|
||||
, (winapi::interprocess_security_attributes*)perm.get_permissions());
|
||||
|
||||
//Obtain OS error in case something has failed
|
||||
error_info err;
|
||||
bool success = false;
|
||||
if(m_file_hnd != winapi::invalid_handle_value){
|
||||
//Now lock the file
|
||||
const std::size_t buflen = sync_interface.get_data_size();
|
||||
typedef __int64 unique_id_type;
|
||||
const std::size_t sizeof_file_info = sizeof(unique_id_type) + buflen;
|
||||
winapi::interprocess_overlapped overlapped;
|
||||
if(winapi::lock_file_ex
|
||||
(m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){
|
||||
__int64 filesize = 0;
|
||||
//Obtain the unique id to open the native semaphore.
|
||||
//If file size was created
|
||||
if(winapi::get_file_size(m_file_hnd, filesize)){
|
||||
unsigned long written_or_read = 0;
|
||||
unique_id_type unique_id_val;
|
||||
if(static_cast<std::size_t>(filesize) != sizeof_file_info){
|
||||
winapi::set_end_of_file(m_file_hnd);
|
||||
winapi::query_performance_counter(&unique_id_val);
|
||||
const void *buf = sync_interface.buffer_with_init_data_to_file();
|
||||
//Write unique ID in file. This ID will be used to calculate the semaphore name
|
||||
if(winapi::write_file(m_file_hnd, &unique_id_val, sizeof(unique_id_val), &written_or_read, 0) &&
|
||||
written_or_read == sizeof(unique_id_val) &&
|
||||
winapi::write_file(m_file_hnd, buf, buflen, &written_or_read, 0) &&
|
||||
written_or_read == buflen ){
|
||||
success = true;
|
||||
}
|
||||
winapi::get_file_size(m_file_hnd, filesize);
|
||||
BOOST_ASSERT(std::size_t(filesize) == sizeof_file_info);
|
||||
}
|
||||
else{
|
||||
void *buf = sync_interface.buffer_to_store_init_data_from_file();
|
||||
if(winapi::read_file(m_file_hnd, &unique_id_val, sizeof(unique_id_val), &written_or_read, 0) &&
|
||||
written_or_read == sizeof(unique_id_val) &&
|
||||
winapi::read_file(m_file_hnd, buf, buflen, &written_or_read, 0) &&
|
||||
written_or_read == buflen ){
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
if(success){
|
||||
//Now create a global semaphore name based on the unique id
|
||||
char unique_id_name[sizeof(unique_id_val)*2+1];
|
||||
std::size_t name_suffix_length = sizeof(unique_id_name);
|
||||
bytes_to_str(&unique_id_val, sizeof(unique_id_val), &unique_id_name[0], name_suffix_length);
|
||||
success = sync_interface.open(creation_type, unique_id_name);
|
||||
}
|
||||
}
|
||||
|
||||
//Obtain OS error in case something has failed
|
||||
err = system_error_code();
|
||||
|
||||
//If this fails we have no possible rollback so don't check the return
|
||||
if(!winapi::unlock_file_ex(m_file_hnd, 0, sizeof_file_info, 0, &overlapped)){
|
||||
err = system_error_code();
|
||||
}
|
||||
}
|
||||
else{
|
||||
//Obtain OS error in case something has failed
|
||||
err = system_error_code();
|
||||
}
|
||||
}
|
||||
else{
|
||||
err = system_error_code();
|
||||
}
|
||||
|
||||
if(!success){
|
||||
if(m_file_hnd != winapi::invalid_handle_value){
|
||||
winapi::close_handle(m_file_hnd);
|
||||
m_file_hnd = winapi::invalid_handle_value;
|
||||
}
|
||||
//Throw as something went wrong
|
||||
throw interprocess_exception(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool windows_named_sync::remove(const char *name)
|
||||
{
|
||||
try{
|
||||
//Make sure a temporary path is created for shared memory
|
||||
std::string semfile;
|
||||
ipcdetail::shared_filepath(name, semfile);
|
||||
return winapi::unlink_file(semfile.c_str());
|
||||
}
|
||||
catch(...){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace ipcdetail {
|
||||
} //namespace interprocess {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP
|
||||
@@ -0,0 +1,12 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#define BOOST_FUNCTION_NUM_ARGS 7
|
||||
#include <boost/function/detail/maybe_include.hpp>
|
||||
#undef BOOST_FUNCTION_NUM_ARGS
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp
|
||||
|
||||
[begin_description]
|
||||
Default Integrate adaptive implementation.
|
||||
[end_description]
|
||||
|
||||
Copyright 2009-2011 Karsten Ahnert
|
||||
Copyright 2009-2011 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
|
||||
#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
|
||||
#include <boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp>
|
||||
#include <boost/numeric/odeint/iterator/adaptive_time_iterator.hpp>
|
||||
#include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp>
|
||||
#include <boost/numeric/odeint/util/bind.hpp>
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
|
||||
#include <boost/numeric/odeint/util/copy.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
// forward declaration
|
||||
template< class Stepper , class System , class State , class Time , class Observer>
|
||||
size_t integrate_const(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time start_time , Time end_time , Time dt ,
|
||||
Observer observer , stepper_tag );
|
||||
|
||||
/*
|
||||
* integrate_adaptive for simple stepper is basically an integrate_const + some last step
|
||||
*/
|
||||
template< class Stepper , class System , class State , class Time , class Observer >
|
||||
size_t integrate_adaptive(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time start_time , Time end_time , Time dt ,
|
||||
Observer observer , stepper_tag
|
||||
)
|
||||
{
|
||||
size_t steps = detail::integrate_const( stepper , system , start_state , start_time ,
|
||||
end_time , dt , observer , stepper_tag() );
|
||||
typename odeint::unwrap_reference< Observer >::type &obs = observer;
|
||||
typename odeint::unwrap_reference< Stepper >::type &st = stepper;
|
||||
|
||||
Time end = start_time + dt*steps;
|
||||
if( less_with_sign( end , end_time , dt ) )
|
||||
{ //make a last step to end exactly at end_time
|
||||
st.do_step( system , start_state , end , end_time - end );
|
||||
steps++;
|
||||
obs( start_state , end_time );
|
||||
}
|
||||
return steps;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* classical integrate adaptive
|
||||
*/
|
||||
template< class Stepper , class System , class State , class Time , class Observer >
|
||||
size_t integrate_adaptive(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time &start_time , Time end_time , Time &dt ,
|
||||
Observer observer , controlled_stepper_tag
|
||||
)
|
||||
{
|
||||
size_t obs_calls = 0;
|
||||
|
||||
boost::for_each( make_adaptive_time_range( stepper , system , start_state ,
|
||||
start_time , end_time , dt ) ,
|
||||
obs_caller< Observer >( obs_calls , observer ) );
|
||||
|
||||
return obs_calls-1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* integrate adaptive for dense output steppers
|
||||
*
|
||||
* step size control is used if the stepper supports it
|
||||
*/
|
||||
template< class Stepper , class System , class State , class Time , class Observer >
|
||||
size_t integrate_adaptive(
|
||||
Stepper stepper , System system , State &start_state ,
|
||||
Time start_time , Time end_time , Time dt ,
|
||||
Observer observer , dense_output_stepper_tag )
|
||||
{
|
||||
size_t obs_calls = 0;
|
||||
|
||||
boost::for_each( make_adaptive_time_range( stepper , system , start_state ,
|
||||
start_time , end_time , dt ) ,
|
||||
obs_caller< Observer >( obs_calls , observer ) );
|
||||
|
||||
return obs_calls-1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
#define BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
|
||||
#ifndef BOOST_PARAMETER_MAX_ARITY
|
||||
# define BOOST_PARAMETER_MAX_ARITY 8
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// boost/chrono/round.hpp ------------------------------------------------------------//
|
||||
|
||||
// (C) Copyright Howard Hinnant
|
||||
// Copyright 2011 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/chrono for documentation.
|
||||
|
||||
#ifndef BOOST_CHRONO_FLOOR_HPP
|
||||
#define BOOST_CHRONO_FLOOR_HPP
|
||||
|
||||
#include <boost/chrono/duration.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
/**
|
||||
* rounds down
|
||||
*/
|
||||
template <class To, class Rep, class Period>
|
||||
To floor(const duration<Rep, Period>& d)
|
||||
{
|
||||
To t = duration_cast<To>(d);
|
||||
if (t>d) --t;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
} // namespace chrono
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,518 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2012 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
|
||||
|
||||
#ifndef BOOST_MATH_DEBUG_ADAPTER_HPP
|
||||
#define BOOST_MATH_DEBUG_ADAPTER_HPP
|
||||
|
||||
#include <boost/multiprecision/traits/extract_exponent_type.hpp>
|
||||
#include <boost/multiprecision/detail/integer_ops.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
namespace backends{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#endif
|
||||
|
||||
template <class Backend>
|
||||
struct debug_adaptor
|
||||
{
|
||||
typedef typename Backend::signed_types signed_types;
|
||||
typedef typename Backend::unsigned_types unsigned_types;
|
||||
typedef typename Backend::float_types float_types;
|
||||
typedef typename extract_exponent_type<
|
||||
Backend, number_category<Backend>::value>::type exponent_type;
|
||||
|
||||
private:
|
||||
std::string debug_value;
|
||||
Backend m_value;
|
||||
public:
|
||||
void update_view()
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
debug_value = m_value.str(0, static_cast<std::ios_base::fmtflags>(0));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
debug_value = "String conversion failed with message: \"";
|
||||
debug_value += e.what();
|
||||
debug_value += "\"";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
debug_adaptor()
|
||||
{
|
||||
update_view();
|
||||
}
|
||||
debug_adaptor(const debug_adaptor& o) : debug_value(o.debug_value), m_value(o.m_value)
|
||||
{
|
||||
}
|
||||
debug_adaptor& operator = (const debug_adaptor& o)
|
||||
{
|
||||
debug_value = o.debug_value;
|
||||
m_value = o.m_value;
|
||||
return *this;
|
||||
}
|
||||
template <class T>
|
||||
debug_adaptor(const T& i, const typename enable_if_c<is_convertible<T, Backend>::value>::type* = 0)
|
||||
: m_value(i)
|
||||
{
|
||||
update_view();
|
||||
}
|
||||
template <class T>
|
||||
debug_adaptor(const T& i, const T& j)
|
||||
: m_value(i, j)
|
||||
{
|
||||
update_view();
|
||||
}
|
||||
template <class T>
|
||||
typename enable_if_c<is_arithmetic<T>::value || is_convertible<T, Backend>::value, debug_adaptor&>::type operator = (const T& i)
|
||||
{
|
||||
m_value = i;
|
||||
update_view();
|
||||
return *this;
|
||||
}
|
||||
debug_adaptor& operator = (const char* s)
|
||||
{
|
||||
m_value = s;
|
||||
update_view();
|
||||
return *this;
|
||||
}
|
||||
void swap(debug_adaptor& o)
|
||||
{
|
||||
std::swap(m_value, o.value());
|
||||
std::swap(debug_value, o.debug_value);
|
||||
}
|
||||
std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
|
||||
{
|
||||
return m_value.str(digits, f);
|
||||
}
|
||||
void negate()
|
||||
{
|
||||
m_value.negate();
|
||||
update_view();
|
||||
}
|
||||
int compare(const debug_adaptor& o)const
|
||||
{
|
||||
return m_value.compare(o.value());
|
||||
}
|
||||
template <class T>
|
||||
int compare(const T& i)const
|
||||
{
|
||||
return m_value.compare(i);
|
||||
}
|
||||
Backend& value()
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
const Backend& value()const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int /*version*/)
|
||||
{
|
||||
ar & m_value;
|
||||
typedef typename Archive::is_loading tag;
|
||||
if(tag::value)
|
||||
update_view();
|
||||
}
|
||||
static unsigned default_precision() BOOST_NOEXCEPT
|
||||
{
|
||||
return Backend::default_precision();
|
||||
}
|
||||
static void default_precision(unsigned v) BOOST_NOEXCEPT
|
||||
{
|
||||
Backend::default_precision(v);
|
||||
}
|
||||
unsigned precision()const BOOST_NOEXCEPT
|
||||
{
|
||||
return value().precision();
|
||||
}
|
||||
void precision(unsigned digits10) BOOST_NOEXCEPT
|
||||
{
|
||||
value().precision(digits10);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Backend>
|
||||
inline Backend const& unwrap_debug_type(debug_adaptor<Backend> const& val)
|
||||
{
|
||||
return val.value();
|
||||
}
|
||||
template <class T>
|
||||
inline const T& unwrap_debug_type(const T& val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP1(name, str) \
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value());\
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP2(name, str) \
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a));\
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP3(name, str) \
|
||||
template <class Backend, class T, class U>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const U& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const debug_adaptor<Backend>& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
|
||||
result.update_view();\
|
||||
}
|
||||
|
||||
#define NON_MEMBER_OP4(name, str) \
|
||||
template <class Backend, class T, class U, class V>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const U& b, const V& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const T& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b, const debug_adaptor<Backend>& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
template <class Backend, class T, class U>\
|
||||
inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b, const U& c)\
|
||||
{\
|
||||
using default_ops::BOOST_JOIN(eval_, name);\
|
||||
BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
|
||||
result.update_view();\
|
||||
}\
|
||||
|
||||
NON_MEMBER_OP2(add, "+=");
|
||||
NON_MEMBER_OP2(subtract, "-=");
|
||||
NON_MEMBER_OP2(multiply, "*=");
|
||||
NON_MEMBER_OP2(divide, "/=");
|
||||
|
||||
template <class Backend, class R>
|
||||
inline void eval_convert_to(R* result, const debug_adaptor<Backend>& val)
|
||||
{
|
||||
using default_ops::eval_convert_to;
|
||||
eval_convert_to(result, val.value());
|
||||
}
|
||||
|
||||
template <class Backend, class Exp>
|
||||
inline void eval_frexp(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& arg, Exp* exp)
|
||||
{
|
||||
eval_frexp(result.value(), arg.value(), exp);
|
||||
result.update_view();
|
||||
}
|
||||
|
||||
template <class Backend, class Exp>
|
||||
inline void eval_ldexp(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& arg, Exp exp)
|
||||
{
|
||||
eval_ldexp(result.value(), arg.value(), exp);
|
||||
result.update_view();
|
||||
}
|
||||
|
||||
template <class Backend, class Exp>
|
||||
inline void eval_scalbn(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& arg, Exp exp)
|
||||
{
|
||||
eval_scalbn(result.value(), arg.value(), exp);
|
||||
result.update_view();
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline typename Backend::exponent_type eval_ilogb(const debug_adaptor<Backend>& arg)
|
||||
{
|
||||
return eval_ilogb(arg.value());
|
||||
}
|
||||
|
||||
NON_MEMBER_OP2(floor, "floor");
|
||||
NON_MEMBER_OP2(ceil, "ceil");
|
||||
NON_MEMBER_OP2(sqrt, "sqrt");
|
||||
NON_MEMBER_OP2(logb, "logb");
|
||||
|
||||
template <class Backend>
|
||||
inline int eval_fpclassify(const debug_adaptor<Backend>& arg)
|
||||
{
|
||||
using default_ops::eval_fpclassify;
|
||||
return eval_fpclassify(arg.value());
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Optional arithmetic operations come next:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP3(add, "+");
|
||||
NON_MEMBER_OP3(subtract, "-");
|
||||
NON_MEMBER_OP3(multiply, "*");
|
||||
NON_MEMBER_OP3(divide, "/");
|
||||
NON_MEMBER_OP3(multiply_add, "fused-multiply-add");
|
||||
NON_MEMBER_OP3(multiply_subtract, "fused-multiply-subtract");
|
||||
NON_MEMBER_OP4(multiply_add, "fused-multiply-add");
|
||||
NON_MEMBER_OP4(multiply_subtract, "fused-multiply-subtract");
|
||||
|
||||
NON_MEMBER_OP1(increment, "increment");
|
||||
NON_MEMBER_OP1(decrement, "decrement");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Optional integer operations come next:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP2(modulus, "%=");
|
||||
NON_MEMBER_OP3(modulus, "%");
|
||||
NON_MEMBER_OP2(bitwise_or, "|=");
|
||||
NON_MEMBER_OP3(bitwise_or, "|");
|
||||
NON_MEMBER_OP2(bitwise_and, "&=");
|
||||
NON_MEMBER_OP3(bitwise_and, "&");
|
||||
NON_MEMBER_OP2(bitwise_xor, "^=");
|
||||
NON_MEMBER_OP3(bitwise_xor, "^");
|
||||
NON_MEMBER_OP4(qr, "quotient-and-remainder");
|
||||
NON_MEMBER_OP2(complement, "~");
|
||||
|
||||
template <class Backend>
|
||||
inline void eval_left_shift(debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_left_shift;
|
||||
eval_left_shift(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_left_shift(debug_adaptor<Backend>& arg, const debug_adaptor<Backend>& a, unsigned b)
|
||||
{
|
||||
using default_ops::eval_left_shift;
|
||||
eval_left_shift(arg.value(), a.value(), b);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_right_shift(debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_right_shift;
|
||||
eval_right_shift(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_right_shift(debug_adaptor<Backend>& arg, const debug_adaptor<Backend>& a, unsigned b)
|
||||
{
|
||||
using default_ops::eval_right_shift;
|
||||
eval_right_shift(arg.value(), a.value(), b);
|
||||
arg.update_view();\
|
||||
}
|
||||
|
||||
template <class Backend, class T>
|
||||
inline unsigned eval_integer_modulus(const debug_adaptor<Backend>& arg, const T& a)
|
||||
{
|
||||
using default_ops::eval_integer_modulus;
|
||||
return eval_integer_modulus(arg.value(), a);
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline unsigned eval_lsb(const debug_adaptor<Backend>& arg)
|
||||
{
|
||||
using default_ops::eval_lsb;
|
||||
return eval_lsb(arg.value());
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline unsigned eval_msb(const debug_adaptor<Backend>& arg)
|
||||
{
|
||||
using default_ops::eval_msb;
|
||||
return eval_msb(arg.value());
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline bool eval_bit_test(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_test;
|
||||
return eval_bit_test(arg.value(), a);
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline void eval_bit_set(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_set;
|
||||
eval_bit_set(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_bit_unset(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_unset;
|
||||
eval_bit_unset(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_bit_flip(const debug_adaptor<Backend>& arg, unsigned a)
|
||||
{
|
||||
using default_ops::eval_bit_flip;
|
||||
eval_bit_flip(arg.value(), a);
|
||||
arg.update_view();\
|
||||
}
|
||||
|
||||
NON_MEMBER_OP3(gcd, "gcd");
|
||||
NON_MEMBER_OP3(lcm, "lcm");
|
||||
NON_MEMBER_OP4(powm, "powm");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* abs/fabs:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP2(abs, "abs");
|
||||
NON_MEMBER_OP2(fabs, "fabs");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Floating point functions:
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
NON_MEMBER_OP2(trunc, "trunc");
|
||||
NON_MEMBER_OP2(round, "round");
|
||||
NON_MEMBER_OP2(exp, "exp");
|
||||
NON_MEMBER_OP2(log, "log");
|
||||
NON_MEMBER_OP2(log10, "log10");
|
||||
NON_MEMBER_OP2(sin, "sin");
|
||||
NON_MEMBER_OP2(cos, "cos");
|
||||
NON_MEMBER_OP2(tan, "tan");
|
||||
NON_MEMBER_OP2(asin, "asin");
|
||||
NON_MEMBER_OP2(acos, "acos");
|
||||
NON_MEMBER_OP2(atan, "atan");
|
||||
NON_MEMBER_OP2(sinh, "sinh");
|
||||
NON_MEMBER_OP2(cosh, "cosh");
|
||||
NON_MEMBER_OP2(tanh, "tanh");
|
||||
NON_MEMBER_OP3(fmod, "fmod");
|
||||
NON_MEMBER_OP3(pow, "pow");
|
||||
NON_MEMBER_OP3(atan2, "atan2");
|
||||
|
||||
template <class Backend>
|
||||
std::size_t hash_value(const debug_adaptor<Backend>& val)
|
||||
{
|
||||
return hash_value(val.value());
|
||||
}
|
||||
|
||||
|
||||
} // namespace backends
|
||||
|
||||
using backends::debug_adaptor;
|
||||
|
||||
template<class Backend>
|
||||
struct number_category<backends::debug_adaptor<Backend> > : public number_category<Backend> {};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}} // namespaces
|
||||
|
||||
namespace std{
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> >
|
||||
: public std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >
|
||||
{
|
||||
typedef std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> > base_type;
|
||||
typedef boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> number_type;
|
||||
public:
|
||||
static number_type (min)() BOOST_NOEXCEPT { return (base_type::min)(); }
|
||||
static number_type (max)() BOOST_NOEXCEPT { return (base_type::max)(); }
|
||||
static number_type lowest() BOOST_NOEXCEPT { return -(max)(); }
|
||||
static number_type epsilon() BOOST_NOEXCEPT { return base_type::epsilon(); }
|
||||
static number_type round_error() BOOST_NOEXCEPT { return epsilon() / 2; }
|
||||
static number_type infinity() BOOST_NOEXCEPT { return base_type::infinity(); }
|
||||
static number_type quiet_NaN() BOOST_NOEXCEPT { return base_type::quiet_NaN(); }
|
||||
static number_type signaling_NaN() BOOST_NOEXCEPT { return base_type::signaling_NaN(); }
|
||||
static number_type denorm_min() BOOST_NOEXCEPT { return base_type::denorm_min(); }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
namespace boost{ namespace math{
|
||||
|
||||
namespace policies{
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates, class Policy>
|
||||
struct precision< boost::multiprecision::number<boost::multiprecision::debug_adaptor<Backend>, ExpressionTemplates>, Policy>
|
||||
: public precision<boost::multiprecision::number<Backend, ExpressionTemplates>, Policy>
|
||||
{};
|
||||
|
||||
#undef NON_MEMBER_OP1
|
||||
#undef NON_MEMBER_OP2
|
||||
#undef NON_MEMBER_OP3
|
||||
#undef NON_MEMBER_OP4
|
||||
|
||||
} // namespace policies
|
||||
|
||||
}} // namespaces boost::math
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/** @file datatype_fwd.hpp
|
||||
*
|
||||
* This header provides forward declarations for the contents of the
|
||||
* header @c datatype.hpp. It is expected to be used primarily by
|
||||
* user-defined C++ classes that need to specialize @c
|
||||
* is_mpi_datatype.
|
||||
*/
|
||||
#ifndef BOOST_MPI_DATATYPE_FWD_HPP
|
||||
#define BOOST_MPI_DATATYPE_FWD_HPP
|
||||
|
||||
#include <boost/mpi/config.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
|
||||
template<typename T> struct is_mpi_builtin_datatype;
|
||||
template<typename T> struct is_mpi_integer_datatype;
|
||||
template<typename T> struct is_mpi_floating_point_datatype;
|
||||
template<typename T> struct is_mpi_logical_datatype;
|
||||
template<typename T> struct is_mpi_complex_datatype;
|
||||
template<typename T> struct is_mpi_byte_datatype;
|
||||
template<typename T> struct is_mpi_datatype;
|
||||
template<typename T> MPI_Datatype get_mpi_datatype(const T& x);
|
||||
template<typename T> MPI_Datatype get_mpi_datatype()
|
||||
{ return get_mpi_datatype(T());}
|
||||
|
||||
/// a dummy data type giving MPI_PACKED as its MPI_Datatype
|
||||
struct packed {};
|
||||
} } // end namespace boost::mpi
|
||||
|
||||
#endif // BOOST_MPI_MPI_DATATYPE_FWD_HPP
|
||||
@@ -0,0 +1,46 @@
|
||||
// -*- Mode: C++ -*-
|
||||
#ifndef DISPLAYTEXT_H
|
||||
#define DISPLAYTEXT_H
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QFont>
|
||||
|
||||
#include "logbook/logbook.h"
|
||||
#include "decodedtext.h"
|
||||
|
||||
class QAction;
|
||||
|
||||
class DisplayText
|
||||
: public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DisplayText(QWidget *parent = 0);
|
||||
|
||||
void setContentFont (QFont const&);
|
||||
void insertLineSpacer(QString const&);
|
||||
void displayDecodedText(DecodedText const& decodedText, QString const& myCall, bool displayDXCCEntity,
|
||||
LogBook const& logBook, QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall);
|
||||
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode);
|
||||
void displayQSY(QString text);
|
||||
|
||||
Q_SIGNAL void selectCallsign (bool shift, bool ctrl, bool alt);
|
||||
Q_SIGNAL void erased ();
|
||||
|
||||
Q_SLOT void appendText (QString const& text, QColor bg = Qt::white);
|
||||
Q_SLOT void erase ();
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||
|
||||
private:
|
||||
QString appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg, LogBook const& logBook,
|
||||
QColor color_CQ, QColor color_DXCC, QColor color_NewCall);
|
||||
|
||||
QFont char_font_;
|
||||
QAction * erase_action_;
|
||||
};
|
||||
|
||||
#endif // DISPLAYTEXT_H
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef BOOST_MPL_MAP_MAP20_HPP_INCLUDED
|
||||
#define BOOST_MPL_MAP_MAP20_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright David Abrahams 2003-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/map/map10.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER map20.hpp
|
||||
# include <boost/mpl/map/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,(11, 20, <boost/mpl/map/aux_/numbered.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
|
||||
#endif // BOOST_MPL_MAP_MAP20_HPP_INCLUDED
|
||||
@@ -0,0 +1,488 @@
|
||||
|
||||
// Copyright 2000 John Maddock (john@johnmaddock.co.uk)
|
||||
// Copyright 2000 Jeremy Siek (jsiek@lsc.nd.edu)
|
||||
// Copyright 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#ifndef BOOST_IS_CONVERTIBLE
|
||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
#include <boost/type_traits/detail/config.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
#if !defined(BOOST_NO_IS_ABSTRACT)
|
||||
#include <boost/type_traits/is_abstract.hpp>
|
||||
#endif
|
||||
#include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/add_rvalue_reference.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#endif
|
||||
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
# include <boost/type_traits/declval.hpp>
|
||||
#endif
|
||||
#elif defined(BOOST_MSVC) || defined(BOOST_INTEL)
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif // BOOST_IS_CONVERTIBLE
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_IS_CONVERTIBLE
|
||||
|
||||
// is one type convertible to another?
|
||||
//
|
||||
// there are multiple versions of the is_convertible
|
||||
// template, almost every compiler seems to require its
|
||||
// own version.
|
||||
//
|
||||
// Thanks to Andrei Alexandrescu for the original version of the
|
||||
// conversion detection technique!
|
||||
//
|
||||
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(BOOST_GCC) && (BOOST_GCC < 40700))
|
||||
|
||||
// This is a C++11 conforming version, place this first and use it wherever possible:
|
||||
|
||||
# define BOOST_TT_CXX11_IS_CONVERTIBLE
|
||||
|
||||
template <class A, class B, class C>
|
||||
struct or_helper
|
||||
{
|
||||
static const bool value = (A::value || B::value || C::value);
|
||||
};
|
||||
|
||||
template<typename From, typename To, bool b = or_helper<boost::is_void<From>, boost::is_function<To>, boost::is_array<To> >::value>
|
||||
struct is_convertible_basic_impl
|
||||
{
|
||||
// Nothing converts to function or array, but void converts to void:
|
||||
static const bool value = is_void<To>::value;
|
||||
};
|
||||
|
||||
template<typename From, typename To>
|
||||
class is_convertible_basic_impl<From, To, false>
|
||||
{
|
||||
typedef char one;
|
||||
typedef int two;
|
||||
|
||||
template<typename To1>
|
||||
static void test_aux(To1);
|
||||
|
||||
template<typename From1, typename To1>
|
||||
static decltype(test_aux<To1>(boost::declval<From1>()), one()) test(int);
|
||||
|
||||
template<typename, typename>
|
||||
static two test(...);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(test<From, To>(0)) == 1;
|
||||
};
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ < 0x560)
|
||||
//
|
||||
// special version for Borland compilers
|
||||
// this version breaks when used for some
|
||||
// UDT conversions:
|
||||
//
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_impl
|
||||
{
|
||||
#pragma option push -w-8074
|
||||
// This workaround for Borland breaks the EDG C++ frontend,
|
||||
// so we only use it for Borland.
|
||||
template <typename T> struct checker
|
||||
{
|
||||
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...);
|
||||
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(T);
|
||||
};
|
||||
|
||||
static typename add_lvalue_reference<From>::type _m_from;
|
||||
static bool const value = sizeof( checker<To>::_m_check(_m_from) )
|
||||
== sizeof(::boost::type_traits::yes_type);
|
||||
#pragma option pop
|
||||
};
|
||||
|
||||
#elif defined(__GNUC__) || defined(__BORLANDC__) && (__BORLANDC__ < 0x600)
|
||||
// special version for gcc compiler + recent Borland versions
|
||||
// note that this does not pass UDT's through (...)
|
||||
|
||||
struct any_conversion
|
||||
{
|
||||
template <typename T> any_conversion(const volatile T&);
|
||||
template <typename T> any_conversion(const T&);
|
||||
template <typename T> any_conversion(volatile T&);
|
||||
template <typename T> any_conversion(T&);
|
||||
};
|
||||
|
||||
template <typename T> struct checker
|
||||
{
|
||||
static boost::type_traits::no_type _m_check(any_conversion ...);
|
||||
static boost::type_traits::yes_type _m_check(T, int);
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl
|
||||
{
|
||||
typedef typename add_lvalue_reference<From>::type lvalue_type;
|
||||
typedef typename add_rvalue_reference<From>::type rvalue_type;
|
||||
static lvalue_type _m_from;
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 6)))
|
||||
static bool const value =
|
||||
sizeof( boost::detail::checker<To>::_m_check(static_cast<rvalue_type>(_m_from), 0) )
|
||||
== sizeof(::boost::type_traits::yes_type);
|
||||
#else
|
||||
static bool const value =
|
||||
sizeof( boost::detail::checker<To>::_m_check(_m_from, 0) )
|
||||
== sizeof(::boost::type_traits::yes_type);
|
||||
#endif
|
||||
};
|
||||
|
||||
#elif (defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 245) && !defined(__ICL)) \
|
||||
|| defined(__IBMCPP__) || defined(__HP_aCC)
|
||||
//
|
||||
// This is *almost* an ideal world implementation as it doesn't rely
|
||||
// on undefined behaviour by passing UDT's through (...).
|
||||
// Unfortunately it doesn't quite pass all the tests for most compilers (sigh...)
|
||||
// Enable this for your compiler if is_convertible_test.cpp will compile it...
|
||||
//
|
||||
// Note we do not enable this for VC7.1, because even though it passes all the
|
||||
// type_traits tests it is known to cause problems when instantiation occurs
|
||||
// deep within the instantiation tree :-(
|
||||
//
|
||||
struct any_conversion
|
||||
{
|
||||
template <typename T> any_conversion(const volatile T&);
|
||||
template <typename T> any_conversion(const T&);
|
||||
template <typename T> any_conversion(volatile T&);
|
||||
// we need this constructor to catch references to functions
|
||||
// (which can not be cv-qualified):
|
||||
template <typename T> any_conversion(T&);
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl
|
||||
{
|
||||
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...);
|
||||
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int);
|
||||
typedef typename add_lvalue_reference<From>::type lvalue_type;
|
||||
typedef typename add_rvalue_reference<From>::type rvalue_type;
|
||||
static lvalue_type _m_from;
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(static_cast<rvalue_type>(_m_from), 0) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#endif
|
||||
};
|
||||
|
||||
#elif defined(__DMC__)
|
||||
|
||||
struct any_conversion
|
||||
{
|
||||
template <typename T> any_conversion(const volatile T&);
|
||||
template <typename T> any_conversion(const T&);
|
||||
template <typename T> any_conversion(volatile T&);
|
||||
// we need this constructor to catch references to functions
|
||||
// (which can not be cv-qualified):
|
||||
template <typename T> any_conversion(T&);
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl
|
||||
{
|
||||
// Using '...' doesn't always work on Digital Mars. This version seems to.
|
||||
template <class T>
|
||||
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion, float, T);
|
||||
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int, int);
|
||||
typedef typename add_lvalue_reference<From>::type lvalue_type;
|
||||
typedef typename add_rvalue_reference<From>::type rvalue_type;
|
||||
static lvalue_type _m_from;
|
||||
|
||||
// Static constants sometime cause the conversion of _m_from to To to be
|
||||
// called. This doesn't happen with an enum.
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
enum { value =
|
||||
sizeof( _m_check(static_cast<rvalue_type>(_m_from), 0, 0) ) == sizeof(::boost::type_traits::yes_type)
|
||||
};
|
||||
#else
|
||||
enum { value =
|
||||
sizeof( _m_check(_m_from, 0, 0) ) == sizeof(::boost::type_traits::yes_type)
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
//
|
||||
// CW works with the technique implemented above for EDG, except when From
|
||||
// is a function type (or a reference to such a type), in which case
|
||||
// any_conversion won't be accepted as a valid conversion. We detect this
|
||||
// exceptional situation and channel it through an alternative algorithm.
|
||||
//
|
||||
|
||||
template <typename From, typename To,bool FromIsFunctionRef>
|
||||
struct is_convertible_basic_impl_aux;
|
||||
|
||||
struct any_conversion
|
||||
{
|
||||
template <typename T> any_conversion(const volatile T&);
|
||||
template <typename T> any_conversion(const T&);
|
||||
template <typename T> any_conversion(volatile T&);
|
||||
template <typename T> any_conversion(T&);
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl_aux<From,To,false /*FromIsFunctionRef*/>
|
||||
{
|
||||
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...);
|
||||
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int);
|
||||
typedef typename add_lvalue_reference<From>::type lvalue_type;
|
||||
typedef typename add_rvalue_reference<From>::type rvalue_type;
|
||||
static lvalue_type _m_from;
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(static_cast<rvalue_type>(_m_from), 0) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl_aux<From,To,true /*FromIsFunctionRef*/>
|
||||
{
|
||||
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...);
|
||||
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To);
|
||||
typedef typename add_lvalue_reference<From>::type lvalue_type;
|
||||
typedef typename add_rvalue_reference<From>::type rvalue_type;
|
||||
static lvalue_type _m_from;
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(static_cast<rvalue_type>(_m_from)) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl:
|
||||
is_convertible_basic_impl_aux<
|
||||
From,To,
|
||||
::boost::is_function<typename ::boost::remove_reference<From>::type>::value
|
||||
>
|
||||
{};
|
||||
|
||||
#else
|
||||
//
|
||||
// This version seems to work pretty well for a wide spectrum of compilers,
|
||||
// however it does rely on undefined behaviour by passing UDT's through (...).
|
||||
//
|
||||
|
||||
//Workaround for old compilers like MSVC 7.1 to avoid
|
||||
//forming a reference to an array of unknown bound
|
||||
template <typename From>
|
||||
struct is_convertible_basic_impl_add_lvalue_reference
|
||||
: add_lvalue_reference<From>
|
||||
{};
|
||||
|
||||
template <typename From>
|
||||
struct is_convertible_basic_impl_add_lvalue_reference<From[]>
|
||||
{
|
||||
typedef From type [];
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_basic_impl
|
||||
{
|
||||
static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...);
|
||||
static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To);
|
||||
typedef typename is_convertible_basic_impl_add_lvalue_reference<From>::type lvalue_type;
|
||||
static lvalue_type _m_from;
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
|
||||
#pragma warning(disable:6334)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
typedef typename add_rvalue_reference<From>::type rvalue_type;
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(static_cast<rvalue_type>(_m_from)) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // is_convertible_impl
|
||||
|
||||
#if defined(__DMC__)
|
||||
// As before, a static constant sometimes causes errors on Digital Mars.
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_impl
|
||||
{
|
||||
enum {
|
||||
value = ( ::boost::detail::is_convertible_basic_impl<From,To>::value && ! ::boost::is_array<To>::value && ! ::boost::is_function<To>::value)
|
||||
};
|
||||
};
|
||||
#elif !defined(__BORLANDC__) || __BORLANDC__ > 0x551
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_impl
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = ( ::boost::detail::is_convertible_basic_impl<From, To>::value && !::boost::is_array<To>::value && !::boost::is_function<To>::value));
|
||||
};
|
||||
#endif
|
||||
|
||||
template <bool trivial1, bool trivial2, bool abstract_target>
|
||||
struct is_convertible_impl_select
|
||||
{
|
||||
template <class From, class To>
|
||||
struct rebind
|
||||
{
|
||||
typedef is_convertible_impl<From, To> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_convertible_impl_select<true, true, false>
|
||||
{
|
||||
template <class From, class To>
|
||||
struct rebind
|
||||
{
|
||||
typedef true_type type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_convertible_impl_select<false, false, true>
|
||||
{
|
||||
template <class From, class To>
|
||||
struct rebind
|
||||
{
|
||||
typedef false_type type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_convertible_impl_select<true, false, true>
|
||||
{
|
||||
template <class From, class To>
|
||||
struct rebind
|
||||
{
|
||||
typedef false_type type;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_impl_dispatch_base
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__HP_aCC, < 60700)
|
||||
typedef is_convertible_impl_select<
|
||||
::boost::is_arithmetic<From>::value,
|
||||
::boost::is_arithmetic<To>::value,
|
||||
#if !defined(BOOST_NO_IS_ABSTRACT) && !defined(BOOST_TT_CXX11_IS_CONVERTIBLE)
|
||||
// We need to filter out abstract types, only if we don't have a strictly conforming C++11 version:
|
||||
::boost::is_abstract<To>::value
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
> selector;
|
||||
#else
|
||||
typedef is_convertible_impl_select<false, false, false> selector;
|
||||
#endif
|
||||
typedef typename selector::template rebind<From, To> isc_binder;
|
||||
typedef typename isc_binder::type type;
|
||||
};
|
||||
|
||||
template <typename From, typename To>
|
||||
struct is_convertible_impl_dispatch
|
||||
: public is_convertible_impl_dispatch_base<From, To>::type
|
||||
{};
|
||||
|
||||
//
|
||||
// Now add the full and partial specialisations
|
||||
// for void types, these are common to all the
|
||||
// implementation above:
|
||||
//
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
|
||||
template <> struct is_convertible_impl_dispatch<void, void> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void, void const> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void, void const volatile> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void, void volatile> : public true_type{};
|
||||
|
||||
template <> struct is_convertible_impl_dispatch<void const, void> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void const, void const> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void const, void const volatile> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void const, void volatile> : public true_type{};
|
||||
|
||||
template <> struct is_convertible_impl_dispatch<void const volatile, void> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void const volatile, void const> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void const volatile, void const volatile> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void const volatile, void volatile> : public true_type{};
|
||||
|
||||
template <> struct is_convertible_impl_dispatch<void volatile, void> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void volatile, void const> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void volatile, void const volatile> : public true_type{};
|
||||
template <> struct is_convertible_impl_dispatch<void volatile, void volatile> : public true_type{};
|
||||
|
||||
#else
|
||||
template <> struct is_convertible_impl_dispatch<void, void> : public true_type{};
|
||||
#endif // BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
|
||||
template <class To> struct is_convertible_impl_dispatch<void, To> : public false_type{};
|
||||
template <class From> struct is_convertible_impl_dispatch<From, void> : public false_type{};
|
||||
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <class To> struct is_convertible_impl_dispatch<void const, To> : public false_type{};
|
||||
template <class From> struct is_convertible_impl_dispatch<From, void const> : public false_type{};
|
||||
template <class To> struct is_convertible_impl_dispatch<void const volatile, To> : public false_type{};
|
||||
template <class From> struct is_convertible_impl_dispatch<From, void const volatile> : public false_type{};
|
||||
template <class To> struct is_convertible_impl_dispatch<void volatile, To> : public false_type{};
|
||||
template <class From> struct is_convertible_impl_dispatch<From, void volatile> : public false_type{};
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible : public integral_constant<bool, ::boost::detail::is_convertible_impl_dispatch<From, To>::value> {};
|
||||
|
||||
#else
|
||||
|
||||
template <class From, class To>
|
||||
struct is_convertible : public integral_constant<bool, BOOST_IS_CONVERTIBLE(From, To)> {};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED
|
||||
@@ -0,0 +1,139 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#if !defined(FUSION_AS_SET_0932005_1341)
|
||||
#define FUSION_AS_SET_0932005_1341
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/fusion/container/set/set.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
BOOST_FUSION_BARRIER_BEGIN
|
||||
|
||||
template <int size>
|
||||
struct as_set;
|
||||
|
||||
template <>
|
||||
struct as_set<0>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef set<> type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator)
|
||||
{
|
||||
return set<>();
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_FUSION_BARRIER_END
|
||||
}}}
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/container/set/detail/cpp03/preprocessed/as_set.hpp>
|
||||
#else
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/as_set" FUSION_MAX_SET_SIZE_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
BOOST_FUSION_BARRIER_BEGIN
|
||||
|
||||
#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
|
||||
typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
|
||||
BOOST_PP_CAT(I, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
|
||||
typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
|
||||
BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
|
||||
|
||||
#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
|
||||
typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
|
||||
BOOST_PP_CAT(T, n);
|
||||
|
||||
#define BOOST_PP_FILENAME_1 <boost/fusion/container/set/detail/cpp03/as_set.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_SET_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef BOOST_FUSION_NEXT_ITERATOR
|
||||
#undef BOOST_FUSION_NEXT_CALL_ITERATOR
|
||||
#undef BOOST_FUSION_VALUE_OF_ITERATOR
|
||||
|
||||
BOOST_FUSION_BARRIER_END
|
||||
}}}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct as_set<N>
|
||||
{
|
||||
template <typename I0>
|
||||
struct apply
|
||||
{
|
||||
BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
|
||||
BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
|
||||
typedef set<BOOST_PP_ENUM_PARAMS(N, T)> type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename apply<Iterator>::type
|
||||
call(Iterator const& i0)
|
||||
{
|
||||
typedef apply<Iterator> gen;
|
||||
typedef typename gen::type result;
|
||||
BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
|
||||
return result(BOOST_PP_ENUM_PARAMS(N, *i));
|
||||
}
|
||||
};
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0>
|
||||
struct has_phx2_result<F, A0>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0>
|
||||
struct phx2_result<F, A0>
|
||||
{
|
||||
typedef typename F::template result<A0>::type type;
|
||||
};
|
||||
template <typename F, typename A0>
|
||||
struct phx2_result<F, A0 &>
|
||||
{
|
||||
typedef typename F::template result<A0>::type type;
|
||||
};
|
||||
template <typename F, typename A0>
|
||||
struct phx2_result<F, A0 const&>
|
||||
{
|
||||
typedef typename F::template result<A0>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1>
|
||||
struct has_phx2_result<F, A0 , A1>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1>
|
||||
struct phx2_result<F, A0 , A1>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1>
|
||||
struct phx2_result<F, A0 & , A1 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1>
|
||||
struct phx2_result<F, A0 const& , A1 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2>
|
||||
struct has_phx2_result<F, A0 , A1 , A2>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2>
|
||||
struct phx2_result<F, A0 , A1 , A2>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct has_phx2_result<F, A0 , A1 , A2 , A3>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2 , A3)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct phx2_result<F, A0 , A1 , A2 , A3>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 & , A3 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const& , A3 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct has_phx2_result<F, A0 , A1 , A2 , A3 , A4>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2 , A3 , A4)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct phx2_result<F, A0 , A1 , A2 , A3 , A4>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 & , A3 & , A4 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const& , A3 const& , A4 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct has_phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2 , A3 , A4 , A5)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 & , A3 & , A4 & , A5 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct has_phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5 , A6>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5 , A6>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 & , A3 & , A4 & , A5 & , A6 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct has_phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 & , A3 & , A4 & , A5 & , A6 & , A7 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct has_phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>
|
||||
: mpl::eval_if<
|
||||
has_result_type<F>
|
||||
, mpl::false_
|
||||
, has_phx2_result_impl<typename F::template result<F(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
|
||||
>::type
|
||||
{};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct phx2_result<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct phx2_result<F, A0 & , A1 & , A2 & , A3 & , A4 & , A5 & , A6 & , A7 & , A8 &>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type type;
|
||||
};
|
||||
template <typename F, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct phx2_result<F, A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const&>
|
||||
{
|
||||
typedef typename F::template result<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type type;
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
subroutine getmet4(mettab,ndelta)
|
||||
|
||||
! Return appropriate metric table for soft-decision convolutional decoder.
|
||||
|
||||
! Metric table (RxSymbol,TxSymbol)
|
||||
! integer mettab(0:255,0:1)
|
||||
integer mettab(-128:127,0:1)
|
||||
real*4 xx0(0:255)
|
||||
data xx0/ &
|
||||
1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
|
||||
1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
|
||||
1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
|
||||
1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
|
||||
1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
|
||||
1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
|
||||
0.988, 1.000, 0.991, 0.993, 1.000, 0.995, 1.000, 0.991, &
|
||||
1.000, 0.991, 0.992, 0.991, 0.990, 0.990, 0.992, 0.996, &
|
||||
0.990, 0.994, 0.993, 0.991, 0.992, 0.989, 0.991, 0.987, &
|
||||
0.985, 0.989, 0.984, 0.983, 0.979, 0.977, 0.971, 0.975, &
|
||||
0.974, 0.970, 0.970, 0.970, 0.967, 0.962, 0.960, 0.957, &
|
||||
0.956, 0.953, 0.942, 0.946, 0.937, 0.933, 0.929, 0.920, &
|
||||
0.917, 0.911, 0.903, 0.895, 0.884, 0.877, 0.869, 0.858, &
|
||||
0.846, 0.834, 0.821, 0.806, 0.790, 0.775, 0.755, 0.737, &
|
||||
0.713, 0.691, 0.667, 0.640, 0.612, 0.581, 0.548, 0.510, &
|
||||
0.472, 0.425, 0.378, 0.328, 0.274, 0.212, 0.146, 0.075, &
|
||||
0.000,-0.079,-0.163,-0.249,-0.338,-0.425,-0.514,-0.606, &
|
||||
-0.706,-0.796,-0.895,-0.987,-1.084,-1.181,-1.280,-1.376, &
|
||||
-1.473,-1.587,-1.678,-1.790,-1.882,-1.992,-2.096,-2.201, &
|
||||
-2.301,-2.411,-2.531,-2.608,-2.690,-2.829,-2.939,-3.058, &
|
||||
-3.164,-3.212,-3.377,-3.463,-3.550,-3.768,-3.677,-3.975, &
|
||||
-4.062,-4.098,-4.186,-4.261,-4.472,-4.621,-4.623,-4.608, &
|
||||
-4.822,-4.870,-4.652,-4.954,-5.108,-5.377,-5.544,-5.995, &
|
||||
-5.632,-5.826,-6.304,-6.002,-6.559,-6.369,-6.658,-7.016, &
|
||||
-6.184,-7.332,-6.534,-6.152,-6.113,-6.288,-6.426,-6.313, &
|
||||
-9.966,-6.371,-9.966,-7.055,-9.966,-6.629,-6.313,-9.966, &
|
||||
-5.858,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966, &
|
||||
-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966, &
|
||||
-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966, &
|
||||
-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966, &
|
||||
-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966, &
|
||||
-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966,-9.966/
|
||||
save
|
||||
|
||||
bias=0.5
|
||||
scale=50
|
||||
ndelta=nint(3.4*scale)
|
||||
do i=0,255
|
||||
xx=xx0(i)
|
||||
if(i.ge.160) xx=xx0(160) - (i-160)*6.822/65.3
|
||||
mettab(i-128,0)=nint(scale*(xx-bias))
|
||||
if(i.ge.1) mettab(128-i,1)=mettab(i-128,0)
|
||||
enddo
|
||||
mettab(-128,1)=mettab(-127,1)
|
||||
|
||||
return
|
||||
end subroutine getmet4
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/symplectic_euler.hpp
|
||||
|
||||
[begin_description]
|
||||
Implementation of the symplectic Euler for separable Hamiltonian systems.
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2013 Karsten Ahnert
|
||||
Copyright 2011-2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
|
||||
|
||||
|
||||
#include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
|
||||
#include <boost/numeric/odeint/algebra/default_operations.hpp>
|
||||
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
|
||||
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
|
||||
#ifndef DOXYGEN_SKIP
|
||||
namespace detail {
|
||||
namespace symplectic_euler_coef {
|
||||
|
||||
template< class Value >
|
||||
struct coef_a_type : public boost::array< Value , 1 >
|
||||
{
|
||||
coef_a_type( void )
|
||||
{
|
||||
(*this)[0] = static_cast< Value >( 1 );
|
||||
}
|
||||
};
|
||||
|
||||
template< class Value >
|
||||
struct coef_b_type : public boost::array< Value , 1 >
|
||||
{
|
||||
coef_b_type( void )
|
||||
{
|
||||
(*this)[0] = static_cast< Value >( 1 );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace symplectic_euler_coef
|
||||
} // namespace detail
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template<
|
||||
class Coor ,
|
||||
class Momentum = Coor ,
|
||||
class Value = double ,
|
||||
class CoorDeriv = Coor ,
|
||||
class MomentumDeriv = Coor ,
|
||||
class Time = Value ,
|
||||
class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
|
||||
class Operations = typename operations_dispatcher< Coor >::operations_type ,
|
||||
class Resizer = initially_resizer
|
||||
>
|
||||
#ifndef DOXYGEN_SKIP
|
||||
class symplectic_euler :
|
||||
public symplectic_nystroem_stepper_base
|
||||
<
|
||||
1 , 1 ,
|
||||
Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
|
||||
>
|
||||
#else
|
||||
class symplectic_euler : public symplectic_nystroem_stepper_base
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef symplectic_nystroem_stepper_base<
|
||||
1 , 1 , Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer > stepper_base_type;
|
||||
#endif
|
||||
typedef typename stepper_base_type::algebra_type algebra_type;
|
||||
typedef typename stepper_base_type::value_type value_type;
|
||||
|
||||
|
||||
symplectic_euler( const algebra_type &algebra = algebra_type() )
|
||||
: stepper_base_type( detail::symplectic_euler_coef::coef_a_type< value_type >() ,
|
||||
detail::symplectic_euler_coef::coef_b_type< value_type >() ,
|
||||
algebra )
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
/*************** DOXYGEN ***************/
|
||||
|
||||
/**
|
||||
* \class symplectic_euler
|
||||
* \brief Implementation of the symplectic Euler method.
|
||||
*
|
||||
* The method is of first order and has one stage. It is described HERE.
|
||||
*
|
||||
* \tparam Order The order of the stepper.
|
||||
* \tparam Coor The type representing the coordinates q.
|
||||
* \tparam Momentum The type representing the coordinates p.
|
||||
* \tparam Value The basic value type. Should be something like float, double or a high-precision type.
|
||||
* \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
|
||||
* \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
|
||||
* \tparam Time The type representing the time t.
|
||||
* \tparam Algebra The algebra.
|
||||
* \tparam Operations The operations.
|
||||
* \tparam Resizer The resizer policy.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn symplectic_euler::symplectic_euler( const algebra_type &algebra )
|
||||
* \brief Constructs the symplectic_euler. This constructor can be used as a default
|
||||
* constructor if the algebra has a default constructor.
|
||||
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
|
||||
*/
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_EULER_HPP_INCLUDED
|
||||
@@ -0,0 +1,56 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2012 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2015 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CONVERT_IMPL_20061213_2207)
|
||||
#define FUSION_CONVERT_IMPL_20061213_2207
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/deque/convert.hpp>
|
||||
#include <boost/fusion/container/deque/deque.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct deque_tag;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct as_deque;
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename T>
|
||||
struct convert_impl;
|
||||
|
||||
template <>
|
||||
struct convert_impl<deque_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef result_of::as_deque<Sequence> gen;
|
||||
typedef typename gen::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return gen::call(fusion::begin(seq)
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
, fusion::end(seq)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
128
|
||||
56
|
||||
10
|
||||
1 15 30 44 58 71 84 100 115 0
|
||||
2 16 31 44 59 72 86 101 116 0
|
||||
3 17 31 45 60 73 87 102 117 0
|
||||
2 18 32 46 58 73 85 103 112 0
|
||||
4 19 32 47 61 74 88 104 118 0
|
||||
5 20 33 48 62 75 88 105 116 0
|
||||
6 19 34 49 63 76 89 105 119 0
|
||||
7 15 27 45 64 77 88 106 120 0
|
||||
8 15 35 50 59 75 90 107 121 127
|
||||
7 21 33 51 65 73 91 108 114 0
|
||||
9 22 30 46 59 78 92 99 122 0
|
||||
9 19 35 52 60 71 93 109 120 0
|
||||
10 20 31 53 63 79 93 107 123 0
|
||||
11 15 36 53 66 78 85 110 124 0
|
||||
8 23 37 49 67 71 86 111 118 0
|
||||
12 22 34 54 68 80 94 109 114 0
|
||||
1 24 34 52 65 75 87 97 123 0
|
||||
13 25 29 43 69 81 85 100 121 128
|
||||
12 17 38 55 63 82 90 101 125 0
|
||||
11 26 39 47 56 76 95 106 117 0
|
||||
2 27 40 49 69 74 94 108 117 0
|
||||
4 16 30 55 64 76 91 103 126 0
|
||||
13 17 28 47 65 80 96 111 124 126
|
||||
6 18 36 51 70 83 94 111 121 0
|
||||
13 16 34 48 57 82 95 112 120 127
|
||||
6 28 40 48 58 79 90 113 122 0
|
||||
5 27 41 46 67 83 91 109 127 0
|
||||
14 16 42 54 63 78 97 100 118 0
|
||||
13 27 39 52 70 84 90 114 118 0
|
||||
10 22 42 47 64 81 98 110 116 0
|
||||
11 22 29 55 60 84 97 108 111 127
|
||||
5 26 37 55 57 74 96 98 128 0
|
||||
3 21 35 54 62 82 98 104 113 0
|
||||
14 21 43 50 68 77 93 110 117 0
|
||||
9 24 33 56 69 72 89 110 112 0
|
||||
12 26 42 53 62 73 89 99 121 0
|
||||
10 25 35 41 57 76 97 101 122 0
|
||||
10 18 39 44 66 77 99 102 119 0
|
||||
3 29 40 44 61 83 93 106 125 0
|
||||
4 23 39 45 65 85 89 107 113 0
|
||||
6 26 30 43 61 80 86 108 123 0
|
||||
7 19 31 57 69 83 99 113 124 0
|
||||
3 24 37 43 66 84 92 105 120 126
|
||||
2 24 38 50 70 71 88 102 122 0
|
||||
1 20 32 51 68 81 86 102 124 0
|
||||
12 23 41 51 59 74 87 106 115 0
|
||||
14 28 37 46 62 72 95 114 115 125
|
||||
1 28 41 49 61 82 92 103 116 128
|
||||
7 25 38 56 60 75 98 103 115 0
|
||||
8 29 33 45 58 78 96 109 119 0
|
||||
4 25 36 54 67 77 96 105 123 0
|
||||
14 20 38 52 66 80 91 104 112 128
|
||||
8 18 42 56 68 79 87 104 125 0
|
||||
9 23 40 53 70 81 95 101 126 0
|
||||
11 21 32 48 67 72 94 107 119 0
|
||||
5 17 36 50 64 79 92 100 0 0
|
||||
@@ -0,0 +1,28 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_LAMBDA_PLACEHOLDER_HPP
|
||||
#define BOOST_COMPUTE_LAMBDA_PLACEHOLDER_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace lambda {
|
||||
|
||||
// lambda placeholder type
|
||||
template<int I>
|
||||
struct placeholder
|
||||
{
|
||||
};
|
||||
|
||||
} // end lambda namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_LAMBDA_PLACEHOLDER_HPP
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/iterator/detail/n_step_iterator_impl.hpp
|
||||
|
||||
[begin_description]
|
||||
tba.
|
||||
[end_description]
|
||||
|
||||
Copyright 2009-2013 Karsten Ahnert
|
||||
Copyright 2009-2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_N_STEP_ITERATOR_IMPL_HPP_DEFINED
|
||||
#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_N_STEP_ITERATOR_IMPL_HPP_DEFINED
|
||||
|
||||
#include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
|
||||
#include <boost/numeric/odeint/util/unit_helper.hpp>
|
||||
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
|
||||
template< class Iterator , class Stepper , class System , class State , typename Tag , class StepperTag >
|
||||
class n_step_iterator_impl;
|
||||
|
||||
|
||||
/*
|
||||
* Specilization for steppers and error steppers
|
||||
*/
|
||||
/**
|
||||
* \brief ODE Iterator performing exactly n steps with constant step size. The value type of this iterator is the state type of the stepper.
|
||||
*
|
||||
* Implements an ODE iterator solving the ODE with constant step size. Uses steppers fulfilling the Stepper concept.
|
||||
* n_step_iterator is a model of single-pass iterator.
|
||||
*
|
||||
* The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time.
|
||||
*
|
||||
* \tparam Stepper The stepper type which should be used during the iteration.
|
||||
* \tparam System The type of the system function (ODE) which should be solved.
|
||||
*/
|
||||
template< class Iterator , class Stepper , class System , class State , typename Tag >
|
||||
class n_step_iterator_impl< Iterator , Stepper , System , State , Tag , stepper_tag >
|
||||
: public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag >
|
||||
{
|
||||
private:
|
||||
|
||||
typedef Stepper stepper_type;
|
||||
typedef System system_type;
|
||||
typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type;
|
||||
typedef State state_type;
|
||||
typedef typename traits::time_type< stepper_type >::type time_type;
|
||||
typedef typename traits::value_type< stepper_type >::type ode_value_type;
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* \brief Constructs a n_step_iterator. This constructor should be used to construct the begin iterator.
|
||||
*
|
||||
* \param stepper The stepper to use during the iteration.
|
||||
* \param sys The system function (ODE) to solve.
|
||||
* \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
|
||||
* \param t The initial time.
|
||||
* \param dt The initial time step.
|
||||
* \param num_of_steps the number of steps to be executed.
|
||||
*/
|
||||
n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s ,
|
||||
time_type t , time_type dt , size_t num_of_steps )
|
||||
: base_type( stepper , sys , t , dt ) , m_t_start( t ) , m_state( &s ) ,
|
||||
m_steps(num_of_steps) , m_step( 0 )
|
||||
{ }
|
||||
|
||||
/**
|
||||
* \brief Constructs a const_step_iterator. This constructor should be used to construct the end iterator.
|
||||
*
|
||||
* \param stepper The stepper to use during the iteration.
|
||||
* \param sys The system function (ODE) to solve.
|
||||
* \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
|
||||
*/
|
||||
n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s )
|
||||
: base_type( stepper , sys ) , m_state( &s ) { }
|
||||
|
||||
protected:
|
||||
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
void increment()
|
||||
{
|
||||
if( this->m_step < this->m_steps )
|
||||
{
|
||||
unwrapped_stepper_type &stepper = this->m_stepper;
|
||||
stepper.do_step( this->m_system , *this->m_state , this->m_t , this->m_dt );
|
||||
// use integer to compute current time to reduce roundoff errors
|
||||
this->m_step++;
|
||||
this->m_t = this->m_t_start + static_cast< typename unit_value_type<time_type>::type >(this->m_step)*this->m_dt;
|
||||
} else {
|
||||
this->m_at_end = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
const state_type& get_state() const
|
||||
{
|
||||
return *m_state;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
time_type m_t_start;
|
||||
time_type m_t_end;
|
||||
state_type* m_state;
|
||||
size_t m_steps;
|
||||
size_t m_step;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Specilization for dense output stepper
|
||||
*/
|
||||
/**
|
||||
* \brief ODE Iterator with step-size control and dense output.
|
||||
*
|
||||
* Implements an ODE iterator solving the ODE with constant steps. Uses dense-output steppers.
|
||||
* n_step_iterator is a model of single-pass iterator.
|
||||
*
|
||||
* The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time.
|
||||
*
|
||||
* \tparam Stepper The stepper type which should be used during the iteration.
|
||||
* \tparam System The type of the system function (ODE) which should be solved.
|
||||
*/
|
||||
template< class Iterator , class Stepper , class System , class State , typename Tag >
|
||||
class n_step_iterator_impl< Iterator , Stepper , System , State , Tag , dense_output_stepper_tag >
|
||||
: public detail::ode_iterator_base< Iterator , Stepper , System , State , Tag >
|
||||
{
|
||||
private:
|
||||
|
||||
typedef Stepper stepper_type;
|
||||
typedef System system_type;
|
||||
typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type;
|
||||
typedef State state_type;
|
||||
typedef typename traits::time_type< stepper_type >::type time_type;
|
||||
typedef typename traits::value_type< stepper_type >::type ode_value_type;
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef detail::ode_iterator_base< Iterator , Stepper , System , State , Tag > base_type;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* \brief Constructs a const_step_iterator. This constructor should be used to construct the begin iterator.
|
||||
*
|
||||
* \param stepper The stepper to use during the iteration.
|
||||
* \param sys The system function (ODE) to solve.
|
||||
* \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
|
||||
* \param t The initial time.
|
||||
* \param dt The initial time step.
|
||||
* \param num_of_steps the number of steps to be executed.
|
||||
*/
|
||||
n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s ,
|
||||
time_type t , time_type dt , size_t num_of_steps )
|
||||
: base_type( stepper , sys , t , dt ) , m_t_start( t ) , m_state( &s ) ,
|
||||
m_steps( num_of_steps ) , m_step( 0 )
|
||||
{
|
||||
unwrapped_stepper_type &st = this->m_stepper;
|
||||
st.initialize( * ( this->m_state ) , this->m_t , this->m_dt );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Constructs a const_step_iterator. This constructor should be used to construct the end iterator.
|
||||
*
|
||||
* \param stepper The stepper to use during the iteration.
|
||||
* \param sys The system function (ODE) to solve.
|
||||
* \param s The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
|
||||
*/
|
||||
n_step_iterator_impl( stepper_type stepper , system_type sys , state_type &s )
|
||||
: base_type( stepper , sys ) , m_state( &s )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
void increment( void )
|
||||
{
|
||||
if( this->m_step < this->m_steps )
|
||||
{
|
||||
unwrapped_stepper_type &stepper = this->m_stepper;
|
||||
// use integer to compute current time to reduce roundoff errors
|
||||
this->m_step++;
|
||||
this->m_t = this->m_t_start + static_cast< typename unit_value_type<time_type>::type >(this->m_step)*this->m_dt;
|
||||
while( detail::less_with_sign( stepper.current_time() , this->m_t ,
|
||||
stepper.current_time_step() ) )
|
||||
{
|
||||
stepper.do_step( this->m_system );
|
||||
}
|
||||
stepper.calc_state( this->m_t , *( this->m_state ) );
|
||||
} else {
|
||||
this->m_at_end = true;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
const state_type& get_state() const
|
||||
{
|
||||
return *m_state;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
time_type m_t_start;
|
||||
time_type m_t_end;
|
||||
state_type* m_state;
|
||||
size_t m_steps;
|
||||
size_t m_step;
|
||||
};
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_N_STEP_ITERATOR_IMPL_HPP_DEFINED
|
||||
@@ -0,0 +1,63 @@
|
||||
subroutine watterson(c,npts,fs,delay,fspread)
|
||||
|
||||
include 'wsprlf_params.f90'
|
||||
complex c(0:npts-1)
|
||||
complex c2(0:NZMAX-1)
|
||||
complex cs1(0:NZMAX-1)
|
||||
complex cs2(0:NZMAX-1)
|
||||
|
||||
nonzero=0
|
||||
df=fs/npts
|
||||
if(fspread.gt.0.0) then
|
||||
do i=0,npts-1
|
||||
xx=gran()
|
||||
yy=gran()
|
||||
cs1(i)=0.707*cmplx(xx,yy)
|
||||
xx=gran()
|
||||
yy=gran()
|
||||
cs2(i)=0.707*cmplx(xx,yy)
|
||||
enddo
|
||||
call four2a(cs1,npts,1,-1,1) !To freq domain
|
||||
call four2a(cs2,npts,1,-1,1)
|
||||
do i=0,npts-1
|
||||
f=i*df
|
||||
if(i.gt.npts/2) f=(i-npts)*df
|
||||
x=(f/(0.5*fspread))**2
|
||||
a=0.
|
||||
if(x.le.50.0) then
|
||||
a=exp(-x)
|
||||
endif
|
||||
cs1(i)=a*cs1(i)
|
||||
cs2(i)=a*cs2(i)
|
||||
if(abs(f).lt.10.0) then
|
||||
p1=real(cs1(i))**2 + aimag(cs1(i))**2
|
||||
p2=real(cs2(i))**2 + aimag(cs2(i))**2
|
||||
if(p1.gt.0.0) nonzero=nonzero+1
|
||||
! write(62,3101) f,p1,p2,db(p1+1.e-12)-60,db(p2+1.e-12)-60
|
||||
!3101 format(f10.3,2f12.3,2f10.3)
|
||||
endif
|
||||
enddo
|
||||
call four2a(cs1,npts,1,1,1) !Back to time domain
|
||||
call four2a(cs2,npts,1,1,1)
|
||||
cs1(0:npts-1)=cs1(0:npts-1)/npts
|
||||
cs2(0:npts-1)=cs2(0:npts-1)/npts
|
||||
endif
|
||||
|
||||
nshift=nint(0.001*delay*fs)
|
||||
c2(0:npts-1)=cshift(c(0:npts-1),nshift)
|
||||
sq=0.
|
||||
do i=0,npts-1
|
||||
if(nonzero.gt.1) then
|
||||
c(i)=0.5*(cs1(i)*c(i) + cs2(i)*c2(i))
|
||||
else
|
||||
c(i)=0.5*(c(i) + c2(i))
|
||||
endif
|
||||
sq=sq + real(c(i))**2 + aimag(c(i))**2
|
||||
! write(61,3001) i/12000.0,c(i)
|
||||
!3001 format(3f12.6)
|
||||
enddo
|
||||
rms=sqrt(sq/npts)
|
||||
c=c/rms
|
||||
|
||||
return
|
||||
end subroutine watterson
|
||||
@@ -0,0 +1,143 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_CORE_LIMITS_HPP
|
||||
#define BOOST_PHOENIX_CORE_LIMITS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/phoenix/version.hpp>
|
||||
#include <boost/phoenix/support/preprocessor/round.hpp>
|
||||
|
||||
|
||||
#if defined(BOOST_PHOENIX_LIMIT)
|
||||
# if !defined( BOOST_PROTO_MAX_ARITY )
|
||||
# define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_LIMIT
|
||||
# elif (BOOST_PROTO_MAX_ARITY < BOOST_PHOENIX_LIMIT)
|
||||
# error "BOOST_PROTO_MAX_ARITY is set too low"
|
||||
# endif
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#else
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#define BOOST_PHOENIX_LIMIT BOOST_PROTO_MAX_ARITY
|
||||
#endif
|
||||
|
||||
#if !defined(PHOENIX_LIMIT)
|
||||
#define PHOENIX_LIMIT BOOST_PHOENIX_LIMIT
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_LIMIT_STR BOOST_PP_STRINGIZE(BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT))
|
||||
|
||||
#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_ACTOR
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_CALL
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EQUAL
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_BIND
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_SCOPE
|
||||
#endif
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_ACTOR
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1800)
|
||||
// FIXME: temporary disable on MSVC 2013.
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_SCOPE
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
|
||||
// FIXME: Due to proto, some compilers cannot expand parameter pack.
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_ACTOR
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_CALL
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_BIND
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_SCOPE
|
||||
#endif
|
||||
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_OBJECT
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_OPERATOR
|
||||
# define BOOST_PHOENIX_NO_VARIADIC_FUNCTION
|
||||
|
||||
#if !defined(BOOST_PHOENIX_ARG_LIMIT)
|
||||
# define BOOST_PHOENIX_ARG_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
|
||||
#elif (BOOST_PHOENIX_ARG_LIMIT < 5)
|
||||
# error "BOOST_PHOENIX_ARG_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_ARG_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_ACTOR_LIMIT)
|
||||
# define BOOST_PHOENIX_ACTOR_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
|
||||
#elif (BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT)
|
||||
# error "BOOST_PHOENIX_ACTOR_LIMIT > BOOST_PHOENIX_ARG_LIMIT"
|
||||
#elif (BOOST_PHOENIX_ACTOR_LIMIT < 3)
|
||||
# error "BOOST_PHOENIX_ACTOR_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_ACTOR_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_PERFECT_FORWARD_LIMIT)
|
||||
# define BOOST_PHOENIX_PERFECT_FORWARD_LIMIT 3
|
||||
#elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT)
|
||||
# error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT > BOOST_PHOENIX_ACTOR_LIMIT"
|
||||
#elif (BOOST_PHOENIX_PERFECT_FORWARD_LIMIT < 3)
|
||||
# error "BOOST_PHOENIX_PERFECT_FORWARD_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_PERFECT_FORWARD_LIMIT != 3 && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_COMPOSITE_LIMIT)
|
||||
# define BOOST_PHOENIX_COMPOSITE_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
|
||||
#elif (BOOST_PHOENIX_COMPOSITE_LIMIT < 5)
|
||||
# error "BOOST_PHOENIX_COMPOSITE_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_COMPOSITE_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_MEMBER_LIMIT)
|
||||
# define BOOST_PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PHOENIX_COMPOSITE_LIMIT)
|
||||
#elif (BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT)
|
||||
# error "BOOST_PHOENIX_MEMBER_LIMIT > BOOST_PHOENIX_COMPOSITE_LIMIT"
|
||||
#elif (BOOST_PHOENIX_MEMBER_LIMIT < 3)
|
||||
# error "BOOST_PHOENIX_MEMBER_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_MEMBER_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_CATCH_LIMIT)
|
||||
# define BOOST_PHOENIX_CATCH_LIMIT BOOST_PHOENIX_COMPOSITE_LIMIT
|
||||
#elif (BOOST_PHOENIX_CATCH_LIMIT < 1)
|
||||
# error "BOOST_PHOENIX_CATCH_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_CATCH_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DYNAMIC_LIMIT)
|
||||
# define BOOST_PHOENIX_DYNAMIC_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
|
||||
#elif (BOOST_PHOENIX_DYNAMIC_LIMIT < 1)
|
||||
# error "BOOST_PHOENIX_DYNAMIC_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_DYNAMIC_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_PHOENIX_LOCAL_LIMIT)
|
||||
# define BOOST_PHOENIX_LOCAL_LIMIT BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT)
|
||||
#elif (BOOST_PHOENIX_LOCAL_LIMIT < 3)
|
||||
# error "BOOST_PHOENIX_LOCAL_LIMIT is set too low"
|
||||
#elif BOOST_PHOENIX_LOCAL_LIMIT != BOOST_PHOENIX_PP_ROUND_UP(BOOST_PHOENIX_LIMIT) && !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
# define BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file push_back.hpp
|
||||
/// Proto callables Fusion push_back
|
||||
//
|
||||
// Copyright 2010 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_FUNCTIONAL_FUSION_PUSH_BACK_HPP_EAN_11_27_2010
|
||||
#define BOOST_PROTO_FUNCTIONAL_FUSION_PUSH_BACK_HPP_EAN_11_27_2010
|
||||
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/fusion/include/push_back.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
|
||||
namespace boost { namespace proto { namespace functional
|
||||
{
|
||||
/// \brief A PolymorphicFunctionObject type that invokes the
|
||||
/// \c fusion::push_back() algorithm on its argument.
|
||||
///
|
||||
/// A PolymorphicFunctionObject type that invokes the
|
||||
/// \c fusion::push_back() algorithm on its argument.
|
||||
struct push_back
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename This, typename Seq, typename T>
|
||||
struct result<This(Seq, T)>
|
||||
: fusion::result_of::push_back<
|
||||
typename boost::add_const<typename boost::remove_reference<Seq>::type>::type
|
||||
, typename boost::remove_const<typename boost::remove_reference<T>::type>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename Seq, typename T>
|
||||
typename fusion::result_of::push_back<Seq const, T>::type
|
||||
operator ()(Seq const &seq, T const &t) const
|
||||
{
|
||||
return fusion::push_back(seq, t);
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
"$2@CMAKE_INSTALL_SUBDIR@/@WSJTX_BUNDLE_NAME@.app/Contents/MacOS/@WSJTX_BUNDLE_NAME@" --mac-install
|
||||
exit 0
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -0,0 +1,47 @@
|
||||
A basic logging facility in _WSJT-X_ saves QSO information to files
|
||||
named `wsjtx.log` (in comma-separated text format) and `wsjtx_log.adi`
|
||||
(in standard ADIF format). These files can be imported directly into
|
||||
other programs, for example spreadsheets and popular logging programs.
|
||||
As described in the <<INSTALL,Installation>> and <<PLATFORM,Platform
|
||||
Dependencies>> sections, different operating systems may place your
|
||||
local log files in different locations. You can always navigate to
|
||||
them directly by selecting *Open log directory* from the *File* menu.
|
||||
|
||||
More elaborate logging capabilities are supported by third party
|
||||
applications like {jtalert}, which can log QSOs automatically to other
|
||||
applications including {hrd}, {dxlsuite}, and {log4om}.
|
||||
|
||||
The program option *Show DXCC entity and worked before status*
|
||||
(selectable on the *Settings | General* tab) is intended mostly for
|
||||
use on non-Windows platforms, where {jtalert} is not available. When
|
||||
this option is checked _WSJT-X_ appends some additional information to
|
||||
all CQ messages displayed in the _Band Activity_ window. The name of
|
||||
the DXCC entity is shown, abbreviated if necessary. Your "`worked
|
||||
before`" status for this callsign (according to log file
|
||||
`wsjtx_log.adi`) is flagged with a single character and a change of
|
||||
background color, as follows:
|
||||
|
||||
[horizontal]
|
||||
!:: Default color bright purple: New DXCC entity
|
||||
~:: Light pink: You have already worked this DXCC entity but not
|
||||
this station
|
||||
:: Green: You have previously worked the calling station
|
||||
|
||||
In this respect the program does not distinguish between modes, but it
|
||||
does differentiate between bands.
|
||||
|
||||
_WSJT-X_ includes a built-in `cty.dat` file containing DXCC prefix
|
||||
information. Updated files can be downloaded from the {cty_dat} web
|
||||
site when required. If an updated `cty.dat` is present in the logs
|
||||
folder and readable, it will be used in preference to the built-in
|
||||
one.
|
||||
|
||||
The log file `wsjtx_log.adi` is updated whenever you log a QSO from
|
||||
_WSJT-X_. (Keep in mind that if you erase this file you will lose all
|
||||
"`worked before`" information.) You can append or overwrite the
|
||||
`wsjtx_log.adi` file by exporting your QSO history as an ADIF file
|
||||
from another logging program. Turning *Show DXCC entity and worked
|
||||
before status* off and then on again will cause _WSJT-X_ to re-read
|
||||
the log file. Very large log files may cause _WSJT-X_ to slow down
|
||||
when searching for calls.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2007-2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_CGS_GRAM_BASE_UNIT_HPP
|
||||
#define BOOST_UNITS_CGS_GRAM_BASE_UNIT_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/units/config.hpp>
|
||||
#include <boost/units/base_unit.hpp>
|
||||
#include <boost/units/scaled_base_unit.hpp>
|
||||
#include <boost/units/physical_dimensions/mass.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace cgs {
|
||||
|
||||
struct gram_base_unit : public base_unit<gram_base_unit, mass_dimension, -8>
|
||||
{
|
||||
static std::string name() { return("gram"); }
|
||||
static std::string symbol() { return("g"); }
|
||||
};
|
||||
|
||||
} // namespace cgs
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if BOOST_UNITS_HAS_BOOST_TYPEOF
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TYPE(boost::units::cgs::gram_base_unit)
|
||||
|
||||
#endif
|
||||
|
||||
//#include <boost/units/base_units/detail/conversions.hpp>
|
||||
|
||||
#endif // BOOST_UNITS_CGS_GRAM_BASE_UNIT_HPP
|
||||
@@ -0,0 +1,157 @@
|
||||
#include "DisplayManual.hpp"
|
||||
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QUrl>
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QDesktopServices>
|
||||
#include <QLocale>
|
||||
|
||||
#include "revision_utils.hpp"
|
||||
|
||||
#include "pimpl_impl.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
class token
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
token (QUrl const& url, QString const& lang, QString const& name_we, QObject * parent = nullptr)
|
||||
: QObject {parent}
|
||||
, url_ {url}
|
||||
, lang_ {lang}
|
||||
, name_we_ {name_we}
|
||||
{
|
||||
}
|
||||
|
||||
QUrl url_;
|
||||
QString lang_;
|
||||
QString name_we_;
|
||||
};
|
||||
}
|
||||
|
||||
class DisplayManual::impl final
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
impl (QNetworkAccessManager * qnam)
|
||||
: qnam_ {qnam}
|
||||
{
|
||||
connect (qnam_, &QNetworkAccessManager::finished, this, &DisplayManual::impl::reply_finished);
|
||||
}
|
||||
|
||||
void display (QUrl const& url, QString const& name_we)
|
||||
{
|
||||
if (QNetworkAccessManager::Accessible != qnam_->networkAccessible ()) {
|
||||
// try and recover network access for QNAM
|
||||
qnam_->setNetworkAccessible (QNetworkAccessManager::Accessible);
|
||||
}
|
||||
|
||||
// try and find a localized manual
|
||||
auto lang = QLocale::system ().name ();
|
||||
// try for language and country first
|
||||
auto file = name_we + '_' + lang + '-' + version () + ".html";
|
||||
auto target = url.resolved (file);
|
||||
QNetworkRequest request {target};
|
||||
request.setRawHeader ("User-Agent", "WSJT-X Manual Checker");
|
||||
request.setOriginatingObject (new token {url, lang, name_we, this});
|
||||
auto * reply = qnam_->head (request);
|
||||
outstanding_requests_ << reply;
|
||||
}
|
||||
|
||||
void reply_finished (QNetworkReply * reply)
|
||||
{
|
||||
if (outstanding_requests_.contains (reply))
|
||||
{
|
||||
QUrl target;
|
||||
if (reply->error ())
|
||||
{
|
||||
if (auto * tok = qobject_cast<token *> (reply->request ().originatingObject ()))
|
||||
{
|
||||
auto pos = tok->lang_.lastIndexOf ('_');
|
||||
QString file;
|
||||
if (pos >= 0)
|
||||
{
|
||||
tok->lang_.truncate (pos);
|
||||
file = tok->name_we_ + '_' + tok->lang_ + '-' + version () + ".html";
|
||||
target = tok->url_.resolved (file);
|
||||
QNetworkRequest request {target};
|
||||
request.setRawHeader ("User-Agent", "WSJT-X Manual Checker");
|
||||
request.setOriginatingObject (tok);
|
||||
auto * reply = qnam_->head (request);
|
||||
outstanding_requests_ << reply;
|
||||
}
|
||||
else
|
||||
{
|
||||
// give up looking and request the default
|
||||
file = tok->name_we_ + '-' + version () + ".html";
|
||||
target = tok->url_.resolved (file);
|
||||
QDesktopServices::openUrl (target);
|
||||
delete tok;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// found it
|
||||
if (auto * tok = qobject_cast<token *> (reply->request ().originatingObject ()))
|
||||
{
|
||||
delete tok;
|
||||
}
|
||||
QDesktopServices::openUrl (reply->request ().url ());
|
||||
}
|
||||
|
||||
outstanding_requests_.removeOne (reply);
|
||||
reply->deleteLater ();
|
||||
}
|
||||
}
|
||||
|
||||
QNetworkAccessManager * qnam_;
|
||||
QList<QNetworkReply *> outstanding_requests_;
|
||||
};
|
||||
|
||||
#include "DisplayManual.moc"
|
||||
|
||||
DisplayManual::DisplayManual (QNetworkAccessManager * qnam, QObject * parent)
|
||||
: QObject {parent}
|
||||
, m_ {qnam}
|
||||
{
|
||||
}
|
||||
|
||||
DisplayManual::~DisplayManual ()
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayManual::display_html_url (QUrl const& url, QString const& name_we)
|
||||
{
|
||||
m_->display (url, name_we);
|
||||
}
|
||||
|
||||
void DisplayManual::display_html_file (QDir const& dir, QString const& name_we)
|
||||
{
|
||||
// try and find a localized manual
|
||||
auto lang = QLocale::system ().name ();
|
||||
// try for language and country first
|
||||
auto file = dir.absoluteFilePath (name_we + '_' + lang + '-' + version () + ".html");
|
||||
if (!QFileInfo::exists (file))
|
||||
{
|
||||
// try for language
|
||||
lang.truncate (lang.lastIndexOf ('_'));
|
||||
file = dir.absoluteFilePath (name_we + '_' + lang + '-' + version () + ".html");
|
||||
if (!QFileInfo::exists (file))
|
||||
{
|
||||
// use default
|
||||
file = dir.absoluteFilePath (name_we + '-' + version () + ".html");
|
||||
}
|
||||
}
|
||||
// may fail but browser 404 error is a good as anything
|
||||
QDesktopServices::openUrl (QUrl {"file:///" + file});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,748 @@
|
||||
#include "plotter.h"
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
#include "commons.h"
|
||||
#include "moc_plotter.cpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#define MAX_SCREENSIZE 2048
|
||||
|
||||
CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
|
||||
QFrame {parent},
|
||||
m_bScaleOK {false},
|
||||
m_bReference {false},
|
||||
m_bReference0 {false},
|
||||
m_fSpan {2000.0},
|
||||
m_plotZero {0},
|
||||
m_plotGain {0},
|
||||
m_plot2dGain {0},
|
||||
m_plot2dZero {0},
|
||||
m_nSubMode {0},
|
||||
m_Running {false},
|
||||
m_paintEventBusy {false},
|
||||
m_fftBinWidth {1500.0/2048.0},
|
||||
m_dialFreq {0.},
|
||||
m_sum {},
|
||||
m_dBStepSize {10},
|
||||
m_FreqUnits {1},
|
||||
m_hdivs {HORZ_DIVS},
|
||||
m_line {0},
|
||||
m_fSample {12000},
|
||||
m_nsps {6912},
|
||||
m_Percent2DScreen {30}, //percent of screen used for 2D display
|
||||
m_Percent2DScreen0 {0},
|
||||
m_rxFreq {1020},
|
||||
m_txFreq {0},
|
||||
m_startFreq {0}
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setAttribute(Qt::WA_PaintOnScreen,false);
|
||||
setAutoFillBackground(false);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
}
|
||||
|
||||
CPlotter::~CPlotter() { } // Destructor
|
||||
|
||||
QSize CPlotter::minimumSizeHint() const
|
||||
{
|
||||
return QSize(50, 50);
|
||||
}
|
||||
|
||||
QSize CPlotter::sizeHint() const
|
||||
{
|
||||
return QSize(180, 180);
|
||||
}
|
||||
|
||||
void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
|
||||
{
|
||||
if(!size().isValid()) return;
|
||||
if( m_Size != size() or (m_bReference != m_bReference0) or
|
||||
m_Percent2DScreen != m_Percent2DScreen0) {
|
||||
m_Size = size();
|
||||
m_w = m_Size.width();
|
||||
m_h = m_Size.height();
|
||||
m_h2 = m_Percent2DScreen*m_h/100.0;
|
||||
if(m_h2>m_h-30) m_h2=m_h-30;
|
||||
if(m_bReference) m_h2=m_h-30;
|
||||
if(m_h2<1) m_h2=1;
|
||||
m_h1=m_h-m_h2;
|
||||
m_2DPixmap = QPixmap(m_Size.width(), m_h2);
|
||||
m_2DPixmap.fill(Qt::black);
|
||||
m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
|
||||
m_OverlayPixmap = QPixmap(m_Size.width(), m_h2);
|
||||
m_OverlayPixmap.fill(Qt::black);
|
||||
m_WaterfallPixmap.fill(Qt::black);
|
||||
m_2DPixmap.fill(Qt::black);
|
||||
m_ScalePixmap = QPixmap(m_w,30);
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
m_Percent2DScreen0 = m_Percent2DScreen;
|
||||
}
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::paintEvent(QPaintEvent *) // paintEvent()
|
||||
{
|
||||
if(m_paintEventBusy) return;
|
||||
m_paintEventBusy=true;
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0,0,m_ScalePixmap);
|
||||
painter.drawPixmap(0,30,m_WaterfallPixmap);
|
||||
painter.drawPixmap(0,m_h1,m_2DPixmap);
|
||||
m_paintEventBusy=false;
|
||||
}
|
||||
|
||||
void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
||||
{
|
||||
int j,j0;
|
||||
static int ktop=0;
|
||||
float y,y2,ymin;
|
||||
double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0);
|
||||
double gain = fac*pow(10.0,0.02*m_plotGain);
|
||||
double gain2d = pow(10.0,0.02*(m_plot2dGain));
|
||||
|
||||
if(m_bReference != m_bReference0) resizeEvent(NULL);
|
||||
m_bReference0=m_bReference;
|
||||
|
||||
//move current data down one line (must do this before attaching a QPainter object)
|
||||
if(bScroll) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
|
||||
QPainter painter1(&m_WaterfallPixmap);
|
||||
m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
|
||||
QPainter painter2D(&m_2DPixmap);
|
||||
if(!painter2D.isActive()) return;
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(12);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter2D.setFont(Font);
|
||||
|
||||
if(m_bLinearAvg) {
|
||||
painter2D.setPen(Qt::yellow);
|
||||
} else if(m_bReference) {
|
||||
painter2D.setPen(Qt::blue);
|
||||
} else {
|
||||
painter2D.setPen(Qt::green);
|
||||
}
|
||||
static QPoint LineBuf[MAX_SCREENSIZE];
|
||||
static QPoint LineBuf2[MAX_SCREENSIZE];
|
||||
j=0;
|
||||
j0=int(m_startFreq/m_fftBinWidth + 0.5);
|
||||
int iz=XfromFreq(5000.0);
|
||||
int jz=iz*m_binsPerPixel;
|
||||
m_fMax=FreqfromX(iz);
|
||||
|
||||
m_line++;
|
||||
if(bScroll) {
|
||||
flat4_(swide,&iz,&m_Flatten);
|
||||
flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
|
||||
}
|
||||
|
||||
ymin=1.e30;
|
||||
if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green);
|
||||
if(swide[0]>1.4e30) painter1.setPen(Qt::yellow);
|
||||
for(int i=0; i<iz; i++) {
|
||||
y=swide[i];
|
||||
if(y<ymin) ymin=y;
|
||||
int y1 = 10.0*gain*y + 10*m_plotZero +40;
|
||||
if (y1<0) y1=0;
|
||||
if (y1>254) y1=254;
|
||||
if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]);
|
||||
painter1.drawPoint(i,0);
|
||||
}
|
||||
|
||||
float y2min=1.e30;
|
||||
float y2max=-1.e30;
|
||||
for(int i=0; i<iz; i++) {
|
||||
y=swide[i] - ymin;
|
||||
y2=0;
|
||||
if(m_bCurrent) y2 = gain2d*y + m_plot2dZero; //Current
|
||||
|
||||
if(bScroll) {
|
||||
float sum=0.0;
|
||||
int j=j0+m_binsPerPixel*i;
|
||||
for(int k=0; k<m_binsPerPixel; k++) {
|
||||
sum+=dec_data.savg[j++];
|
||||
}
|
||||
m_sum[i]=sum;
|
||||
}
|
||||
if(m_bCumulative) y2=gain2d*(m_sum[i]/m_binsPerPixel + m_plot2dZero);
|
||||
if(m_Flatten==0) y2 += 15; //### could do better! ###
|
||||
|
||||
if(m_bLinearAvg) { //Linear Avg (yellow)
|
||||
float sum=0.0;
|
||||
int j=j0+m_binsPerPixel*i;
|
||||
for(int k=0; k<m_binsPerPixel; k++) {
|
||||
sum+=spectra_.syellow[j++];
|
||||
}
|
||||
y2=gain2d*sum/m_binsPerPixel + m_plot2dZero;
|
||||
}
|
||||
|
||||
if(m_bReference) { //Reference (red)
|
||||
float df_ref=12000.0/6912.0;
|
||||
int j=FreqfromX(i)/df_ref + 0.5;
|
||||
y2=spectra_.ref[j] + m_plot2dZero;
|
||||
// if(gain2d>1.5) y2=spectra_.filter[j] + m_plot2dZero;
|
||||
|
||||
}
|
||||
|
||||
if(i==iz-1) {
|
||||
painter2D.drawPolyline(LineBuf,j);
|
||||
if(m_mode=="QRA64") {
|
||||
painter2D.setPen(Qt::red);
|
||||
painter2D.drawPolyline(LineBuf2,ktop);
|
||||
}
|
||||
}
|
||||
LineBuf[j].setX(i);
|
||||
LineBuf[j].setY(int(0.9*m_h2-y2*m_h2/70.0));
|
||||
if(y2<y2min) y2min=y2;
|
||||
if(y2>y2max) y2max=y2;
|
||||
j++;
|
||||
}
|
||||
|
||||
if(swide[0]>1.0e29) m_line=0;
|
||||
if(m_line == painter1.fontMetrics ().height ()) {
|
||||
painter1.setPen(Qt::white);
|
||||
QString t;
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
||||
int n=(ms/1000) % m_TRperiod;
|
||||
QDateTime t1=QDateTime::currentDateTimeUtc().addSecs(-n);
|
||||
if(m_TRperiod < 60) {
|
||||
t=t1.toString("hh:mm:ss") + " " + m_rxBand;
|
||||
} else {
|
||||
t=t1.toString("hh:mm") + " " + m_rxBand;
|
||||
}
|
||||
painter1.drawText (5, painter1.fontMetrics ().ascent (), t);
|
||||
}
|
||||
|
||||
if(m_mode=="JT4") {
|
||||
QPen pen3(Qt::yellow); //Mark freqs of JT4 single-tone msgs
|
||||
painter2D.setPen(pen3);
|
||||
Font.setWeight(QFont::Bold);
|
||||
painter2D.setFont(Font);
|
||||
int x1=XfromFreq(m_rxFreq);
|
||||
y=0.2*m_h2;
|
||||
painter2D.drawText(x1-4,y,"T");
|
||||
x1=XfromFreq(m_rxFreq+250);
|
||||
painter2D.drawText(x1-4,y,"M");
|
||||
x1=XfromFreq(m_rxFreq+500);
|
||||
painter2D.drawText(x1-4,y,"R");
|
||||
x1=XfromFreq(m_rxFreq+750);
|
||||
painter2D.drawText(x1-4,y,"73");
|
||||
}
|
||||
|
||||
if(bRed) {
|
||||
std::ifstream f;
|
||||
f.open(m_redFile.toLatin1());
|
||||
if(f) {
|
||||
int x,y;
|
||||
float freq,sync;
|
||||
float slimit=6.0;
|
||||
QPen pen0(Qt::red,1);
|
||||
painter1.setPen(pen0);
|
||||
for(int i=0; i<99999; i++) {
|
||||
f >> freq >> sync;
|
||||
if(f.eof()) break;
|
||||
x=XfromFreq(freq);
|
||||
y=(sync-slimit)*3.0;
|
||||
if(y>0) {
|
||||
if(y>15.0) y=15.0;
|
||||
if(x>=0 and x<=m_w) {
|
||||
painter1.setPen(pen0);
|
||||
painter1.drawLine(x,0,x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
// m_bDecodeFinished=false;
|
||||
}
|
||||
|
||||
update(); //trigger a new paintEvent
|
||||
m_bScaleOK=true;
|
||||
}
|
||||
|
||||
void CPlotter::drawRed(int ia, int ib, float swide[])
|
||||
{
|
||||
m_ia=ia;
|
||||
m_ib=ib;
|
||||
draw(swide,false,true);
|
||||
}
|
||||
|
||||
void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
{
|
||||
if(m_OverlayPixmap.isNull()) return;
|
||||
if(m_WaterfallPixmap.isNull()) return;
|
||||
int w = m_WaterfallPixmap.width();
|
||||
int x,y,x1,x2,x3,x4,x5,x6;
|
||||
float pixperdiv;
|
||||
|
||||
double df = m_binsPerPixel*m_fftBinWidth;
|
||||
QRect rect;
|
||||
QPen penOrange(QColor(255,165,0),3);
|
||||
QPen penGreen(Qt::green, 3); //Mark Tol range with green line
|
||||
QPen penRed(Qt::red, 3); //Mark Tx freq with red
|
||||
QPainter painter(&m_OverlayPixmap);
|
||||
painter.initFrom(this);
|
||||
QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient
|
||||
gradient.setColorAt(1, Qt::black);
|
||||
gradient.setColorAt(0, Qt::darkBlue);
|
||||
painter.setBrush(gradient);
|
||||
painter.drawRect(0, 0, m_w, m_h2);
|
||||
painter.setBrush(Qt::SolidPattern);
|
||||
|
||||
m_fSpan = w*df;
|
||||
// int n=m_fSpan/10;
|
||||
m_freqPerDiv=10;
|
||||
if(m_fSpan>100) m_freqPerDiv=20;
|
||||
if(m_fSpan>250) m_freqPerDiv=50;
|
||||
if(m_fSpan>500) m_freqPerDiv=100;
|
||||
if(m_fSpan>1000) m_freqPerDiv=200;
|
||||
if(m_fSpan>2500) m_freqPerDiv=500;
|
||||
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
m_hdivs = w*df/m_freqPerDiv + 1.9999;
|
||||
|
||||
float xx0=float(m_startFreq)/float(m_freqPerDiv);
|
||||
xx0=xx0-int(xx0);
|
||||
int x0=xx0*pixperdiv+0.5;
|
||||
for( int i=1; i<m_hdivs; i++) { //draw vertical grids
|
||||
x = (int)((float)i*pixperdiv ) - x0;
|
||||
if(x >= 0 and x<=m_w) {
|
||||
painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
|
||||
painter.drawLine(x, 0, x , m_h2);
|
||||
}
|
||||
}
|
||||
|
||||
pixperdiv = (float)m_h2 / (float)VERT_DIVS;
|
||||
painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
|
||||
for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids
|
||||
y = (int)( (float)i*pixperdiv );
|
||||
painter.drawLine(0, y, w, y);
|
||||
}
|
||||
|
||||
QRect rect0;
|
||||
QPainter painter0(&m_ScalePixmap);
|
||||
painter0.initFrom(this);
|
||||
|
||||
//create Font to use for scales
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(12);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter0.setFont(Font);
|
||||
painter0.setPen(Qt::black);
|
||||
|
||||
if(m_binsPerPixel < 1) m_binsPerPixel=1;
|
||||
m_hdivs = w*df/m_freqPerDiv + 0.9999;
|
||||
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
painter0.drawRect(0, 0, w, 30);
|
||||
MakeFrequencyStrs();
|
||||
|
||||
//draw tick marks on upper scale
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
for( int i=0; i<m_hdivs; i++) { //major ticks
|
||||
x = (int)((m_xOffset+i)*pixperdiv );
|
||||
painter0.drawLine(x,18,x,30);
|
||||
}
|
||||
int minor=5;
|
||||
if(m_freqPerDiv==200) minor=4;
|
||||
for( int i=1; i<minor*m_hdivs; i++) { //minor ticks
|
||||
x = i*pixperdiv/minor;
|
||||
painter0.drawLine(x,24,x,30);
|
||||
}
|
||||
|
||||
//draw frequency values
|
||||
for( int i=0; i<=m_hdivs; i++) {
|
||||
x = (int)((m_xOffset+i)*pixperdiv - pixperdiv/2);
|
||||
rect0.setRect(x,0, (int)pixperdiv, 20);
|
||||
painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
|
||||
}
|
||||
|
||||
float bw=9.0*12000.0/m_nsps; //JT9
|
||||
|
||||
if(m_mode=="FT8") bw=8*12000.0/2048.0; //FT8
|
||||
|
||||
if(m_mode=="JT4") { //JT4
|
||||
bw=3*11025.0/2520.0; //Max tone spacing (3/4 of actual BW)
|
||||
if(m_nSubMode==1) bw=2*bw;
|
||||
if(m_nSubMode==2) bw=4*bw;
|
||||
if(m_nSubMode==3) bw=9*bw;
|
||||
if(m_nSubMode==4) bw=18*bw;
|
||||
if(m_nSubMode==5) bw=36*bw;
|
||||
if(m_nSubMode==6) bw=72*bw;
|
||||
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
for(int i=0; i<4; i++) {
|
||||
x1=XfromFreq(m_rxFreq+bw*i/3.0);
|
||||
int j=24;
|
||||
if(i==0) j=18;
|
||||
painter0.drawLine(x1,j,x1,30);
|
||||
}
|
||||
painter0.setPen(penRed);
|
||||
for(int i=0; i<4; i++) {
|
||||
x1=XfromFreq(m_txFreq+bw*i/3.0);
|
||||
painter0.drawLine(x1,12,x1,18);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_modeTx=="JT9" and m_nSubMode>0) { //JT9
|
||||
bw=8.0*12000.0/m_nsps;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
if(m_nSubMode==3) bw=8*bw; //D
|
||||
if(m_nSubMode==4) bw=16*bw; //E
|
||||
if(m_nSubMode==5) bw=32*bw; //F
|
||||
if(m_nSubMode==6) bw=64*bw; //G
|
||||
if(m_nSubMode==7) bw=128*bw; //H
|
||||
}
|
||||
|
||||
if(m_mode=="QRA64") { //QRA64
|
||||
bw=63.0*12000.0/m_nsps;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
if(m_nSubMode==3) bw=8*bw; //D
|
||||
if(m_nSubMode==4) bw=16*bw; //E
|
||||
}
|
||||
|
||||
if(m_modeTx=="JT65") { //JT65
|
||||
bw=65.0*11025.0/4096.0;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
}
|
||||
|
||||
painter0.setPen(penGreen);
|
||||
if(m_mode=="WSPR") {
|
||||
x1=XfromFreq(1400);
|
||||
x2=XfromFreq(1600);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
}
|
||||
|
||||
if(m_mode=="WSPR-LF") {
|
||||
x1=XfromFreq(1600);
|
||||
x2=XfromFreq(1700);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
}
|
||||
|
||||
if(m_mode=="FreqCal") { //FreqCal
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="JT9+JT65" or m_mode=="QRA64" or m_mode=="FT8") {
|
||||
|
||||
if(m_mode=="QRA64" or (m_mode=="JT65" and m_bVHF)) {
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,28,x2,28);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
|
||||
if(m_mode=="JT65") {
|
||||
painter0.setPen(penOrange);
|
||||
x3=XfromFreq(m_rxFreq+20.0*bw/65.0); //RO
|
||||
painter0.drawLine(x3,24,x3,30);
|
||||
x4=XfromFreq(m_rxFreq+30.0*bw/65.0); //RRR
|
||||
painter0.drawLine(x4,24,x4,30);
|
||||
x5=XfromFreq(m_rxFreq+40.0*bw/65.0); //73
|
||||
painter0.drawLine(x5,24,x5,30);
|
||||
}
|
||||
painter0.setPen(penGreen);
|
||||
x6=XfromFreq(m_rxFreq+bw); //Highest tone
|
||||
painter0.drawLine(x6,24,x6,30);
|
||||
|
||||
} else {
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
x2=XfromFreq(m_rxFreq+bw);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
painter0.drawLine(x1,28,x2,28);
|
||||
painter0.drawLine(x2,24,x2,30);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="JT9+JT65" or
|
||||
m_mode.mid(0,4)=="WSPR" or m_mode=="QRA64" or m_mode=="FT8") {
|
||||
painter0.setPen(penRed);
|
||||
x1=XfromFreq(m_txFreq);
|
||||
x2=XfromFreq(m_txFreq+bw);
|
||||
if(m_mode=="WSPR") {
|
||||
bw=4*12000.0/8192.0; //WSPR
|
||||
x1=XfromFreq(m_txFreq-0.5*bw);
|
||||
x2=XfromFreq(m_txFreq+0.5*bw);
|
||||
}
|
||||
if(m_mode=="WSPR-LF") {
|
||||
bw=3*12000.0/8640.0; //WSPR-LF
|
||||
x1=XfromFreq(m_txFreq-0.5*bw);
|
||||
x2=XfromFreq(m_txFreq+0.5*bw);
|
||||
}
|
||||
painter0.drawLine(x1,17,x1,21);
|
||||
painter0.drawLine(x1,17,x2,17);
|
||||
painter0.drawLine(x2,17,x2,21);
|
||||
}
|
||||
|
||||
if(m_mode=="JT9+JT65") {
|
||||
QPen pen2(Qt::blue, 3); //Mark the JT65 | JT9 divider
|
||||
painter0.setPen(pen2);
|
||||
x1=XfromFreq(m_fMin);
|
||||
if(x1<2) x1=2;
|
||||
x2=x1+30;
|
||||
painter0.drawLine(x1,8,x1,28);
|
||||
}
|
||||
|
||||
if(m_dialFreq>10.13 and m_dialFreq< 10.15 and m_mode.mid(0,4)!="WSPR") {
|
||||
float f1=1.0e6*(10.1401 - m_dialFreq);
|
||||
float f2=f1+200.0;
|
||||
x1=XfromFreq(f1);
|
||||
x2=XfromFreq(f2);
|
||||
if(x1<=m_w and x2>=0) {
|
||||
painter0.setPen(penOrange); //Mark WSPR sub-band orange
|
||||
painter0.drawLine(x1,9,x2,9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
|
||||
{
|
||||
int f=(m_startFreq+m_freqPerDiv-1)/m_freqPerDiv;
|
||||
f*=m_freqPerDiv;
|
||||
m_xOffset=float(f-m_startFreq)/m_freqPerDiv;
|
||||
for(int i=0; i<=m_hdivs; i++) {
|
||||
m_HDivText[i].setNum(f);
|
||||
f+=m_freqPerDiv;
|
||||
}
|
||||
}
|
||||
|
||||
int CPlotter::XfromFreq(float f) //XfromFreq()
|
||||
{
|
||||
// float w = m_WaterfallPixmap.width();
|
||||
int x = int(m_w * (f - m_startFreq)/m_fSpan + 0.5);
|
||||
if(x<0 ) return 0;
|
||||
if(x>m_w) return m_w;
|
||||
return x;
|
||||
}
|
||||
|
||||
float CPlotter::FreqfromX(int x) //FreqfromX()
|
||||
{
|
||||
return float(m_startFreq + x*m_binsPerPixel*m_fftBinWidth);
|
||||
}
|
||||
|
||||
void CPlotter::SetRunningState(bool running) //SetRunningState()
|
||||
{
|
||||
m_Running = running;
|
||||
}
|
||||
|
||||
void CPlotter::setPlotZero(int plotZero) //setPlotZero()
|
||||
{
|
||||
m_plotZero=plotZero;
|
||||
}
|
||||
|
||||
int CPlotter::plotZero() //PlotZero()
|
||||
{
|
||||
return m_plotZero;
|
||||
}
|
||||
|
||||
void CPlotter::setPlotGain(int plotGain) //setPlotGain()
|
||||
{
|
||||
m_plotGain=plotGain;
|
||||
}
|
||||
|
||||
int CPlotter::plotGain() //plotGain()
|
||||
{
|
||||
return m_plotGain;
|
||||
}
|
||||
|
||||
int CPlotter::plot2dGain() //plot2dGain
|
||||
{
|
||||
return m_plot2dGain;
|
||||
}
|
||||
|
||||
void CPlotter::setPlot2dGain(int n) //setPlot2dGain
|
||||
{
|
||||
m_plot2dGain=n;
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::plot2dZero() //plot2dZero
|
||||
{
|
||||
return m_plot2dZero;
|
||||
}
|
||||
|
||||
void CPlotter::setPlot2dZero(int plot2dZero) //setPlot2dZero
|
||||
{
|
||||
m_plot2dZero=plot2dZero;
|
||||
}
|
||||
|
||||
void CPlotter::setStartFreq(int f) //SetStartFreq()
|
||||
{
|
||||
m_startFreq=f;
|
||||
resizeEvent(NULL);
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::startFreq() //startFreq()
|
||||
{
|
||||
return m_startFreq;
|
||||
}
|
||||
|
||||
int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} //plotWidth
|
||||
void CPlotter::UpdateOverlay() {DrawOverlay();} //UpdateOverlay
|
||||
void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;} //setDataFromDisk
|
||||
|
||||
void CPlotter::setRxRange(int fMin) //setRxRange
|
||||
{
|
||||
m_fMin=fMin;
|
||||
}
|
||||
|
||||
void CPlotter::setBinsPerPixel(int n) //setBinsPerPixel
|
||||
{
|
||||
m_binsPerPixel = n;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
int CPlotter::binsPerPixel() //binsPerPixel
|
||||
{
|
||||
return m_binsPerPixel;
|
||||
}
|
||||
|
||||
void CPlotter::setWaterfallAvg(int n) //setBinsPerPixel
|
||||
{
|
||||
m_waterfallAvg = n;
|
||||
}
|
||||
|
||||
void CPlotter::setRxFreq (int x) //setRxFreq
|
||||
{
|
||||
m_rxFreq = x; // x is freq in Hz
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq
|
||||
|
||||
void CPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent
|
||||
{
|
||||
int x=event->x();
|
||||
if(x<0) x=0;
|
||||
if(x>m_Size.width()) x=m_Size.width();
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
int newFreq = int(FreqfromX(x)+0.5);
|
||||
int oldTxFreq = m_txFreq;
|
||||
int oldRxFreq = m_rxFreq;
|
||||
|
||||
if (ctrl or m_lockTxFreq) {
|
||||
emit setFreq1 (newFreq, newFreq);
|
||||
}
|
||||
else if (shift) {
|
||||
emit setFreq1 (oldRxFreq, newFreq);
|
||||
}
|
||||
else {
|
||||
emit setFreq1(newFreq,oldTxFreq);
|
||||
}
|
||||
|
||||
int n=1;
|
||||
if(ctrl) n+=100;
|
||||
emit freezeDecode1(n);
|
||||
}
|
||||
|
||||
void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click
|
||||
{
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
int n=2;
|
||||
if(ctrl) n+=100;
|
||||
emit freezeDecode1(n);
|
||||
}
|
||||
|
||||
void CPlotter::setNsps(int ntrperiod, int nsps) //setNsps
|
||||
{
|
||||
m_TRperiod=ntrperiod;
|
||||
m_nsps=nsps;
|
||||
m_fftBinWidth=1500.0/2048.0;
|
||||
if(m_nsps==15360) m_fftBinWidth=1500.0/2048.0;
|
||||
if(m_nsps==40960) m_fftBinWidth=1500.0/6144.0;
|
||||
if(m_nsps==82944) m_fftBinWidth=1500.0/12288.0;
|
||||
if(m_nsps==252000) m_fftBinWidth=1500.0/32768.0;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
void CPlotter::setTxFreq(int n) //setTxFreq
|
||||
{
|
||||
m_txFreq=n;
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
void CPlotter::setMode(QString mode) //setMode
|
||||
{
|
||||
m_mode=mode;
|
||||
}
|
||||
|
||||
void CPlotter::setSubMode(int n) //setSubMode
|
||||
{
|
||||
m_nSubMode=n;
|
||||
}
|
||||
|
||||
void CPlotter::setModeTx(QString modeTx) //setModeTx
|
||||
{
|
||||
m_modeTx=modeTx;
|
||||
}
|
||||
|
||||
int CPlotter::Fmax()
|
||||
{
|
||||
return m_fMax;
|
||||
}
|
||||
|
||||
void CPlotter::setDialFreq(double d)
|
||||
{
|
||||
m_dialFreq=d;
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
void CPlotter::setRxBand(QString band)
|
||||
{
|
||||
m_rxBand=band;
|
||||
}
|
||||
|
||||
void CPlotter::setFlatten(bool b1, bool b2)
|
||||
{
|
||||
m_Flatten=0;
|
||||
if(b1) m_Flatten=1;
|
||||
if(b2) m_Flatten=2;
|
||||
}
|
||||
|
||||
void CPlotter::setTol(int n) //setTol()
|
||||
{
|
||||
m_tol=n;
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::setColours(QVector<QColor> const& cl)
|
||||
{
|
||||
g_ColorTbl = cl;
|
||||
}
|
||||
|
||||
void CPlotter::SetPercent2DScreen(int percent)
|
||||
{
|
||||
m_Percent2DScreen=percent;
|
||||
resizeEvent(NULL);
|
||||
update();
|
||||
}
|
||||
void CPlotter::setVHF(bool bVHF)
|
||||
{
|
||||
m_bVHF=bVHF;
|
||||
}
|
||||
|
||||
void CPlotter::setRedFile(QString fRed)
|
||||
{
|
||||
m_redFile=fRed;
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef UNWIND_TYPE_DWA200222_HPP
|
||||
# define UNWIND_TYPE_DWA200222_HPP
|
||||
|
||||
# include <boost/python/detail/cv_category.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
#ifndef _MSC_VER //if forward declared, msvc6.5 does not recognize them as inline
|
||||
// forward declaration, required (at least) by Tru64 cxx V6.5-042
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_type(U const& p, Generator* = 0);
|
||||
|
||||
// forward declaration, required (at least) by Tru64 cxx V6.5-042
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_type(boost::type<U>*p = 0, Generator* = 0);
|
||||
#endif
|
||||
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_type_cv(U* p, cv_unqualified, Generator* = 0)
|
||||
{
|
||||
return Generator::execute(p);
|
||||
}
|
||||
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_type_cv(U const* p, const_, Generator* = 0)
|
||||
{
|
||||
return unwind_type(const_cast<U*>(p), (Generator*)0);
|
||||
}
|
||||
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_type_cv(U volatile* p, volatile_, Generator* = 0)
|
||||
{
|
||||
return unwind_type(const_cast<U*>(p), (Generator*)0);
|
||||
}
|
||||
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_type_cv(U const volatile* p, const_volatile_, Generator* = 0)
|
||||
{
|
||||
return unwind_type(const_cast<U*>(p), (Generator*)0);
|
||||
}
|
||||
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
unwind_ptr_type(U* p, Generator* = 0)
|
||||
{
|
||||
typedef typename cv_category<U>::type tag;
|
||||
return unwind_type_cv<Generator>(p, tag());
|
||||
}
|
||||
|
||||
template <bool is_ptr>
|
||||
struct unwind_helper
|
||||
{
|
||||
template <class Generator, class U>
|
||||
static typename Generator::result_type
|
||||
execute(U p, Generator* = 0)
|
||||
{
|
||||
return unwind_ptr_type(p, (Generator*)0);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct unwind_helper<false>
|
||||
{
|
||||
template <class Generator, class U>
|
||||
static typename Generator::result_type
|
||||
execute(U& p, Generator* = 0)
|
||||
{
|
||||
return unwind_ptr_type(&p, (Generator*)0);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
#ifndef _MSC_VER
|
||||
unwind_type(U const& p, Generator*)
|
||||
#else
|
||||
unwind_type(U const& p, Generator* = 0)
|
||||
#endif
|
||||
{
|
||||
return unwind_helper<is_pointer<U>::value>::execute(p, (Generator*)0);
|
||||
}
|
||||
|
||||
enum { direct_ = 0, pointer_ = 1, reference_ = 2, reference_to_pointer_ = 3 };
|
||||
template <int indirection> struct unwind_helper2;
|
||||
|
||||
template <>
|
||||
struct unwind_helper2<direct_>
|
||||
{
|
||||
template <class Generator, class U>
|
||||
static typename Generator::result_type
|
||||
execute(U(*)(), Generator* = 0)
|
||||
{
|
||||
return unwind_ptr_type((U*)0, (Generator*)0);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct unwind_helper2<pointer_>
|
||||
{
|
||||
template <class Generator, class U>
|
||||
static typename Generator::result_type
|
||||
execute(U*(*)(), Generator* = 0)
|
||||
{
|
||||
return unwind_ptr_type((U*)0, (Generator*)0);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct unwind_helper2<reference_>
|
||||
{
|
||||
template <class Generator, class U>
|
||||
static typename Generator::result_type
|
||||
execute(U&(*)(), Generator* = 0)
|
||||
{
|
||||
return unwind_ptr_type((U*)0, (Generator*)0);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct unwind_helper2<reference_to_pointer_>
|
||||
{
|
||||
template <class Generator, class U>
|
||||
static typename Generator::result_type
|
||||
execute(U&(*)(), Generator* = 0)
|
||||
{
|
||||
return unwind_ptr_type(U(0), (Generator*)0);
|
||||
}
|
||||
};
|
||||
|
||||
// Call this one with both template parameters explicitly specified
|
||||
// and no function arguments:
|
||||
//
|
||||
// return unwind_type<my_generator,T>();
|
||||
//
|
||||
// Doesn't work if T is an array type; we could handle that case, but
|
||||
// why bother?
|
||||
template <class Generator, class U>
|
||||
inline typename Generator::result_type
|
||||
#ifndef _MSC_VER
|
||||
unwind_type(boost::type<U>*, Generator*)
|
||||
#else
|
||||
unwind_type(boost::type<U>*p =0, Generator* =0)
|
||||
#endif
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, indirection
|
||||
= (boost::is_pointer<U>::value ? pointer_ : 0)
|
||||
+ (indirect_traits::is_reference_to_pointer<U>::value
|
||||
? reference_to_pointer_
|
||||
: boost::is_reference<U>::value
|
||||
? reference_
|
||||
: 0));
|
||||
|
||||
return unwind_helper2<indirection>::execute((U(*)())0,(Generator*)0);
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // UNWIND_TYPE_DWA200222_HPP
|
||||
@@ -0,0 +1,748 @@
|
||||
#include "plotter.h"
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
#include "commons.h"
|
||||
#include "moc_plotter.cpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#define MAX_SCREENSIZE 2048
|
||||
|
||||
CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
|
||||
QFrame {parent},
|
||||
m_bScaleOK {false},
|
||||
m_bReference {false},
|
||||
m_bReference0 {false},
|
||||
m_fSpan {2000.0},
|
||||
m_plotZero {0},
|
||||
m_plotGain {0},
|
||||
m_plot2dGain {0},
|
||||
m_plot2dZero {0},
|
||||
m_nSubMode {0},
|
||||
m_Running {false},
|
||||
m_paintEventBusy {false},
|
||||
m_fftBinWidth {1500.0/2048.0},
|
||||
m_dialFreq {0.},
|
||||
m_sum {},
|
||||
m_dBStepSize {10},
|
||||
m_FreqUnits {1},
|
||||
m_hdivs {HORZ_DIVS},
|
||||
m_line {0},
|
||||
m_fSample {12000},
|
||||
m_nsps {6912},
|
||||
m_Percent2DScreen {30}, //percent of screen used for 2D display
|
||||
m_Percent2DScreen0 {0},
|
||||
m_rxFreq {1020},
|
||||
m_txFreq {0},
|
||||
m_startFreq {0}
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setAttribute(Qt::WA_PaintOnScreen,false);
|
||||
setAutoFillBackground(false);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
}
|
||||
|
||||
CPlotter::~CPlotter() { } // Destructor
|
||||
|
||||
QSize CPlotter::minimumSizeHint() const
|
||||
{
|
||||
return QSize(50, 50);
|
||||
}
|
||||
|
||||
QSize CPlotter::sizeHint() const
|
||||
{
|
||||
return QSize(180, 180);
|
||||
}
|
||||
|
||||
void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
|
||||
{
|
||||
if(!size().isValid()) return;
|
||||
if( m_Size != size() or (m_bReference != m_bReference0) or
|
||||
m_Percent2DScreen != m_Percent2DScreen0) {
|
||||
m_Size = size();
|
||||
m_w = m_Size.width();
|
||||
m_h = m_Size.height();
|
||||
m_h2 = m_Percent2DScreen*m_h/100.0;
|
||||
if(m_h2>m_h-30) m_h2=m_h-30;
|
||||
if(m_bReference) m_h2=m_h-30;
|
||||
if(m_h2<1) m_h2=1;
|
||||
m_h1=m_h-m_h2;
|
||||
m_2DPixmap = QPixmap(m_Size.width(), m_h2);
|
||||
m_2DPixmap.fill(Qt::black);
|
||||
m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
|
||||
m_OverlayPixmap = QPixmap(m_Size.width(), m_h2);
|
||||
m_OverlayPixmap.fill(Qt::black);
|
||||
m_WaterfallPixmap.fill(Qt::black);
|
||||
m_2DPixmap.fill(Qt::black);
|
||||
m_ScalePixmap = QPixmap(m_w,30);
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
m_Percent2DScreen0 = m_Percent2DScreen;
|
||||
}
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::paintEvent(QPaintEvent *) // paintEvent()
|
||||
{
|
||||
if(m_paintEventBusy) return;
|
||||
m_paintEventBusy=true;
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0,0,m_ScalePixmap);
|
||||
painter.drawPixmap(0,30,m_WaterfallPixmap);
|
||||
painter.drawPixmap(0,m_h1,m_2DPixmap);
|
||||
m_paintEventBusy=false;
|
||||
}
|
||||
|
||||
void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
||||
{
|
||||
int j,j0;
|
||||
static int ktop=0;
|
||||
float y,y2,ymin;
|
||||
double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0);
|
||||
double gain = fac*pow(10.0,0.02*m_plotGain);
|
||||
double gain2d = pow(10.0,0.02*(m_plot2dGain));
|
||||
|
||||
if(m_bReference != m_bReference0) resizeEvent(NULL);
|
||||
m_bReference0=m_bReference;
|
||||
|
||||
//move current data down one line (must do this before attaching a QPainter object)
|
||||
if(bScroll) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
|
||||
QPainter painter1(&m_WaterfallPixmap);
|
||||
m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
|
||||
QPainter painter2D(&m_2DPixmap);
|
||||
if(!painter2D.isActive()) return;
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(12);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter2D.setFont(Font);
|
||||
|
||||
if(m_bLinearAvg) {
|
||||
painter2D.setPen(Qt::yellow);
|
||||
} else if(m_bReference) {
|
||||
painter2D.setPen(Qt::blue);
|
||||
} else {
|
||||
painter2D.setPen(Qt::green);
|
||||
}
|
||||
static QPoint LineBuf[MAX_SCREENSIZE];
|
||||
static QPoint LineBuf2[MAX_SCREENSIZE];
|
||||
j=0;
|
||||
j0=int(m_startFreq/m_fftBinWidth + 0.5);
|
||||
int iz=XfromFreq(5000.0);
|
||||
int jz=iz*m_binsPerPixel;
|
||||
m_fMax=FreqfromX(iz);
|
||||
|
||||
m_line++;
|
||||
if(bScroll) {
|
||||
flat4_(swide,&iz,&m_Flatten);
|
||||
flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
|
||||
}
|
||||
|
||||
ymin=1.e30;
|
||||
if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green);
|
||||
if(swide[0]>1.4e30) painter1.setPen(Qt::yellow);
|
||||
for(int i=0; i<iz; i++) {
|
||||
y=swide[i];
|
||||
if(y<ymin) ymin=y;
|
||||
int y1 = 10.0*gain*y + 10*m_plotZero +40;
|
||||
if (y1<0) y1=0;
|
||||
if (y1>254) y1=254;
|
||||
if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]);
|
||||
painter1.drawPoint(i,0);
|
||||
}
|
||||
|
||||
float y2min=1.e30;
|
||||
float y2max=-1.e30;
|
||||
for(int i=0; i<iz; i++) {
|
||||
y=swide[i] - ymin;
|
||||
y2=0;
|
||||
if(m_bCurrent) y2 = gain2d*y + m_plot2dZero; //Current
|
||||
|
||||
if(bScroll) {
|
||||
float sum=0.0;
|
||||
int j=j0+m_binsPerPixel*i;
|
||||
for(int k=0; k<m_binsPerPixel; k++) {
|
||||
sum+=dec_data.savg[j++];
|
||||
}
|
||||
m_sum[i]=sum;
|
||||
}
|
||||
if(m_bCumulative) y2=gain2d*(m_sum[i]/m_binsPerPixel + m_plot2dZero);
|
||||
if(m_Flatten==0) y2 += 15; //### could do better! ###
|
||||
|
||||
if(m_bLinearAvg) { //Linear Avg (yellow)
|
||||
float sum=0.0;
|
||||
int j=j0+m_binsPerPixel*i;
|
||||
for(int k=0; k<m_binsPerPixel; k++) {
|
||||
sum+=spectra_.syellow[j++];
|
||||
}
|
||||
y2=gain2d*sum/m_binsPerPixel + m_plot2dZero;
|
||||
}
|
||||
|
||||
if(m_bReference) { //Reference (red)
|
||||
float df_ref=12000.0/6912.0;
|
||||
int j=FreqfromX(i)/df_ref + 0.5;
|
||||
y2=spectra_.ref[j] + m_plot2dZero;
|
||||
// if(gain2d>1.5) y2=spectra_.filter[j] + m_plot2dZero;
|
||||
|
||||
}
|
||||
|
||||
if(i==iz-1) {
|
||||
painter2D.drawPolyline(LineBuf,j);
|
||||
if(m_mode=="QRA64") {
|
||||
painter2D.setPen(Qt::red);
|
||||
painter2D.drawPolyline(LineBuf2,ktop);
|
||||
}
|
||||
}
|
||||
LineBuf[j].setX(i);
|
||||
LineBuf[j].setY(int(0.9*m_h2-y2*m_h2/70.0));
|
||||
if(y2<y2min) y2min=y2;
|
||||
if(y2>y2max) y2max=y2;
|
||||
j++;
|
||||
}
|
||||
|
||||
if(swide[0]>1.0e29) m_line=0;
|
||||
if(m_line == painter1.fontMetrics ().height ()) {
|
||||
painter1.setPen(Qt::white);
|
||||
QString t;
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
||||
int n=(ms/1000) % m_TRperiod;
|
||||
QDateTime t1=QDateTime::currentDateTimeUtc().addSecs(-n);
|
||||
if(m_TRperiod < 60) {
|
||||
t=t1.toString("hh:mm:ss") + " " + m_rxBand;
|
||||
} else {
|
||||
t=t1.toString("hh:mm") + " " + m_rxBand;
|
||||
}
|
||||
painter1.drawText (5, painter1.fontMetrics ().ascent (), t);
|
||||
}
|
||||
|
||||
if(m_mode=="JT4" or m_mode=="QRA64") {
|
||||
QPen pen3(Qt::yellow); //Mark freqs of JT4 single-tone msgs
|
||||
painter2D.setPen(pen3);
|
||||
Font.setWeight(QFont::Bold);
|
||||
painter2D.setFont(Font);
|
||||
int x1=XfromFreq(m_rxFreq);
|
||||
y=0.2*m_h2;
|
||||
painter2D.drawText(x1-4,y,"T");
|
||||
x1=XfromFreq(m_rxFreq+250);
|
||||
painter2D.drawText(x1-4,y,"M");
|
||||
x1=XfromFreq(m_rxFreq+500);
|
||||
painter2D.drawText(x1-4,y,"R");
|
||||
x1=XfromFreq(m_rxFreq+750);
|
||||
painter2D.drawText(x1-4,y,"73");
|
||||
}
|
||||
|
||||
if(bRed) {
|
||||
std::ifstream f;
|
||||
f.open(m_redFile.toLatin1());
|
||||
if(f) {
|
||||
int x,y;
|
||||
float freq,sync;
|
||||
float slimit=6.0;
|
||||
QPen pen0(Qt::red,1);
|
||||
painter1.setPen(pen0);
|
||||
for(int i=0; i<99999; i++) {
|
||||
f >> freq >> sync;
|
||||
if(f.eof()) break;
|
||||
x=XfromFreq(freq);
|
||||
y=(sync-slimit)*3.0;
|
||||
if(y>0) {
|
||||
if(y>15.0) y=15.0;
|
||||
if(x>=0 and x<=m_w) {
|
||||
painter1.setPen(pen0);
|
||||
painter1.drawLine(x,0,x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
// m_bDecodeFinished=false;
|
||||
}
|
||||
|
||||
update(); //trigger a new paintEvent
|
||||
m_bScaleOK=true;
|
||||
}
|
||||
|
||||
void CPlotter::drawRed(int ia, int ib, float swide[])
|
||||
{
|
||||
m_ia=ia;
|
||||
m_ib=ib;
|
||||
draw(swide,false,true);
|
||||
}
|
||||
|
||||
void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
{
|
||||
if(m_OverlayPixmap.isNull()) return;
|
||||
if(m_WaterfallPixmap.isNull()) return;
|
||||
int w = m_WaterfallPixmap.width();
|
||||
int x,y,x1,x2,x3,x4,x5,x6;
|
||||
float pixperdiv;
|
||||
|
||||
double df = m_binsPerPixel*m_fftBinWidth;
|
||||
QRect rect;
|
||||
QPen penOrange(QColor(255,165,0),3);
|
||||
QPen penGreen(Qt::green, 3); //Mark Tol range with green line
|
||||
QPen penRed(Qt::red, 3); //Mark Tx freq with red
|
||||
QPainter painter(&m_OverlayPixmap);
|
||||
painter.initFrom(this);
|
||||
QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient
|
||||
gradient.setColorAt(1, Qt::black);
|
||||
gradient.setColorAt(0, Qt::darkBlue);
|
||||
painter.setBrush(gradient);
|
||||
painter.drawRect(0, 0, m_w, m_h2);
|
||||
painter.setBrush(Qt::SolidPattern);
|
||||
|
||||
m_fSpan = w*df;
|
||||
// int n=m_fSpan/10;
|
||||
m_freqPerDiv=10;
|
||||
if(m_fSpan>100) m_freqPerDiv=20;
|
||||
if(m_fSpan>250) m_freqPerDiv=50;
|
||||
if(m_fSpan>500) m_freqPerDiv=100;
|
||||
if(m_fSpan>1000) m_freqPerDiv=200;
|
||||
if(m_fSpan>2500) m_freqPerDiv=500;
|
||||
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
m_hdivs = w*df/m_freqPerDiv + 1.9999;
|
||||
|
||||
float xx0=float(m_startFreq)/float(m_freqPerDiv);
|
||||
xx0=xx0-int(xx0);
|
||||
int x0=xx0*pixperdiv+0.5;
|
||||
for( int i=1; i<m_hdivs; i++) { //draw vertical grids
|
||||
x = (int)((float)i*pixperdiv ) - x0;
|
||||
if(x >= 0 and x<=m_w) {
|
||||
painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
|
||||
painter.drawLine(x, 0, x , m_h2);
|
||||
}
|
||||
}
|
||||
|
||||
pixperdiv = (float)m_h2 / (float)VERT_DIVS;
|
||||
painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
|
||||
for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids
|
||||
y = (int)( (float)i*pixperdiv );
|
||||
painter.drawLine(0, y, w, y);
|
||||
}
|
||||
|
||||
QRect rect0;
|
||||
QPainter painter0(&m_ScalePixmap);
|
||||
painter0.initFrom(this);
|
||||
|
||||
//create Font to use for scales
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(12);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter0.setFont(Font);
|
||||
painter0.setPen(Qt::black);
|
||||
|
||||
if(m_binsPerPixel < 1) m_binsPerPixel=1;
|
||||
m_hdivs = w*df/m_freqPerDiv + 0.9999;
|
||||
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
painter0.drawRect(0, 0, w, 30);
|
||||
MakeFrequencyStrs();
|
||||
|
||||
//draw tick marks on upper scale
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
for( int i=0; i<m_hdivs; i++) { //major ticks
|
||||
x = (int)((m_xOffset+i)*pixperdiv );
|
||||
painter0.drawLine(x,18,x,30);
|
||||
}
|
||||
int minor=5;
|
||||
if(m_freqPerDiv==200) minor=4;
|
||||
for( int i=1; i<minor*m_hdivs; i++) { //minor ticks
|
||||
x = i*pixperdiv/minor;
|
||||
painter0.drawLine(x,24,x,30);
|
||||
}
|
||||
|
||||
//draw frequency values
|
||||
for( int i=0; i<=m_hdivs; i++) {
|
||||
x = (int)((m_xOffset+i)*pixperdiv - pixperdiv/2);
|
||||
rect0.setRect(x,0, (int)pixperdiv, 20);
|
||||
painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
|
||||
}
|
||||
|
||||
float bw=9.0*12000.0/m_nsps; //JT9
|
||||
|
||||
if(m_mode=="FT8") bw=8*12000.0/1920.0; //FT8
|
||||
|
||||
if(m_mode=="JT4") { //JT4
|
||||
bw=3*11025.0/2520.0; //Max tone spacing (3/4 of actual BW)
|
||||
if(m_nSubMode==1) bw=2*bw;
|
||||
if(m_nSubMode==2) bw=4*bw;
|
||||
if(m_nSubMode==3) bw=9*bw;
|
||||
if(m_nSubMode==4) bw=18*bw;
|
||||
if(m_nSubMode==5) bw=36*bw;
|
||||
if(m_nSubMode==6) bw=72*bw;
|
||||
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
for(int i=0; i<4; i++) {
|
||||
x1=XfromFreq(m_rxFreq+bw*i/3.0);
|
||||
int j=24;
|
||||
if(i==0) j=18;
|
||||
painter0.drawLine(x1,j,x1,30);
|
||||
}
|
||||
painter0.setPen(penRed);
|
||||
for(int i=0; i<4; i++) {
|
||||
x1=XfromFreq(m_txFreq+bw*i/3.0);
|
||||
painter0.drawLine(x1,12,x1,18);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_modeTx=="JT9" and m_nSubMode>0) { //JT9
|
||||
bw=8.0*12000.0/m_nsps;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
if(m_nSubMode==3) bw=8*bw; //D
|
||||
if(m_nSubMode==4) bw=16*bw; //E
|
||||
if(m_nSubMode==5) bw=32*bw; //F
|
||||
if(m_nSubMode==6) bw=64*bw; //G
|
||||
if(m_nSubMode==7) bw=128*bw; //H
|
||||
}
|
||||
|
||||
if(m_mode=="QRA64") { //QRA64
|
||||
bw=63.0*12000.0/m_nsps;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
if(m_nSubMode==3) bw=8*bw; //D
|
||||
if(m_nSubMode==4) bw=16*bw; //E
|
||||
}
|
||||
|
||||
if(m_modeTx=="JT65") { //JT65
|
||||
bw=65.0*11025.0/4096.0;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
}
|
||||
|
||||
painter0.setPen(penGreen);
|
||||
if(m_mode=="WSPR") {
|
||||
x1=XfromFreq(1400);
|
||||
x2=XfromFreq(1600);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
}
|
||||
|
||||
if(m_mode=="WSPR-LF") {
|
||||
x1=XfromFreq(1600);
|
||||
x2=XfromFreq(1700);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
}
|
||||
|
||||
if(m_mode=="FreqCal") { //FreqCal
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="JT9+JT65" or m_mode=="QRA64" or m_mode=="FT8") {
|
||||
|
||||
if(m_mode=="QRA64" or (m_mode=="JT65" and m_bVHF)) {
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,28,x2,28);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
|
||||
if(m_mode=="JT65") {
|
||||
painter0.setPen(penOrange);
|
||||
x3=XfromFreq(m_rxFreq+20.0*bw/65.0); //RO
|
||||
painter0.drawLine(x3,24,x3,30);
|
||||
x4=XfromFreq(m_rxFreq+30.0*bw/65.0); //RRR
|
||||
painter0.drawLine(x4,24,x4,30);
|
||||
x5=XfromFreq(m_rxFreq+40.0*bw/65.0); //73
|
||||
painter0.drawLine(x5,24,x5,30);
|
||||
}
|
||||
painter0.setPen(penGreen);
|
||||
x6=XfromFreq(m_rxFreq+bw); //Highest tone
|
||||
painter0.drawLine(x6,24,x6,30);
|
||||
|
||||
} else {
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
x2=XfromFreq(m_rxFreq+bw);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
painter0.drawLine(x1,28,x2,28);
|
||||
painter0.drawLine(x2,24,x2,30);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="JT9+JT65" or
|
||||
m_mode.mid(0,4)=="WSPR" or m_mode=="QRA64" or m_mode=="FT8") {
|
||||
painter0.setPen(penRed);
|
||||
x1=XfromFreq(m_txFreq);
|
||||
x2=XfromFreq(m_txFreq+bw);
|
||||
if(m_mode=="WSPR") {
|
||||
bw=4*12000.0/8192.0; //WSPR
|
||||
x1=XfromFreq(m_txFreq-0.5*bw);
|
||||
x2=XfromFreq(m_txFreq+0.5*bw);
|
||||
}
|
||||
if(m_mode=="WSPR-LF") {
|
||||
bw=3*12000.0/8640.0; //WSPR-LF
|
||||
x1=XfromFreq(m_txFreq-0.5*bw);
|
||||
x2=XfromFreq(m_txFreq+0.5*bw);
|
||||
}
|
||||
painter0.drawLine(x1,17,x1,21);
|
||||
painter0.drawLine(x1,17,x2,17);
|
||||
painter0.drawLine(x2,17,x2,21);
|
||||
}
|
||||
|
||||
if(m_mode=="JT9+JT65") {
|
||||
QPen pen2(Qt::blue, 3); //Mark the JT65 | JT9 divider
|
||||
painter0.setPen(pen2);
|
||||
x1=XfromFreq(m_fMin);
|
||||
if(x1<2) x1=2;
|
||||
x2=x1+30;
|
||||
painter0.drawLine(x1,8,x1,28);
|
||||
}
|
||||
|
||||
if(m_dialFreq>10.13 and m_dialFreq< 10.15 and m_mode.mid(0,4)!="WSPR") {
|
||||
float f1=1.0e6*(10.1401 - m_dialFreq);
|
||||
float f2=f1+200.0;
|
||||
x1=XfromFreq(f1);
|
||||
x2=XfromFreq(f2);
|
||||
if(x1<=m_w and x2>=0) {
|
||||
painter0.setPen(penOrange); //Mark WSPR sub-band orange
|
||||
painter0.drawLine(x1,9,x2,9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
|
||||
{
|
||||
int f=(m_startFreq+m_freqPerDiv-1)/m_freqPerDiv;
|
||||
f*=m_freqPerDiv;
|
||||
m_xOffset=float(f-m_startFreq)/m_freqPerDiv;
|
||||
for(int i=0; i<=m_hdivs; i++) {
|
||||
m_HDivText[i].setNum(f);
|
||||
f+=m_freqPerDiv;
|
||||
}
|
||||
}
|
||||
|
||||
int CPlotter::XfromFreq(float f) //XfromFreq()
|
||||
{
|
||||
// float w = m_WaterfallPixmap.width();
|
||||
int x = int(m_w * (f - m_startFreq)/m_fSpan + 0.5);
|
||||
if(x<0 ) return 0;
|
||||
if(x>m_w) return m_w;
|
||||
return x;
|
||||
}
|
||||
|
||||
float CPlotter::FreqfromX(int x) //FreqfromX()
|
||||
{
|
||||
return float(m_startFreq + x*m_binsPerPixel*m_fftBinWidth);
|
||||
}
|
||||
|
||||
void CPlotter::SetRunningState(bool running) //SetRunningState()
|
||||
{
|
||||
m_Running = running;
|
||||
}
|
||||
|
||||
void CPlotter::setPlotZero(int plotZero) //setPlotZero()
|
||||
{
|
||||
m_plotZero=plotZero;
|
||||
}
|
||||
|
||||
int CPlotter::plotZero() //PlotZero()
|
||||
{
|
||||
return m_plotZero;
|
||||
}
|
||||
|
||||
void CPlotter::setPlotGain(int plotGain) //setPlotGain()
|
||||
{
|
||||
m_plotGain=plotGain;
|
||||
}
|
||||
|
||||
int CPlotter::plotGain() //plotGain()
|
||||
{
|
||||
return m_plotGain;
|
||||
}
|
||||
|
||||
int CPlotter::plot2dGain() //plot2dGain
|
||||
{
|
||||
return m_plot2dGain;
|
||||
}
|
||||
|
||||
void CPlotter::setPlot2dGain(int n) //setPlot2dGain
|
||||
{
|
||||
m_plot2dGain=n;
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::plot2dZero() //plot2dZero
|
||||
{
|
||||
return m_plot2dZero;
|
||||
}
|
||||
|
||||
void CPlotter::setPlot2dZero(int plot2dZero) //setPlot2dZero
|
||||
{
|
||||
m_plot2dZero=plot2dZero;
|
||||
}
|
||||
|
||||
void CPlotter::setStartFreq(int f) //SetStartFreq()
|
||||
{
|
||||
m_startFreq=f;
|
||||
resizeEvent(NULL);
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::startFreq() //startFreq()
|
||||
{
|
||||
return m_startFreq;
|
||||
}
|
||||
|
||||
int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} //plotWidth
|
||||
void CPlotter::UpdateOverlay() {DrawOverlay();} //UpdateOverlay
|
||||
void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;} //setDataFromDisk
|
||||
|
||||
void CPlotter::setRxRange(int fMin) //setRxRange
|
||||
{
|
||||
m_fMin=fMin;
|
||||
}
|
||||
|
||||
void CPlotter::setBinsPerPixel(int n) //setBinsPerPixel
|
||||
{
|
||||
m_binsPerPixel = n;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
int CPlotter::binsPerPixel() //binsPerPixel
|
||||
{
|
||||
return m_binsPerPixel;
|
||||
}
|
||||
|
||||
void CPlotter::setWaterfallAvg(int n) //setBinsPerPixel
|
||||
{
|
||||
m_waterfallAvg = n;
|
||||
}
|
||||
|
||||
void CPlotter::setRxFreq (int x) //setRxFreq
|
||||
{
|
||||
m_rxFreq = x; // x is freq in Hz
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq
|
||||
|
||||
void CPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent
|
||||
{
|
||||
int x=event->x();
|
||||
if(x<0) x=0;
|
||||
if(x>m_Size.width()) x=m_Size.width();
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
int newFreq = int(FreqfromX(x)+0.5);
|
||||
int oldTxFreq = m_txFreq;
|
||||
int oldRxFreq = m_rxFreq;
|
||||
|
||||
if (ctrl or m_lockTxFreq) {
|
||||
emit setFreq1 (newFreq, newFreq);
|
||||
}
|
||||
else if (shift) {
|
||||
emit setFreq1 (oldRxFreq, newFreq);
|
||||
}
|
||||
else {
|
||||
emit setFreq1(newFreq,oldTxFreq);
|
||||
}
|
||||
|
||||
int n=1;
|
||||
if(ctrl) n+=100;
|
||||
emit freezeDecode1(n);
|
||||
}
|
||||
|
||||
void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click
|
||||
{
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
int n=2;
|
||||
if(ctrl) n+=100;
|
||||
emit freezeDecode1(n);
|
||||
}
|
||||
|
||||
void CPlotter::setNsps(int ntrperiod, int nsps) //setNsps
|
||||
{
|
||||
m_TRperiod=ntrperiod;
|
||||
m_nsps=nsps;
|
||||
m_fftBinWidth=1500.0/2048.0;
|
||||
if(m_nsps==15360) m_fftBinWidth=1500.0/2048.0;
|
||||
if(m_nsps==40960) m_fftBinWidth=1500.0/6144.0;
|
||||
if(m_nsps==82944) m_fftBinWidth=1500.0/12288.0;
|
||||
if(m_nsps==252000) m_fftBinWidth=1500.0/32768.0;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
void CPlotter::setTxFreq(int n) //setTxFreq
|
||||
{
|
||||
m_txFreq=n;
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
void CPlotter::setMode(QString mode) //setMode
|
||||
{
|
||||
m_mode=mode;
|
||||
}
|
||||
|
||||
void CPlotter::setSubMode(int n) //setSubMode
|
||||
{
|
||||
m_nSubMode=n;
|
||||
}
|
||||
|
||||
void CPlotter::setModeTx(QString modeTx) //setModeTx
|
||||
{
|
||||
m_modeTx=modeTx;
|
||||
}
|
||||
|
||||
int CPlotter::Fmax()
|
||||
{
|
||||
return m_fMax;
|
||||
}
|
||||
|
||||
void CPlotter::setDialFreq(double d)
|
||||
{
|
||||
m_dialFreq=d;
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
void CPlotter::setRxBand(QString band)
|
||||
{
|
||||
m_rxBand=band;
|
||||
}
|
||||
|
||||
void CPlotter::setFlatten(bool b1, bool b2)
|
||||
{
|
||||
m_Flatten=0;
|
||||
if(b1) m_Flatten=1;
|
||||
if(b2) m_Flatten=2;
|
||||
}
|
||||
|
||||
void CPlotter::setTol(int n) //setTol()
|
||||
{
|
||||
m_tol=n;
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::setColours(QVector<QColor> const& cl)
|
||||
{
|
||||
g_ColorTbl = cl;
|
||||
}
|
||||
|
||||
void CPlotter::SetPercent2DScreen(int percent)
|
||||
{
|
||||
m_Percent2DScreen=percent;
|
||||
resizeEvent(NULL);
|
||||
update();
|
||||
}
|
||||
void CPlotter::setVHF(bool bVHF)
|
||||
{
|
||||
m_bVHF=bVHF;
|
||||
}
|
||||
|
||||
void CPlotter::setRedFile(QString fRed)
|
||||
{
|
||||
m_redFile=fRed;
|
||||
}
|
||||
Reference in New Issue
Block a user