mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: FFT - removed power-of-2 constraint on number of samples
This commit is contained in:
@ -95,20 +95,6 @@ void Foam::fft::transform
|
||||
transformDirection dir
|
||||
)
|
||||
{
|
||||
forAll(nn, idim)
|
||||
{
|
||||
// Check for power of two
|
||||
unsigned int dimCount = nn[idim];
|
||||
if (!dimCount || (dimCount & (dimCount - 1)))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "number of elements in direction " << idim
|
||||
<< " is not a power of 2" << endl
|
||||
<< " Number of elements in each direction = " << nn
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy field into fftw containers
|
||||
const label N = field.size();
|
||||
fftw_complex in[N], out[N];
|
||||
|
||||
@ -206,16 +206,6 @@ bool Foam::noiseModel::read(const dictionary& dict)
|
||||
dict.readIfPresent("maxPressure", maxPressure_);
|
||||
dict.readIfPresent("outputPrefix", outputPrefix_);
|
||||
|
||||
// Check number of samples - must be a power of 2 for our FFT
|
||||
bool powerOf2 = ((nSamples_ != 0) && !(nSamples_ & (nSamples_ - 1)));
|
||||
if (!powerOf2)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "N: Number of samples in sampling windows must be a "
|
||||
<< "power of 2"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (fLower_ < 0)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
|
||||
@ -66,9 +66,6 @@ Description
|
||||
writeOctaves | Write octaves data | no | yes
|
||||
\endtable
|
||||
|
||||
Note
|
||||
The number of samples in the sampling window must be a power of 2
|
||||
|
||||
|
||||
SourceFiles
|
||||
noiseModel.C
|
||||
|
||||
@ -33,8 +33,7 @@ Description
|
||||
// Pressure reference
|
||||
pRef 0;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
// Lower frequency bounds
|
||||
|
||||
@ -33,8 +33,7 @@ Description
|
||||
// Pressure reference
|
||||
pRef 0;
|
||||
|
||||
// Number of samples in sampling window
|
||||
// Must be a power of 2, default = 2^16 (=65536)
|
||||
// Number of samples in sampling window, default = 2^16 (=65536)
|
||||
N 4096;
|
||||
|
||||
// Lower frequency bounds
|
||||
|
||||
Reference in New Issue
Block a user