Initial Commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// 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 ITERATOR_CORE_DWA2002512_HPP
|
||||
# define ITERATOR_CORE_DWA2002512_HPP
|
||||
|
||||
# include <boost/python/object_fwd.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
BOOST_PYTHON_DECL object const& identity_function();
|
||||
BOOST_PYTHON_DECL void stop_iteration_error();
|
||||
|
||||
}}} // namespace boost::python::object
|
||||
|
||||
#endif // ITERATOR_CORE_DWA2002512_HPP
|
||||
@@ -0,0 +1,25 @@
|
||||
subroutine mixlpf(x1,nbfo,c0)
|
||||
|
||||
real*4 x1(512)
|
||||
real*8 twopi,phi,dphi
|
||||
complex c1(512),c2(105+512)
|
||||
complex c0(64)
|
||||
data phi/0.d0/
|
||||
save phi,c2
|
||||
|
||||
twopi=8.d0*atan(1.d0)
|
||||
dphi=twopi*nbfo/12000.d0
|
||||
|
||||
do i=1,512
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
xphi=phi
|
||||
c1(i)=x1(i)*cmplx(cos(xphi),sin(xphi))
|
||||
enddo
|
||||
c2(106:105+512)=c1
|
||||
|
||||
call fil3c(c2,105+512,c0,n2)
|
||||
c2(1:105)=c1(512-104:512) !Save 105 trailing samples
|
||||
|
||||
return
|
||||
end subroutine mixlpf
|
||||
@@ -0,0 +1,5 @@
|
||||
integer, parameter :: NTMAX=300
|
||||
integer, parameter :: NMAX=NTMAX*12000 !Total sample intervals (one minute)
|
||||
integer, parameter :: NDMAX=NTMAX*1500 !Sample intervals at 1500 Hz rate
|
||||
integer, parameter :: NSMAX=6827 !Max length of saved spectra
|
||||
integer, parameter :: MAXFFT3=16384
|
||||
@@ -0,0 +1,39 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_TYPE_TRAITS_RESULT_OF_HPP
|
||||
#define BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// Returns the result of \c Function when called with \c Args.
|
||||
///
|
||||
/// For example,
|
||||
/// \code
|
||||
/// // int + int = int
|
||||
/// result_of<plus(int, int)>::type == int
|
||||
/// \endcode
|
||||
template<class Signature>
|
||||
struct result_of
|
||||
{
|
||||
// the default implementation uses the TR1-style result_of protocol. note
|
||||
// that we explicitly do *not* use the C++11 decltype operator as we want
|
||||
// the result type as it would be on an OpenCL device, not the actual C++
|
||||
// type resulting from "invoking" the function on the host.
|
||||
typedef typename ::boost::tr1_result_of<Signature>::type type;
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP
|
||||
@@ -0,0 +1,172 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_UTILITY_PROGRAM_CACHE_HPP
|
||||
#define BOOST_COMPUTE_UTILITY_PROGRAM_CACHE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <boost/compute/context.hpp>
|
||||
#include <boost/compute/program.hpp>
|
||||
#include <boost/compute/detail/lru_cache.hpp>
|
||||
#include <boost/compute/detail/global_static.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// The program_cache class stores \ref program objects in a LRU cache.
|
||||
///
|
||||
/// This class can be used to help mitigate the overhead of OpenCL's run-time
|
||||
/// kernel compilation model. Commonly used programs can be stored persistently
|
||||
/// in the cache and only compiled once on their first use.
|
||||
///
|
||||
/// Program objects are stored and retreived based on a user-defined cache key
|
||||
/// along with the options used to build the program (if any).
|
||||
///
|
||||
/// For example, to insert a program into the cache:
|
||||
/// \code
|
||||
/// cache.insert("foo", foo_program);
|
||||
/// \endcode
|
||||
///
|
||||
/// And to retreive the program later:
|
||||
/// \code
|
||||
/// boost::optional<program> p = cache.get("foo");
|
||||
/// if(p){
|
||||
/// // program found in cache
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// \see program
|
||||
class program_cache : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
/// Creates a new program cache with space for \p capacity number of
|
||||
/// program objects.
|
||||
program_cache(size_t capacity)
|
||||
: m_cache(capacity)
|
||||
{
|
||||
}
|
||||
|
||||
/// Destroys the program cache.
|
||||
~program_cache()
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns the number of program objects currently stored in the cache.
|
||||
size_t size() const
|
||||
{
|
||||
return m_cache.size();
|
||||
}
|
||||
|
||||
/// Returns the total capacity of the cache.
|
||||
size_t capacity() const
|
||||
{
|
||||
return m_cache.capacity();
|
||||
}
|
||||
|
||||
/// Clears the program cache.
|
||||
void clear()
|
||||
{
|
||||
m_cache.clear();
|
||||
}
|
||||
|
||||
/// Returns the program object with \p key. Returns a null optional if no
|
||||
/// program with \p key exists in the cache.
|
||||
boost::optional<program> get(const std::string &key)
|
||||
{
|
||||
return m_cache.get(std::make_pair(key, std::string()));
|
||||
}
|
||||
|
||||
/// Returns the program object with \p key and \p options. Returns a null
|
||||
/// optional if no program with \p key and \p options exists in the cache.
|
||||
boost::optional<program> get(const std::string &key, const std::string &options)
|
||||
{
|
||||
return m_cache.get(std::make_pair(key, options));
|
||||
}
|
||||
|
||||
/// Inserts \p program into the cache with \p key.
|
||||
void insert(const std::string &key, const program &program)
|
||||
{
|
||||
insert(key, std::string(), program);
|
||||
}
|
||||
|
||||
/// Inserts \p program into the cache with \p key and \p options.
|
||||
void insert(const std::string &key, const std::string &options, const program &program)
|
||||
{
|
||||
m_cache.insert(std::make_pair(key, options), program);
|
||||
}
|
||||
|
||||
/// Loads the program with \p key from the cache if it exists. Otherwise
|
||||
/// builds a new program with \p source and \p options, stores it in the
|
||||
/// cache, and returns it.
|
||||
///
|
||||
/// This is a convenience function to simplify the common pattern of
|
||||
/// attempting to load a program from the cache and, if not present,
|
||||
/// building the program from source and storing it in the cache.
|
||||
///
|
||||
/// Equivalent to:
|
||||
/// \code
|
||||
/// boost::optional<program> p = get(key, options);
|
||||
/// if(!p){
|
||||
/// p = program::create_with_source(source, context);
|
||||
/// p->build(options);
|
||||
/// insert(key, options, *p);
|
||||
/// }
|
||||
/// return *p;
|
||||
/// \endcode
|
||||
program get_or_build(const std::string &key,
|
||||
const std::string &options,
|
||||
const std::string &source,
|
||||
const context &context)
|
||||
{
|
||||
boost::optional<program> p = get(key, options);
|
||||
if(!p){
|
||||
p = program::build_with_source(source, context, options);
|
||||
|
||||
insert(key, options, *p);
|
||||
}
|
||||
return *p;
|
||||
}
|
||||
|
||||
/// Returns the global program cache for \p context.
|
||||
///
|
||||
/// This global cache is used internally by Boost.Compute to store compiled
|
||||
/// program objects used by its algorithms. All Boost.Compute programs are
|
||||
/// stored with a cache key beginning with \c "__boost". User programs
|
||||
/// should avoid using the same prefix in order to prevent collisions.
|
||||
static boost::shared_ptr<program_cache> get_global_cache(const context &context)
|
||||
{
|
||||
typedef detail::lru_cache<cl_context, boost::shared_ptr<program_cache> > cache_map;
|
||||
|
||||
BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(cache_map, caches, (8));
|
||||
|
||||
boost::optional<boost::shared_ptr<program_cache> > cache = caches.get(context.get());
|
||||
if(!cache){
|
||||
cache = boost::make_shared<program_cache>(64);
|
||||
|
||||
caches.insert(context.get(), *cache);
|
||||
}
|
||||
|
||||
return *cache;
|
||||
}
|
||||
|
||||
private:
|
||||
detail::lru_cache<std::pair<std::string, std::string>, program> m_cache;
|
||||
};
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_UTILITY_PROGRAM_CACHE_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef SETTINGS_GROUP_HPP_
|
||||
#define SETTINGS_GROUP_HPP_
|
||||
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
|
||||
//
|
||||
// Class SettingsGroup
|
||||
//
|
||||
// Simple RAII type class to apply a QSettings group witin a
|
||||
// scope.
|
||||
//
|
||||
class SettingsGroup
|
||||
{
|
||||
public:
|
||||
SettingsGroup (QSettings * settings, QString const& group)
|
||||
: settings_ {settings}
|
||||
{
|
||||
settings_->beginGroup (group);
|
||||
}
|
||||
|
||||
SettingsGroup (SettingsGroup const&) = delete;
|
||||
SettingsGroup& operator = (SettingsGroup const&) = delete;
|
||||
|
||||
~SettingsGroup ()
|
||||
{
|
||||
settings_->endGroup ();
|
||||
}
|
||||
|
||||
private:
|
||||
QSettings * settings_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/functional/hash/hash_fwd.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=7*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;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
0; 0; 0
|
||||
0; 0;177
|
||||
3;110;227
|
||||
0;204;204
|
||||
223;223;223
|
||||
0;234; 0
|
||||
244;244; 0
|
||||
250;126; 0
|
||||
244; 0; 0
|
||||
@@ -0,0 +1,286 @@
|
||||
#include "fastplot.h"
|
||||
#include "commons.h"
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
#include "moc_fastplot.cpp"
|
||||
|
||||
#define MAX_SCREENSIZE 2048
|
||||
|
||||
FPlotter::FPlotter(QWidget *parent) : //FPlotter Constructor
|
||||
QFrame {parent},
|
||||
m_w {703},
|
||||
m_plotGain {0},
|
||||
m_greenZero {0},
|
||||
m_x0 {0},
|
||||
m_x1 {0},
|
||||
m_ScalePixmap {QPixmap {703, 20}},
|
||||
m_pixPerSecond {12000.0/512.0},
|
||||
m_hdivs {30},
|
||||
m_h {220},
|
||||
m_h1 {20},
|
||||
m_h2 {m_h-m_h1},
|
||||
m_HorizPixmap {QPixmap {m_w, m_h2}},
|
||||
m_jh0 {9999},
|
||||
m_bPaint2 {true}
|
||||
{
|
||||
m_diskData=false;
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setAttribute(Qt::WA_PaintOnScreen,false);
|
||||
setAutoFillBackground(false);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
|
||||
m_HorizPixmap.fill(Qt::black);
|
||||
m_HorizPixmap.fill(Qt::black);
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
drawScale();
|
||||
draw();
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
FPlotter::~FPlotter() { } // Destructor
|
||||
|
||||
void FPlotter::paintEvent(QPaintEvent *) // paintEvent()
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0,0,m_ScalePixmap);
|
||||
painter.drawPixmap(0,m_h1,m_HorizPixmap);
|
||||
}
|
||||
|
||||
void FPlotter::drawScale() //drawScale()
|
||||
{
|
||||
if(m_ScalePixmap.isNull()) return;
|
||||
int x;
|
||||
|
||||
QRect rect0;
|
||||
QPainter painter0(&m_ScalePixmap);
|
||||
painter0.initFrom(this);
|
||||
|
||||
//create Font to use for scales
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(8);
|
||||
QFontMetrics metrics(Font);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter0.setFont(Font);
|
||||
painter0.setPen(Qt::white);
|
||||
m_ScalePixmap.fill(Qt::black);
|
||||
painter0.drawRect(0, 0,m_w,19);
|
||||
painter0.drawLine(0,19,m_w,19);
|
||||
|
||||
//Draw ticks at 1-second intervals
|
||||
for( int i=0; i<=m_hdivs; i++) {
|
||||
x = (int)( (float)i*m_pixPerSecond );
|
||||
painter0.drawLine(x,15,x,19);
|
||||
}
|
||||
|
||||
//Write numbers on the time scale
|
||||
MakeTimeStrs();
|
||||
for( int i=0; i<=m_hdivs; i++) {
|
||||
if(0==i) {
|
||||
//left justify the leftmost text
|
||||
x = (int)( (float)i*m_pixPerSecond);
|
||||
rect0.setRect(x,0, (int)m_pixPerSecond, 20);
|
||||
painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter,m_HDivText[i]);
|
||||
}
|
||||
else if(m_hdivs == i) {
|
||||
//right justify the rightmost text
|
||||
x = (int)( (float)i*m_pixPerSecond - m_pixPerSecond);
|
||||
rect0.setRect(x,0, (int)m_pixPerSecond, 20);
|
||||
painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter,m_HDivText[i]);
|
||||
} else {
|
||||
//center justify the rest of the text
|
||||
x = (int)( (float)i*m_pixPerSecond - m_pixPerSecond/2);
|
||||
rect0.setRect(x,0, (int)m_pixPerSecond, 20);
|
||||
painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FPlotter::MakeTimeStrs() //MakeTimeStrs
|
||||
{
|
||||
for(int i=0; i<=m_hdivs; i++) {
|
||||
m_HDivText[i].setNum(i);
|
||||
}
|
||||
}
|
||||
|
||||
int FPlotter::XfromTime(float t) //XfromFreq()
|
||||
{
|
||||
return int(t*m_pixPerSecond);
|
||||
}
|
||||
|
||||
float FPlotter::TimefromX(int x) //FreqfromX()
|
||||
{
|
||||
return float(x/m_pixPerSecond);
|
||||
}
|
||||
|
||||
void FPlotter::setPlotZero(int plotZero) //setPlotZero()
|
||||
{
|
||||
m_plotZero=plotZero;
|
||||
m_bPaint2=true;
|
||||
}
|
||||
|
||||
void FPlotter::setPlotGain(int plotGain) //setPlotGain()
|
||||
{
|
||||
m_plotGain=plotGain;
|
||||
m_bPaint2=true;
|
||||
}
|
||||
|
||||
void FPlotter::setGreenZero(int n)
|
||||
{
|
||||
m_greenZero=n;
|
||||
m_bPaint2=true;
|
||||
}
|
||||
|
||||
void FPlotter::setTRperiod(int n)
|
||||
{
|
||||
m_TRperiod=n;
|
||||
m_pixPerSecond=12000.0/512.0;
|
||||
if(m_TRperiod<30) m_pixPerSecond=12000.0/256.0;
|
||||
drawScale();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void FPlotter::draw() //draw()
|
||||
{
|
||||
QPainter painter1(&m_HorizPixmap);
|
||||
QPoint LineBuf[703];
|
||||
QPen penGreen(Qt::green,1);
|
||||
|
||||
if(m_diskData) {
|
||||
int ih=m_UTCdisk/10000;
|
||||
int im=m_UTCdisk/100 % 100;
|
||||
int is=m_UTCdisk % 100;
|
||||
m_t.sprintf("%2.2d:%2.2d:%2.2d",ih,im,is);
|
||||
}
|
||||
|
||||
int k0=m_jh0;
|
||||
if(fast_jh < m_jh0 or m_bPaint2) {
|
||||
k0=0;
|
||||
QRect tmp(0,0,m_w,119);
|
||||
painter1.fillRect(tmp,Qt::black);
|
||||
painter1.setPen(Qt::white);
|
||||
if(m_diskData) {
|
||||
int ih=m_UTCdisk/10000;
|
||||
int im=m_UTCdisk/100 % 100;
|
||||
int is=m_UTCdisk % 100;
|
||||
m_t.sprintf("%2.2d:%2.2d:%2.2d",ih,im,is);
|
||||
} else {
|
||||
m_t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss");
|
||||
}
|
||||
if(fast_jh>0) painter1.drawText(10,95,m_t);
|
||||
}
|
||||
|
||||
float gain = pow(10.0,(m_plotGain/20.0));
|
||||
for(int k=64*k0; k<64*fast_jh; k++) { //Upper spectrogram
|
||||
int i = k%64;
|
||||
int j = k/64;
|
||||
int y=0.005*gain*fast_s[k] + m_plotZero;
|
||||
if(y<0) y=0;
|
||||
if(y>254) y=254;
|
||||
painter1.setPen(g_ColorTbl[y]);
|
||||
painter1.drawPoint(j,64-i);
|
||||
}
|
||||
|
||||
painter1.setPen(penGreen); // Upper green curve
|
||||
int j=0;
|
||||
m_greenGain=10;
|
||||
float greenGain = pow(10.0,(m_greenGain/20.0));
|
||||
for(int x=k0; x<=fast_jh; x++) {
|
||||
int y = 0.9*m_h - greenGain*fast_green[x] - m_greenZero + 40;
|
||||
if(y>119) y=119;
|
||||
LineBuf[j].setX(x);
|
||||
// LineBuf[j].setX(2*x);
|
||||
LineBuf[j].setY(y);
|
||||
j++;
|
||||
}
|
||||
painter1.drawPolyline(LineBuf,j);
|
||||
|
||||
if((fast_jh < m_jh0) or m_bPaint2) {
|
||||
QRect tmp(0,120,m_w,219);
|
||||
painter1.fillRect(tmp,Qt::black);
|
||||
painter1.setPen(Qt::white);
|
||||
if(fast_jh>0 and m_jh0 < 9999) painter1.drawText(10,195,m_t0);
|
||||
m_t0=m_t;
|
||||
|
||||
for(int k=0; k<64*fast_jh2; k++) { //Lower spectrogram
|
||||
int i = k%64;
|
||||
int j = k/64;
|
||||
int y=0.005*gain*fast_s2[k] + m_plotZero;
|
||||
if(y<0) y=0;
|
||||
if(y>254) y=254;
|
||||
painter1.setPen(g_ColorTbl[y]);
|
||||
painter1.drawPoint(j,164-i);
|
||||
}
|
||||
|
||||
painter1.setPen(penGreen); //Lower green curve
|
||||
j=0;
|
||||
for(int x=0; x<=fast_jh2; x++) {
|
||||
int y = 0.9*m_h - greenGain*fast_green2[x] - m_greenZero + 140;
|
||||
if(y>219) y=219;
|
||||
LineBuf[j].setX(x);
|
||||
LineBuf[j].setY(y);
|
||||
j++;
|
||||
}
|
||||
painter1.drawPolyline(LineBuf,j);
|
||||
m_bPaint2=false;
|
||||
}
|
||||
|
||||
painter1.setPen(Qt::white);
|
||||
painter1.drawLine(0,100, m_w,100);
|
||||
if(fast_jh>0) m_jh0=fast_jh;
|
||||
update(); //trigger a new paintEvent
|
||||
}
|
||||
|
||||
void FPlotter::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
QPainter painter(&m_HorizPixmap);
|
||||
int x=event->x();
|
||||
// int y=event->y();
|
||||
float t=x/m_pixPerSecond;
|
||||
QString t1;
|
||||
t1.sprintf("%5.2f",t);
|
||||
QRectF rect0(78,85,40,13); //### Should use font metrics ###
|
||||
painter.fillRect(rect0,Qt::black);
|
||||
painter.setPen(Qt::yellow);
|
||||
painter.drawText(80,95,t1);
|
||||
update();
|
||||
}
|
||||
|
||||
void FPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent
|
||||
{
|
||||
if(m_mode=="MSK144") return;
|
||||
int x=event->x();
|
||||
int y=event->y();
|
||||
int n=event->button();
|
||||
// bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
QPainter painter(&m_HorizPixmap);
|
||||
int x0=x-n*m_pixPerSecond;
|
||||
int x1=x+n*m_pixPerSecond;
|
||||
int xmax=m_TRperiod*m_pixPerSecond;
|
||||
if(x0 < 0) x0=0;
|
||||
if(x1 > xmax) x1=xmax;
|
||||
if(x1 > 702) x1=702;
|
||||
Q_EMIT fastPick (x0,x1,y);
|
||||
int y0=64;
|
||||
if(y >= 120) y0+=100;
|
||||
if(m_x0+m_x1 != 0) {
|
||||
painter.setPen(Qt::black);
|
||||
painter.drawLine(m_x0,m_y0,m_x1,m_y0); //Erase previous yellow line
|
||||
painter.drawLine(m_x0,m_y0-3,m_x0,m_y0+3);
|
||||
painter.drawLine(m_x1,m_y0-3,m_x1,m_y0+3);
|
||||
}
|
||||
painter.setPen(Qt::yellow);
|
||||
painter.drawLine(x0,y0,x1,y0); //Draw yellow line
|
||||
painter.drawLine(x0,y0-3,x0,y0+3);
|
||||
painter.drawLine(x1,y0-3,x1,y0+3);
|
||||
update(); //trigger a new paintEvent
|
||||
m_x0=x0;
|
||||
m_x1=x1;
|
||||
m_y0=y0;
|
||||
}
|
||||
|
||||
void FPlotter::setMode(QString mode) //setMode
|
||||
{
|
||||
m_mode=mode;
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// poly_function_funop.hpp
|
||||
// Contains overloads of poly_function\<\>::operator()
|
||||
//
|
||||
// Copyright 2008 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)
|
||||
template<typename This , typename A0>
|
||||
struct result<This(A0)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1>
|
||||
struct result<This(A0 , A1)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2>
|
||||
struct result<This(A0 , A1 , A2)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3>
|
||||
struct result<This(A0 , A1 , A2 , A3)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type , typename normalize_arg<A4 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3) , static_cast<typename normalize_arg<A4 const &> ::reference>(a4));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type , typename normalize_arg<A4 >::type , typename normalize_arg<A5 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3) , static_cast<typename normalize_arg<A4 const &> ::reference>(a4) , static_cast<typename normalize_arg<A5 const &> ::reference>(a5));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type , typename normalize_arg<A4 >::type , typename normalize_arg<A5 >::type , typename normalize_arg<A6 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3) , static_cast<typename normalize_arg<A4 const &> ::reference>(a4) , static_cast<typename normalize_arg<A5 const &> ::reference>(a5) , static_cast<typename normalize_arg<A6 const &> ::reference>(a6));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type , typename normalize_arg<A4 >::type , typename normalize_arg<A5 >::type , typename normalize_arg<A6 >::type , typename normalize_arg<A7 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const & , A7 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const & , A7 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3) , static_cast<typename normalize_arg<A4 const &> ::reference>(a4) , static_cast<typename normalize_arg<A5 const &> ::reference>(a5) , static_cast<typename normalize_arg<A6 const &> ::reference>(a6) , static_cast<typename normalize_arg<A7 const &> ::reference>(a7));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type , typename normalize_arg<A4 >::type , typename normalize_arg<A5 >::type , typename normalize_arg<A6 >::type , typename normalize_arg<A7 >::type , typename normalize_arg<A8 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const & , A7 const & , A8 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7 , A8 const &a8) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const & , A7 const & , A8 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3) , static_cast<typename normalize_arg<A4 const &> ::reference>(a4) , static_cast<typename normalize_arg<A5 const &> ::reference>(a5) , static_cast<typename normalize_arg<A6 const &> ::reference>(a6) , static_cast<typename normalize_arg<A7 const &> ::reference>(a7) , static_cast<typename normalize_arg<A8 const &> ::reference>(a8));
|
||||
}
|
||||
template<typename This , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
||||
: Derived::template impl<
|
||||
typename normalize_arg<A0 >::type , typename normalize_arg<A1 >::type , typename normalize_arg<A2 >::type , typename normalize_arg<A3 >::type , typename normalize_arg<A4 >::type , typename normalize_arg<A5 >::type , typename normalize_arg<A6 >::type , typename normalize_arg<A7 >::type , typename normalize_arg<A8 >::type , typename normalize_arg<A9 >::type
|
||||
>
|
||||
{
|
||||
typedef typename result::result_type type;
|
||||
};
|
||||
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
typename result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const & , A7 const & , A8 const & , A9 const &
|
||||
)
|
||||
>::type
|
||||
operator ()(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7 , A8 const &a8 , A9 const &a9) const
|
||||
{
|
||||
result<
|
||||
Derived const(
|
||||
A0 const & , A1 const & , A2 const & , A3 const & , A4 const & , A5 const & , A6 const & , A7 const & , A8 const & , A9 const &
|
||||
)
|
||||
> impl;
|
||||
return impl(static_cast<typename normalize_arg<A0 const &> ::reference>(a0) , static_cast<typename normalize_arg<A1 const &> ::reference>(a1) , static_cast<typename normalize_arg<A2 const &> ::reference>(a2) , static_cast<typename normalize_arg<A3 const &> ::reference>(a3) , static_cast<typename normalize_arg<A4 const &> ::reference>(a4) , static_cast<typename normalize_arg<A5 const &> ::reference>(a5) , static_cast<typename normalize_arg<A6 const &> ::reference>(a6) , static_cast<typename normalize_arg<A7 const &> ::reference>(a7) , static_cast<typename normalize_arg<A8 const &> ::reference>(a8) , static_cast<typename normalize_arg<A9 const &> ::reference>(a9));
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
#include <QMessageBox>
|
||||
#include <QMetaEnum>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
#define NPTS 3456
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setGeometry(400, 250, 542, 390);
|
||||
|
||||
setupPlot();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::setupPlot()
|
||||
{
|
||||
plotspec(ui->customPlot);
|
||||
setWindowTitle("Reference Spectrum");
|
||||
statusBar()->clearMessage();
|
||||
ui->customPlot->replot();
|
||||
}
|
||||
|
||||
void MainWindow::plotspec(QCustomPlot *customPlot)
|
||||
{
|
||||
QVector<double> x(NPTS), y1(NPTS), y2(NPTS), y3(NPTS), y4(NPTS);
|
||||
ifstream inFile;
|
||||
double ymin=1.0e30;
|
||||
double ymax=-ymin;
|
||||
inFile.open("c:/users/joe/appdata/local/WSJT-X/refspec.dat");
|
||||
|
||||
for (int i = 0; i < NPTS; i++) {
|
||||
inFile >> x[i] >> y1[i] >> y2[i] >> y3[3] >> y4[4];
|
||||
if(y2[i]>ymax) ymax=y2[i];
|
||||
if(y2[i]<ymin) ymin=y2[i];
|
||||
}
|
||||
|
||||
customPlot->addGraph();
|
||||
customPlot->graph(0)->setData(x, y2);
|
||||
customPlot->xAxis->setLabel("Frequency (Hz)");
|
||||
customPlot->yAxis->setLabel("Relative power (dB)");
|
||||
customPlot->xAxis->setRange(0, 6000);
|
||||
customPlot->yAxis->setRange(ymin, ymax);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// get_process_times.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GET_PROCESS_TIMES_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GET_PROCESS_TIMES_HPP
|
||||
|
||||
#include <boost/detail/winapi/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// Windows CE does not define GetProcessTimes
|
||||
#if !defined( UNDER_CE )
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/time.hpp>
|
||||
|
||||
#if !defined( BOOST_USE_WINDOWS_H )
|
||||
extern "C" {
|
||||
BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
|
||||
GetProcessTimes(
|
||||
boost::detail::winapi::HANDLE_ hProcess,
|
||||
::_FILETIME* lpCreationTime,
|
||||
::_FILETIME* lpExitTime,
|
||||
::_FILETIME* lpKernelTime,
|
||||
::_FILETIME* lpUserTime);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
|
||||
BOOST_FORCEINLINE BOOL_ GetProcessTimes(
|
||||
HANDLE_ hProcess,
|
||||
LPFILETIME_ lpCreationTime,
|
||||
LPFILETIME_ lpExitTime,
|
||||
LPFILETIME_ lpKernelTime,
|
||||
LPFILETIME_ lpUserTime)
|
||||
{
|
||||
return ::GetProcessTimes(
|
||||
hProcess,
|
||||
reinterpret_cast< ::_FILETIME* >(lpCreationTime),
|
||||
reinterpret_cast< ::_FILETIME* >(lpExitTime),
|
||||
reinterpret_cast< ::_FILETIME* >(lpKernelTime),
|
||||
reinterpret_cast< ::_FILETIME* >(lpUserTime));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !defined( UNDER_CE )
|
||||
#endif // BOOST_DETAIL_WINAPI_GET_PROCESS_TIMES_HPP
|
||||
@@ -0,0 +1,486 @@
|
||||
|
||||
// Copyright Peter Dimov 2001
|
||||
// Copyright Aleksey Gurtovoy 2001-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)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/aux_/basic_bind.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
template< bool >
|
||||
struct resolve_arg_impl
|
||||
{
|
||||
template<
|
||||
typename T, typename U1, typename U2, typename U3
|
||||
, typename U4, typename U5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct resolve_arg_impl<true>
|
||||
{
|
||||
template<
|
||||
typename T, typename U1, typename U2, typename U3
|
||||
, typename U4, typename U5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef typename apply_wrap5<
|
||||
T
|
||||
, U1, U2, U3, U4, U5
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct is_bind_template;
|
||||
|
||||
template<
|
||||
typename T, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg
|
||||
: resolve_arg_impl< is_bind_template<T>::value >
|
||||
::template result_< T,U1,U2,U3,U4,U5 >
|
||||
{
|
||||
};
|
||||
|
||||
template< int arity_ > struct bind_chooser;
|
||||
|
||||
aux::no_tag is_bind_helper(...);
|
||||
template< typename T > aux::no_tag is_bind_helper(protect<T>*);
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
aux::yes_tag is_bind_helper(bind< F,T1,T2,T3,T4,T5 >*);
|
||||
|
||||
template< int N >
|
||||
aux::yes_tag is_bind_helper(arg<N>*);
|
||||
|
||||
template< bool is_ref_ = true >
|
||||
struct is_bind_template_impl
|
||||
{
|
||||
template< typename T > struct result_
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_bind_template_impl<false>
|
||||
{
|
||||
template< typename T > struct result_
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof(aux::is_bind_helper(static_cast<T*>(0)))
|
||||
== sizeof(aux::yes_tag)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct is_bind_template
|
||||
: is_bind_template_impl< ::boost::detail::is_reference_impl<T>::value >
|
||||
::template result_<T>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct bind0
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap0<
|
||||
f_
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
aux::yes_tag
|
||||
is_bind_helper(bind0<F>*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<>
|
||||
struct bind_chooser<0>
|
||||
{
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef bind0<F> type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct bind1
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap1<
|
||||
f_
|
||||
, typename t1::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
aux::yes_tag
|
||||
is_bind_helper(bind1< F,T1 >*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<>
|
||||
struct bind_chooser<1>
|
||||
{
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef bind1< F,T1 > type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct bind2
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap2<
|
||||
f_
|
||||
, typename t1::type, typename t2::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
aux::yes_tag
|
||||
is_bind_helper(bind2< F,T1,T2 >*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<>
|
||||
struct bind_chooser<2>
|
||||
{
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef bind2< F,T1,T2 > type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind3
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap3<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
aux::yes_tag
|
||||
is_bind_helper(bind3< F,T1,T2,T3 >*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<>
|
||||
struct bind_chooser<3>
|
||||
{
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef bind3< F,T1,T2,T3 > type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct bind4
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap4<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
aux::yes_tag
|
||||
is_bind_helper(bind4< F,T1,T2,T3,T4 >*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<>
|
||||
struct bind_chooser<4>
|
||||
{
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef bind4< F,T1,T2,T3,T4 > type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct bind5
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap5<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type, typename t5::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
aux::yes_tag
|
||||
is_bind_helper(bind5< F,T1,T2,T3,T4,T5 >*);
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<>
|
||||
struct bind_chooser<5>
|
||||
{
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef bind5< F,T1,T2,T3,T4,T5 > type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< typename T >
|
||||
struct is_bind_arg
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_bind_arg<na>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template<
|
||||
typename T1, typename T2, typename T3, typename T4, typename T5
|
||||
>
|
||||
struct bind_count_args
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, value =
|
||||
is_bind_arg<T1>::value + is_bind_arg<T2>::value
|
||||
+ is_bind_arg<T3>::value + is_bind_arg<T4>::value
|
||||
+ is_bind_arg<T5>::value
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct bind
|
||||
: aux::bind_chooser<
|
||||
aux::bind_count_args< T1,T2,T3,T4,T5 >::value
|
||||
>::template result_< F,T1,T2,T3,T4,T5 >::type
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(
|
||||
6
|
||||
, bind
|
||||
)
|
||||
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(
|
||||
6
|
||||
, bind
|
||||
)
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
|
||||
// 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)
|
||||
|
||||
// Authors: Matthias Troyer
|
||||
|
||||
#ifndef BOOST_MPI_DETAIL_MPI_DATATYPE_OPRIMITIVE_HPP
|
||||
#define BOOST_MPI_DETAIL_MPI_DATATYPE_OPRIMITIVE_HPP
|
||||
|
||||
#include <boost/mpi/config.hpp>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/mpi/datatype_fwd.hpp>
|
||||
#include <boost/mpi/exception.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/detail/get_data.hpp>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
namespace boost { namespace mpi { namespace detail {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class mpi_data_type_oprimitive - creation of custom MPI data types
|
||||
|
||||
class mpi_datatype_primitive
|
||||
{
|
||||
public:
|
||||
|
||||
// trivial default constructor
|
||||
mpi_datatype_primitive()
|
||||
: is_committed(false),
|
||||
origin(0)
|
||||
{}
|
||||
|
||||
mpi_datatype_primitive(void const* orig)
|
||||
: is_committed(false),
|
||||
origin()
|
||||
{
|
||||
#if defined(MPI_VERSION) && MPI_VERSION >= 2
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Get_address,(const_cast<void*>(orig), &origin));
|
||||
#else
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Address,(const_cast<void*>(orig), &origin));
|
||||
#endif
|
||||
}
|
||||
|
||||
void save_binary(void const *address, std::size_t count)
|
||||
{
|
||||
save_impl(address,MPI_BYTE,count);
|
||||
}
|
||||
|
||||
// fast saving of arrays of MPI types
|
||||
template<class T>
|
||||
void save_array(serialization::array_wrapper<T> const& x, unsigned int /* version */)
|
||||
{
|
||||
if (x.count())
|
||||
save_impl(x.address(), boost::mpi::get_mpi_datatype(*x.address()), x.count());
|
||||
}
|
||||
|
||||
typedef is_mpi_datatype<mpl::_1> use_array_optimization;
|
||||
|
||||
// create and return the custom MPI data type
|
||||
MPI_Datatype get_mpi_datatype()
|
||||
{
|
||||
if (!is_committed)
|
||||
{
|
||||
#if defined(MPI_VERSION) && MPI_VERSION >= 2
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_create_struct,
|
||||
(
|
||||
addresses.size(),
|
||||
boost::serialization::detail::get_data(lengths),
|
||||
boost::serialization::detail::get_data(addresses),
|
||||
boost::serialization::detail::get_data(types),
|
||||
&datatype_
|
||||
));
|
||||
#else
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_struct,
|
||||
(
|
||||
addresses.size(),
|
||||
boost::serialization::detail::get_data(lengths),
|
||||
boost::serialization::detail::get_data(addresses),
|
||||
boost::serialization::detail::get_data(types),
|
||||
&datatype_
|
||||
));
|
||||
#endif
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Type_commit,(&datatype_));
|
||||
|
||||
is_committed = true;
|
||||
}
|
||||
|
||||
return datatype_;
|
||||
}
|
||||
|
||||
// default saving of primitives.
|
||||
template<class T>
|
||||
void save(const T & t)
|
||||
{
|
||||
save_impl(&t, boost::mpi::get_mpi_datatype(t), 1);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void save_impl(void const * p, MPI_Datatype t, int l)
|
||||
{
|
||||
BOOST_ASSERT ( !is_committed );
|
||||
|
||||
// store address, type and length
|
||||
|
||||
MPI_Aint a;
|
||||
#if defined(MPI_VERSION) && MPI_VERSION >= 2
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Get_address,(const_cast<void*>(p), &a));
|
||||
#else
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Address,(const_cast<void*>(p), &a));
|
||||
#endif
|
||||
addresses.push_back(a-origin);
|
||||
types.push_back(t);
|
||||
lengths.push_back(l);
|
||||
}
|
||||
|
||||
std::vector<MPI_Aint> addresses;
|
||||
std::vector<MPI_Datatype> types;
|
||||
std::vector<int> lengths;
|
||||
|
||||
bool is_committed;
|
||||
MPI_Datatype datatype_;
|
||||
MPI_Aint origin;
|
||||
};
|
||||
|
||||
|
||||
} } } // end namespace boost::mpi::detail
|
||||
|
||||
|
||||
#endif // BOOST_MPI_DETAIL_MPI_DATATYPE_OPRIMITIVE_HPP
|
||||
@@ -0,0 +1,62 @@
|
||||
/*=============================================================================
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CONVERT_ITERATOR_05062005_1218)
|
||||
#define FUSION_CONVERT_ITERATOR_05062005_1218
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/is_iterator.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct mpl_iterator; // forward declaration
|
||||
|
||||
// Test T. If it is a fusion iterator, return a reference to it.
|
||||
// else, assume it is an mpl iterator.
|
||||
|
||||
template <typename T>
|
||||
struct convert_iterator
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_fusion_iterator<T>
|
||||
, T
|
||||
, mpl_iterator<T>
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static T const&
|
||||
call(T const& x, mpl::true_)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static mpl_iterator<T>
|
||||
call(T const& /*x*/, mpl::false_)
|
||||
{
|
||||
return mpl_iterator<T>();
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename
|
||||
mpl::if_<
|
||||
is_fusion_iterator<T>
|
||||
, T const&
|
||||
, mpl_iterator<T>
|
||||
>::type
|
||||
call(T const& x)
|
||||
{
|
||||
return call(x, is_fusion_iterator<T>());
|
||||
}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,229 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2009 Sebastian Redl
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_PROPERTY_TREE_STREAM_TRANSLATOR_HPP_INCLUDED
|
||||
#define BOOST_PROPERTY_TREE_STREAM_TRANSLATOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <locale>
|
||||
#include <limits>
|
||||
|
||||
namespace boost { namespace property_tree
|
||||
{
|
||||
|
||||
template <typename Ch, typename Traits, typename E, typename Enabler = void>
|
||||
struct customize_stream
|
||||
{
|
||||
static void insert(std::basic_ostream<Ch, Traits>& s, const E& e) {
|
||||
s << e;
|
||||
}
|
||||
static void extract(std::basic_istream<Ch, Traits>& s, E& e) {
|
||||
s >> e;
|
||||
if(!s.eof()) {
|
||||
s >> std::ws;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// No whitespace skipping for single characters.
|
||||
template <typename Ch, typename Traits>
|
||||
struct customize_stream<Ch, Traits, Ch, void>
|
||||
{
|
||||
static void insert(std::basic_ostream<Ch, Traits>& s, Ch e) {
|
||||
s << e;
|
||||
}
|
||||
static void extract(std::basic_istream<Ch, Traits>& s, Ch& e) {
|
||||
s.unsetf(std::ios_base::skipws);
|
||||
s >> e;
|
||||
}
|
||||
};
|
||||
|
||||
// Ugly workaround for numeric_traits that don't have members when not
|
||||
// specialized, e.g. MSVC.
|
||||
namespace detail
|
||||
{
|
||||
template <bool is_specialized>
|
||||
struct is_inexact_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct test
|
||||
{
|
||||
typedef boost::false_type type;
|
||||
};
|
||||
};
|
||||
template <>
|
||||
struct is_inexact_impl<true>
|
||||
{
|
||||
template <typename T>
|
||||
struct test
|
||||
{
|
||||
typedef boost::integral_constant<bool,
|
||||
!std::numeric_limits<T>::is_exact> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename F>
|
||||
struct is_inexact
|
||||
{
|
||||
typedef typename boost::decay<F>::type decayed;
|
||||
typedef typename is_inexact_impl<
|
||||
std::numeric_limits<decayed>::is_specialized
|
||||
>::BOOST_NESTED_TEMPLATE test<decayed>::type type;
|
||||
static const bool value = type::value;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Ch, typename Traits, typename F>
|
||||
struct customize_stream<Ch, Traits, F,
|
||||
typename boost::enable_if< detail::is_inexact<F> >::type
|
||||
>
|
||||
{
|
||||
static void insert(std::basic_ostream<Ch, Traits>& s, const F& e) {
|
||||
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
s.precision(std::numeric_limits<F>::max_digits10);
|
||||
#else
|
||||
s.precision(std::numeric_limits<F>::digits10 + 2);
|
||||
#endif
|
||||
s << e;
|
||||
}
|
||||
static void extract(std::basic_istream<Ch, Traits>& s, F& e) {
|
||||
s >> e;
|
||||
if(!s.eof()) {
|
||||
s >> std::ws;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Ch, typename Traits>
|
||||
struct customize_stream<Ch, Traits, bool, void>
|
||||
{
|
||||
static void insert(std::basic_ostream<Ch, Traits>& s, bool e) {
|
||||
s.setf(std::ios_base::boolalpha);
|
||||
s << e;
|
||||
}
|
||||
static void extract(std::basic_istream<Ch, Traits>& s, bool& e) {
|
||||
s >> e;
|
||||
if(s.fail()) {
|
||||
// Try again in word form.
|
||||
s.clear();
|
||||
s.setf(std::ios_base::boolalpha);
|
||||
s >> e;
|
||||
}
|
||||
if(!s.eof()) {
|
||||
s >> std::ws;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Ch, typename Traits>
|
||||
struct customize_stream<Ch, Traits, signed char, void>
|
||||
{
|
||||
static void insert(std::basic_ostream<Ch, Traits>& s, signed char e) {
|
||||
s << (int)e;
|
||||
}
|
||||
static void extract(std::basic_istream<Ch, Traits>& s, signed char& e) {
|
||||
int i;
|
||||
s >> i;
|
||||
// out of range?
|
||||
if(i > (std::numeric_limits<signed char>::max)() ||
|
||||
i < (std::numeric_limits<signed char>::min)())
|
||||
{
|
||||
s.clear(); // guarantees eof to be unset
|
||||
e = 0;
|
||||
s.setstate(std::ios_base::badbit);
|
||||
return;
|
||||
}
|
||||
e = (signed char)i;
|
||||
if(!s.eof()) {
|
||||
s >> std::ws;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Ch, typename Traits>
|
||||
struct customize_stream<Ch, Traits, unsigned char, void>
|
||||
{
|
||||
static void insert(std::basic_ostream<Ch, Traits>& s, unsigned char e) {
|
||||
s << (unsigned)e;
|
||||
}
|
||||
static void extract(std::basic_istream<Ch,Traits>& s, unsigned char& e){
|
||||
unsigned i;
|
||||
s >> i;
|
||||
// out of range?
|
||||
if(i > (std::numeric_limits<unsigned char>::max)()) {
|
||||
s.clear(); // guarantees eof to be unset
|
||||
e = 0;
|
||||
s.setstate(std::ios_base::badbit);
|
||||
return;
|
||||
}
|
||||
e = (unsigned char)i;
|
||||
if(!s.eof()) {
|
||||
s >> std::ws;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// Implementation of Translator that uses the stream overloads.
|
||||
template <typename Ch, typename Traits, typename Alloc, typename E>
|
||||
class stream_translator
|
||||
{
|
||||
typedef customize_stream<Ch, Traits, E> customized;
|
||||
public:
|
||||
typedef std::basic_string<Ch, Traits, Alloc> internal_type;
|
||||
typedef E external_type;
|
||||
|
||||
explicit stream_translator(std::locale loc = std::locale())
|
||||
: m_loc(loc)
|
||||
{}
|
||||
|
||||
boost::optional<E> get_value(const internal_type &v) {
|
||||
std::basic_istringstream<Ch, Traits, Alloc> iss(v);
|
||||
iss.imbue(m_loc);
|
||||
E e;
|
||||
customized::extract(iss, e);
|
||||
if(iss.fail() || iss.bad() || iss.get() != Traits::eof()) {
|
||||
return boost::optional<E>();
|
||||
}
|
||||
return e;
|
||||
}
|
||||
boost::optional<internal_type> put_value(const E &v) {
|
||||
std::basic_ostringstream<Ch, Traits, Alloc> oss;
|
||||
oss.imbue(m_loc);
|
||||
customized::insert(oss, v);
|
||||
if(oss) {
|
||||
return oss.str();
|
||||
}
|
||||
return boost::optional<internal_type>();
|
||||
}
|
||||
|
||||
private:
|
||||
std::locale m_loc;
|
||||
};
|
||||
|
||||
// This is the default translator when basic_string is the internal type.
|
||||
// Unless the external type is also basic_string, in which case
|
||||
// id_translator takes over.
|
||||
template <typename Ch, typename Traits, typename Alloc, typename E>
|
||||
struct translator_between<std::basic_string<Ch, Traits, Alloc>, E>
|
||||
{
|
||||
typedef stream_translator<Ch, Traits, Alloc, E> type;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
// qra13_64_64_irr_e.h
|
||||
// Code tables and defines for Q-ary RA code (13,64) over GF(64)
|
||||
// Code Name: qra13_64_64_irr_e
|
||||
// (13,64) RA Code over GF(64) RF=[3x4 4x4 6x1 3x2 5x1 7x1]/18
|
||||
|
||||
// (c) 2016 - Nico Palermo - IV3NWV - Microtelecom Srl, Italy
|
||||
|
||||
// This file is part of the qracodes project, a Forward Error Control
|
||||
// encoding/decoding package based on Q-ary RA (Repeat and Accumulate) LDPC codes.
|
||||
//
|
||||
// qracodes is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
// qracodes is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with qracodes source distribution.
|
||||
// If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef _qra13_64_64_irr_e_h
|
||||
#define _qra13_64_64_irr_e_h
|
||||
|
||||
#include "qracodes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const qracode qra_13_64_64_irr_e;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _qra13_64_64_irr_e_h
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* John Maddock
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org/libs/regex for most recent version.
|
||||
* FILE cregex.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares POSIX API functions
|
||||
* + boost::RegEx high level wrapper.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_CREGEX_HPP
|
||||
#define BOOST_RE_CREGEX_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/regex/v4/cregex.hpp>
|
||||
|
||||
#endif /* include guard */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 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 T, typename A0>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0>::type const
|
||||
construct(A0 const& a0)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0>::
|
||||
make(detail::target<T>(), a0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1>::type const
|
||||
construct(A0 const& a0 , A1 const& a1)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1>::
|
||||
make(detail::target<T>(), a0 , a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2>::
|
||||
make(detail::target<T>(), a0 , a1 , a2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
||||
inline
|
||||
typename expression::construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::type const
|
||||
construct(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9)
|
||||
{
|
||||
return
|
||||
expression::
|
||||
construct<detail::target<T>, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>::
|
||||
make(detail::target<T>(), a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
Copyright (c) 2014 John Fletcher
|
||||
|
||||
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_DEBUG_HPP
|
||||
#define BOOST_PHOENIX_CORE_DEBUG_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/phoenix/version.hpp>
|
||||
// Some other things may be needed here...
|
||||
|
||||
// Include all proto for the time being...
|
||||
#include <boost/proto/proto.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
|
||||
// For now just drop through to the Proto versions.
|
||||
|
||||
/// \brief Pretty-print a Phoenix expression tree using the Proto code.
|
||||
///
|
||||
/// \note Equivalent to <tt>functional::display_expr(0, sout)(expr)</tt>
|
||||
/// \param expr The Phoenix expression tree to pretty-print
|
||||
/// \param sout The \c ostream to which the output should be
|
||||
/// written. If not specified, defaults to
|
||||
/// <tt>std::cout</tt>.
|
||||
template<typename Expr>
|
||||
void display_expr(Expr const &expr, std::ostream &sout)
|
||||
{
|
||||
boost::proto::display_expr(expr,sout);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
///
|
||||
template<typename Expr>
|
||||
void display_expr(Expr const &expr)
|
||||
{
|
||||
boost::proto::display_expr(expr);
|
||||
}
|
||||
|
||||
} // namespace phoenix
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
ftrsd2.c
|
||||
|
||||
A soft-decision decoder for the JT65 (63,12) Reed-Solomon code.
|
||||
|
||||
This decoding scheme is built around Phil Karn's Berlekamp-Massey
|
||||
errors and erasures decoder. The approach is inspired by a number of
|
||||
publications, including the stochastic Chase decoder described
|
||||
in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al.,
|
||||
IEEE Communications Letters, Vol. 14, No. 9, September 2010 and
|
||||
"Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error-
|
||||
and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar.
|
||||
|
||||
Steve Franke K9AN and Joe Taylor K1JT
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "rs2.h"
|
||||
|
||||
static void *rs;
|
||||
void getpp_(int workdat[], float *pp);
|
||||
|
||||
void ftrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[],
|
||||
int* ntrials0, int correct[], int param[], int ntry[])
|
||||
{
|
||||
int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63];
|
||||
int workdat[63];
|
||||
int indexes[63];
|
||||
int era_pos[51];
|
||||
int i, j, numera, nerr, nn=63;
|
||||
int ntrials = *ntrials0;
|
||||
int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768;
|
||||
int ntotal=0,ntotal_min=32768,ncandidates;
|
||||
int nera_best=0;
|
||||
float pp,pp1,pp2;
|
||||
static unsigned int nseed;
|
||||
|
||||
// Power-percentage symbol metrics - composite gnnf/hf
|
||||
int perr[8][8] = {
|
||||
{ 4, 9, 11, 13, 14, 14, 15, 15},
|
||||
{ 2, 20, 20, 30, 40, 50, 50, 50},
|
||||
{ 7, 24, 27, 40, 50, 50, 50, 50},
|
||||
{13, 25, 35, 46, 52, 70, 50, 50},
|
||||
{17, 30, 42, 54, 55, 64, 71, 70},
|
||||
{25, 39, 48, 57, 64, 66, 77, 77},
|
||||
{32, 45, 54, 63, 66, 75, 78, 83},
|
||||
{51, 58, 57, 66, 72, 77, 82, 86}};
|
||||
|
||||
|
||||
// Initialize the KA9Q Reed-Solomon encoder/decoder
|
||||
unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51;
|
||||
rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0);
|
||||
|
||||
// Reverse the received symbol vectors for BM decoder
|
||||
for (i=0; i<63; i++) {
|
||||
rxdat[i]=mrsym[62-i];
|
||||
rxprob[i]=mrprob[62-i];
|
||||
rxdat2[i]=mr2sym[62-i];
|
||||
rxprob2[i]=mr2prob[62-i];
|
||||
}
|
||||
|
||||
// Sort rxprob to find indexes of the least reliable symbols
|
||||
int k, pass, tmp, nsym=63;
|
||||
int probs[63];
|
||||
for (i=0; i<63; i++) {
|
||||
indexes[i]=i;
|
||||
probs[i]=rxprob[i];
|
||||
}
|
||||
for (pass = 1; pass <= nsym-1; pass++) {
|
||||
for (k = 0; k < nsym - pass; k++) {
|
||||
if( probs[k] < probs[k+1] ) {
|
||||
tmp = probs[k];
|
||||
probs[k] = probs[k+1];
|
||||
probs[k+1] = tmp;
|
||||
tmp = indexes[k];
|
||||
indexes[k] = indexes[k+1];
|
||||
indexes[k+1] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// See if we can decode using BM HDD, and calculate the syndrome vector.
|
||||
memset(era_pos,0,51*sizeof(int));
|
||||
numera=0;
|
||||
memcpy(workdat,rxdat,sizeof(rxdat));
|
||||
nerr=decode_rs_int(rs,workdat,era_pos,numera,1);
|
||||
if( nerr >= 0 ) {
|
||||
// Hard-decision decoding succeeded. Save codeword and some parameters.
|
||||
nhard=0;
|
||||
for (i=0; i<63; i++) {
|
||||
if( workdat[i] != rxdat[i] ) nhard=nhard+1;
|
||||
}
|
||||
memcpy(correct,workdat,63*sizeof(int));
|
||||
param[0]=0;
|
||||
param[1]=nhard;
|
||||
param[2]=0;
|
||||
param[3]=0;
|
||||
param[4]=0;
|
||||
param[5]=0;
|
||||
param[7]=1000*1000;
|
||||
ntry[0]=0;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Hard-decision decoding failed. Try the FT soft-decision method.
|
||||
Generate random erasure-locator vectors and see if any of them
|
||||
decode. This will generate a list of "candidate" codewords. The
|
||||
soft distance between each candidate codeword and the received
|
||||
word is estimated by finding the largest (pp1) and second-largest
|
||||
(pp2) outputs from a synchronized filter-bank operating on the
|
||||
symbol spectra, and using these to decide which candidate
|
||||
codeword is "best".
|
||||
*/
|
||||
|
||||
nseed=1; //Seed for random numbers
|
||||
float ratio;
|
||||
int thresh, nsum;
|
||||
int thresh0[63];
|
||||
ncandidates=0;
|
||||
nsum=0;
|
||||
int ii,jj;
|
||||
for (i=0; i<nn; i++) {
|
||||
nsum=nsum+rxprob[i];
|
||||
j = indexes[62-i];
|
||||
ratio = (float)rxprob2[j]/((float)rxprob[j]+0.01);
|
||||
ii = 7.999*ratio;
|
||||
jj = (62-i)/8;
|
||||
thresh0[i] = 1.3*perr[ii][jj];
|
||||
}
|
||||
if(nsum<=0) return;
|
||||
|
||||
pp1=0.0;
|
||||
pp2=0.0;
|
||||
for (k=1; k<=ntrials; k++) {
|
||||
memset(era_pos,0,51*sizeof(int));
|
||||
memcpy(workdat,rxdat,sizeof(rxdat));
|
||||
|
||||
/*
|
||||
Mark a subset of the symbols as erasures.
|
||||
Run through the ranked symbols, starting with the worst, i=0.
|
||||
NB: j is the symbol-vector index of the symbol with rank i.
|
||||
*/
|
||||
numera=0;
|
||||
for (i=0; i<nn; i++) {
|
||||
j = indexes[62-i];
|
||||
thresh=thresh0[i];
|
||||
long int ir;
|
||||
|
||||
// Generate a random number ir, 0 <= ir < 100 (see POSIX.1-2001 example).
|
||||
nseed = nseed * 1103515245 + 12345;
|
||||
ir = (unsigned)(nseed/65536) % 32768;
|
||||
ir = (100*ir)/32768;
|
||||
|
||||
if((ir < thresh ) && numera < 51) {
|
||||
era_pos[numera]=j;
|
||||
numera=numera+1;
|
||||
}
|
||||
}
|
||||
|
||||
nerr=decode_rs_int(rs,workdat,era_pos,numera,0);
|
||||
if( nerr >= 0 ) {
|
||||
// We have a candidate codeword. Find its hard and soft distance from
|
||||
// the received word. Also find pp1 and pp2 from the full array
|
||||
// s3(64,63) of synchronized symbol spectra.
|
||||
ncandidates=ncandidates+1;
|
||||
nhard=0;
|
||||
nsoft=0;
|
||||
for (i=0; i<63; i++) {
|
||||
if(workdat[i] != rxdat[i]) {
|
||||
nhard=nhard+1;
|
||||
if(workdat[i] != rxdat2[i]) {
|
||||
nsoft=nsoft+rxprob[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
nsoft=63*nsoft/nsum;
|
||||
ntotal=nsoft+nhard;
|
||||
|
||||
getpp_(workdat,&pp);
|
||||
if(pp>pp1) {
|
||||
pp2=pp1;
|
||||
pp1=pp;
|
||||
nsoft_min=nsoft;
|
||||
nhard_min=nhard;
|
||||
ntotal_min=ntotal;
|
||||
memcpy(correct,workdat,63*sizeof(int));
|
||||
nera_best=numera;
|
||||
ntry[0]=k;
|
||||
} else {
|
||||
if(pp>pp2 && pp!=pp1) pp2=pp;
|
||||
}
|
||||
if(nhard_min <= 41 && ntotal_min <= 71) break;
|
||||
}
|
||||
if(k == ntrials) ntry[0]=k;
|
||||
}
|
||||
|
||||
param[0]=ncandidates;
|
||||
param[1]=nhard_min;
|
||||
param[2]=nsoft_min;
|
||||
param[3]=nera_best;
|
||||
param[4]=1000.0*pp2/pp1;
|
||||
param[5]=ntotal_min;
|
||||
param[6]=ntry[0];
|
||||
param[7]=1000.0*pp2;
|
||||
param[8]=1000.0*pp1;
|
||||
if(param[0]==0) param[2]=-1;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
#ifndef BOOST_MPL_LIST_AUX_NODE_HPP_INCLUDED
|
||||
#define BOOST_MPL_LIST_AUX_NODE_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-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$
|
||||
|
||||
#include <boost/mpl/long.hpp>
|
||||
#include <boost/mpl/list/aux_/tag.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Size
|
||||
, typename T
|
||||
, typename Next
|
||||
>
|
||||
struct l_item
|
||||
{
|
||||
// agurt, 17/jul/03: to facilitate the deficient 'is_sequence' implementation
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
typedef int begin;
|
||||
#endif
|
||||
typedef aux::list_tag tag;
|
||||
typedef l_item type;
|
||||
|
||||
typedef Size size;
|
||||
typedef T item;
|
||||
typedef Next next;
|
||||
};
|
||||
|
||||
struct l_end
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
typedef int begin;
|
||||
#endif
|
||||
typedef aux::list_tag tag;
|
||||
typedef l_end type;
|
||||
typedef long_<0> size;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_LIST_AUX_NODE_HPP_INCLUDED
|
||||
@@ -0,0 +1,43 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// format_fwd.hpp : forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Copyright Samuel Krempp 2003. 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/format for library home page
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FORMAT_FWD_HPP
|
||||
#define BOOST_FORMAT_FWD_HPP
|
||||
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
|
||||
#include <boost/format/detail/compat_workarounds.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class Ch,
|
||||
class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> >
|
||||
class basic_format;
|
||||
|
||||
typedef basic_format<char > format;
|
||||
|
||||
#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF)
|
||||
typedef basic_format<wchar_t > wformat;
|
||||
#endif
|
||||
|
||||
namespace io {
|
||||
enum format_error_bits { bad_format_string_bit = 1,
|
||||
too_few_args_bit = 2, too_many_args_bit = 4,
|
||||
out_of_range_bit = 8,
|
||||
all_error_bits = 255, no_error_bits=0 };
|
||||
|
||||
} // namespace io
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_FORMAT_FWD_HPP
|
||||
Reference in New Issue
Block a user