Brief description of class still missing. More...
#include <FKArrayMap.h>
Public Member Functions | |
| void | addSource () |
| FKArrayMap () | |
| void | removeSource (int index) |
| void | setSourceSignals (int iSrc, const SourceParameters &src, const MediumParameters &medium) |
| void | setStations (const QVector< Point2D > &p) |
| void | setStationSignals () |
| int | sourceCount () const |
| double | theoreticalKmax () const |
| virtual double | value (double kx, double ky) const |
| ~FKArrayMap () | |
Brief description of class still missing.
Full description of class still missing
| void FKArrayMap::addSource | ( | ) |
References TRACE.
Referenced by Simulator::on_addSource_clicked().
{
TRACE;
int nSrc=_sourceSig.count();
_sourceSig.resize(nSrc+1);
QVector<Complex>& sig=_sourceSig[nSrc];
int ns=_stations.count();
sig.resize(_stations.count());
for(int is=0;is < ns;is++ ) sig[ is ]=0;
}
| void FKArrayMap::removeSource | ( | int | index | ) |
References TRACE.
Referenced by Simulator::on_removeSource_clicked().
{
TRACE;
int nSrc=_sourceSig.count();
if(index>=nSrc) return;
QVector<Complex>& sig=_sourceSig[index];
int ns=_stations.count();
for(int is=0;is < ns;is++ ) _stationSig[ is ] -= sig[is];
_sourceSig.remove(index);
}
| void FKArrayMap::setSourceSignals | ( | int | iSrc, |
| const SourceParameters & | src, | ||
| const MediumParameters & | medium | ||
| ) |
References SourceParameters::amplitude(), MediumParameters::attenuation(), SourceParameters::azimuthMath(), QGpCoreTools::Point2D::azimuthTo(), QGpCoreTools::cos(), QGpCoreTools::Point::distanceTo(), QGpCoreTools::Point2D::distanceTo(), QGpCoreTools::exp(), MediumParameters::frequency(), SourceParameters::phase(), SourceParameters::PlaneWaves, SourceParameters::sourcePoint(), TRACE, SourceParameters::type(), and SourceParameters::velocity().
Referenced by Simulator::setAllSources().
{
TRACE;
int ns=_stations.count();
double k=2.0*M_PI*medium.frequency()/src.velocity();
QVector<Complex>& sig=_sourceSig[iSrc];
if(src.type()==SourceParameters::PlaneWaves) {
for(int is=0;is < ns;is++ ) {
double az=Point().azimuthTo(_stations[ is ]);
double r=Point().distanceTo(_stations[ is ])*cos(az-src.azimuthMath());
sig[is].setExp(src.amplitude(), src.phase()-k*r);
}
} else {
if(medium.attenuation()==0.0) {
for(int is=0;is < ns;is++ ) {
double r=src.sourcePoint().distanceTo(_stations[ is ]);
sig[is].setExp(src.amplitude(), src.phase()-k*r);
}
} else {
double inv2Qk=k/(2.0*medium.attenuation());
for(int is=0;is < ns;is++ ) {
double r=src.sourcePoint().distanceTo(_stations[ is ]);
sig[is].setExp(src.amplitude()/(2.0*M_PI*r) * exp(-r*inv2Qk), src.phase()-k*r);
}
}
}
}
| void FKArrayMap::setStations | ( | const QVector< Point2D > & | p | ) |
References TRACE.
Referenced by Simulator::init().
{
TRACE;
_stations=p;
uniquePoints();
int ns=p.count();
_stationSig.resize(ns);
int nSrc=_sourceSig.count();
for(int i=0; i<nSrc;i++) {
_sourceSig[i].resize(ns);
}
}
| void FKArrayMap::setStationSignals | ( | ) |
References TRACE.
Referenced by Simulator::setAllSources().
{
TRACE;
int ns=_stations.count();
int nSrc=_sourceSig.count();
for(int is=0;is < ns;is++ ) _stationSig[ is ]=0;
for(int iSrc=0; iSrc < nSrc; iSrc++ ) {
QVector<Complex>& sig=_sourceSig[iSrc];
for(int is=0;is < ns;is++ ) {
_stationSig[ is ] += sig[is];
}
}
}
| int FKArrayMap::sourceCount | ( | ) | const [inline] |
Referenced by Simulator::on_addSource_clicked(), and Simulator::setAllSources().
{return _sourceSig.count();}
| double FKArrayMap::theoreticalKmax | ( | ) | const |
Calculate kmax from minimum distance between stations
References QGpCoreTools::endl(), QGpCoreTools::tr(), and TRACE.
Referenced by Simulator::init().
{
TRACE;
double dmin=1e99, d;
int n=_stations.count();
// Get min and max distances
for(int i=0;i < n;i++ ) {
for(int j=i + 1;j < n;j++ ) {
d=_stations[ i ].distanceTo(_stations[ j ] );
if(d > 0) {
if(d < dmin) {
dmin=d;
}
} else
App::stream() << tr("null distance found is station list") << endl;
}
}
// k=2*M_PI/lambda, due to Nyquist, d<lambda/2
return M_PI/dmin;
}
| double FKArrayMap::value | ( | double | x, |
| double | y | ||
| ) | const [virtual] |
Implemement this function to calculate the 2D function at x and y.
Implements QGpCoreTools::AbstractFunction2.
References QGpCoreTools::Complex::abs2(), QGpCoreTools::Complex::setUnitExp(), and TRACE.
{
TRACE;
Complex comp, sum;
for(int pi=0;pi < _stations.size();pi++ ) {
comp.setUnitExp(kx * _stations[ pi ].x() + ky * _stations[ pi ].y());
comp *= _stationSig[ pi ];
sum += comp;
}
return sum.abs2()/(_stations.count() * _stations.count());
}