mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use Zero when zero-initializing types
- makes the intent clearer and avoids the need for additional
constructor casting. Eg,
labelList(10, Zero) vs. labelList(10, 0)
scalarField(10, Zero) vs. scalarField(10, scalar(0))
vectorField(10, Zero) vs. vectorField(10, vector::zero)
This commit is contained in:
@ -322,7 +322,7 @@ Foam::graph Foam::noiseFFT::meanPf(const windowModel& window) const
|
||||
const label N = window.nSamples();
|
||||
const label nWindow = window.nWindow();
|
||||
|
||||
scalarField meanPf(N/2 + 1, 0.0);
|
||||
scalarField meanPf(N/2 + 1, Zero);
|
||||
|
||||
for (label windowI = 0; windowI < nWindow; ++windowI)
|
||||
{
|
||||
@ -354,7 +354,7 @@ Foam::graph Foam::noiseFFT::RMSmeanPf(const windowModel& window) const
|
||||
const label N = window.nSamples();
|
||||
const label nWindow = window.nWindow();
|
||||
|
||||
scalarField RMSMeanPf(N/2 + 1, 0.0);
|
||||
scalarField RMSMeanPf(N/2 + 1, Zero);
|
||||
for (label windowI = 0; windowI < nWindow; ++windowI)
|
||||
{
|
||||
RMSMeanPf += sqr(Pf(window.apply<scalar>(*this, windowI)));
|
||||
@ -385,7 +385,7 @@ Foam::graph Foam::noiseFFT::PSDf(const windowModel& window) const
|
||||
const label N = window.nSamples();
|
||||
const label nWindow = window.nWindow();
|
||||
|
||||
scalarField psd(N/2 + 1, 0.0);
|
||||
scalarField psd(N/2 + 1, Zero);
|
||||
|
||||
for (label windowI = 0; windowI < nWindow; ++windowI)
|
||||
{
|
||||
@ -465,8 +465,8 @@ Foam::graph Foam::noiseFFT::octaves
|
||||
const scalarField& f = g.x();
|
||||
const scalarField& data = g.y();
|
||||
|
||||
scalarField octData(freqBandIDs.size() - 1, 0.0);
|
||||
scalarField fm(freqBandIDs.size() -1, 0.0);
|
||||
scalarField octData(freqBandIDs.size() - 1, Zero);
|
||||
scalarField fm(freqBandIDs.size() -1, Zero);
|
||||
|
||||
for (label bandI = 0; bandI < freqBandIDs.size() - 1; ++bandI)
|
||||
{
|
||||
|
||||
@ -615,9 +615,9 @@ void surfaceNoise::calculate()
|
||||
label f1 = floor(fUpper_/deltaf/scalar(fftWriteInterval_));
|
||||
label nFreq = f1 - f0;
|
||||
|
||||
scalarField PrmsfAve(nFreq, 0);
|
||||
scalarField PSDfAve(nFreq, 0);
|
||||
scalarField fOut(nFreq, 0);
|
||||
scalarField PrmsfAve(nFreq, Zero);
|
||||
scalarField PSDfAve(nFreq, Zero);
|
||||
scalarField fOut(nFreq, Zero);
|
||||
|
||||
if (nFreq == 0)
|
||||
{
|
||||
@ -746,8 +746,8 @@ void surfaceNoise::calculate()
|
||||
{
|
||||
fileName outDir(outDirBase/"oneThirdOctave");
|
||||
|
||||
scalarField PSDfAve(surfPSD13f.size(), 0);
|
||||
scalarField Prms13f2Ave(surfPSD13f.size(), 0);
|
||||
scalarField PSDfAve(surfPSD13f.size(), Zero);
|
||||
scalarField Prms13f2Ave(surfPSD13f.size(), Zero);
|
||||
|
||||
forAll(surfPSD13f, i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user