Source
//# FFT2D.cc: implementation of FFT2D
//# Copyright (C) 2016
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library 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 2 of the License, or (at your
//# option) any later version.
//#
//# This library 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 this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be adressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//#
//# $kgolap$
//DEDICATED TO HONGLIN YE
using namespace casacore;
namespace casa { //# NAMESPACE CASA - BEGIN
// Utility function to try to give as much info as possible - CAS-12604
void throw_programmer_error(Long nx_p, Long ny_p, Long x, Long y, const char *file,
int line)
{
AipsError exc;
ostringstream msg;
msg << "Programmer error: called FFT2D with wrong size. In " << file << ":" << line
<< ", with nx_p: " << nx_p << ", ny_p: " << ny_p << ", x: " << x << ", y: " << y
<< "\n Stack trace: " << exc.getStackTrace();
exc.setMessage(msg.str());
throw(exc);
}
FFT2D::FFT2D(Bool useFFTW):planC2C_forw_p(nullptr),planC2C_back_p(nullptr), planR2C_p(nullptr), planC2CD_forw_p(nullptr), planC2CD_back_p(nullptr), useFFTW_p(useFFTW), wsave_p(0), lsav_p(0), nx_p(-1), ny_p(-1) {
if(useFFTW_p){
Int numThreads=HostInfo::numCPUs(true);
numThreads=omp_get_max_threads();
fftwf_init_threads();
fftwf_plan_with_nthreads(numThreads);
///For double precision
fftw_init_threads();