Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
f3d1e41d
Commit
f3d1e41d
authored
Apr 30, 2018
by
Mark Olesen
Browse files
COMP: label-size 64 compilation of fft (issue
#813
)
parent
f86c129f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/randomProcesses/fft/fft.C
View file @
f3d1e41d
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fft.H"
#include <fftw3.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -33,7 +32,7 @@ void Foam::fft::fftRenumberRecurse
(
List
<
complex
>&
data
,
List
<
complex
>&
renumData
,
const
labelList
&
nn
,
const
UList
<
int
>
&
nn
,
label
nnprod
,
label
ii
,
label
l1
,
...
...
@@ -89,7 +88,7 @@ void Foam::fft::fftRenumberRecurse
}
void
Foam
::
fft
::
fftRenumber
(
List
<
complex
>&
data
,
const
labelList
&
nn
)
void
Foam
::
fft
::
fftRenumber
(
List
<
complex
>&
data
,
const
UList
<
int
>
&
nn
)
{
List
<
complex
>
renumData
(
data
);
...
...
@@ -181,6 +180,8 @@ void Foam::fft::transform
)
{
// Copy field into fftw containers
// NB: this is not fully compliant, since array sizing is non-constexpr.
// However, cannot instantiate List with fftw_complex
const
label
N
=
field
.
size
();
fftw_complex
in
[
N
],
out
[
N
];
...
...
@@ -236,13 +237,13 @@ Foam::tmp<Foam::complexField> Foam::fft::forwardTransform
const
UList
<
int
>&
nn
)
{
tmp
<
complexField
>
t
fftField
(
new
complexField
(
tfield
));
tmp
<
complexField
>
t
result
(
new
complexField
(
tfield
));
transform
(
t
fftField
.
ref
(),
nn
,
FORWARD_TRANSFORM
);
transform
(
t
result
.
ref
(),
nn
,
FORWARD_TRANSFORM
);
tfield
.
clear
();
return
t
fftField
;
return
t
result
;
}
...
...
@@ -252,13 +253,13 @@ Foam::tmp<Foam::complexField> Foam::fft::reverseTransform
const
UList
<
int
>&
nn
)
{
tmp
<
complexField
>
t
ifftField
(
new
complexField
(
tfield
));
tmp
<
complexField
>
t
result
(
new
complexField
(
tfield
));
transform
(
t
ifftField
.
ref
(),
nn
,
REVERSE_TRANSFORM
);
transform
(
t
result
.
ref
(),
nn
,
REVERSE_TRANSFORM
);
tfield
.
clear
();
return
t
ifftField
;
return
t
result
;
}
...
...
@@ -268,17 +269,11 @@ Foam::tmp<Foam::complexVectorField> Foam::fft::forwardTransform
const
UList
<
int
>&
nn
)
{
tmp
<
complexVectorField
>
tfftVectorField
(
new
complexVectorField
(
tfield
().
size
()
)
);
auto
tresult
=
tmp
<
complexVectorField
>::
New
(
tfield
().
size
());
for
(
direction
cmpt
=
0
;
cmpt
<
vector
::
nComponents
;
cmpt
++
)
{
t
fftVectorField
.
ref
().
replace
t
result
.
ref
().
replace
(
cmpt
,
forwardTransform
(
tfield
().
component
(
cmpt
),
nn
)
...
...
@@ -287,7 +282,7 @@ Foam::tmp<Foam::complexVectorField> Foam::fft::forwardTransform
tfield
.
clear
();
return
t
fftVectorField
;
return
t
result
;
}
...
...
@@ -297,17 +292,11 @@ Foam::tmp<Foam::complexVectorField> Foam::fft::reverseTransform
const
UList
<
int
>&
nn
)
{
tmp
<
complexVectorField
>
tifftVectorField
(
new
complexVectorField
(
tfield
().
size
()
)
);
auto
tresult
=
tmp
<
complexVectorField
>::
New
(
tfield
().
size
());
for
(
direction
cmpt
=
0
;
cmpt
<
vector
::
nComponents
;
cmpt
++
)
{
t
ifftVectorField
.
ref
().
replace
t
result
.
ref
().
replace
(
cmpt
,
reverseTransform
(
tfield
().
component
(
cmpt
),
nn
)
...
...
@@ -316,7 +305,7 @@ Foam::tmp<Foam::complexVectorField> Foam::fft::reverseTransform
tfield
.
clear
();
return
t
ifftVectorField
;
return
t
result
;
}
...
...
src/randomProcesses/fft/fft.H
View file @
f3d1e41d
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -57,15 +57,15 @@ public:
enum
transformDirection
{
FORWARD_TRANSFORM
=
-
1
,
REVERSE_TRANSFORM
=
1
FORWARD_TRANSFORM
=
-
1
,
//!< The sign -1 = FFTW_FORWARD
REVERSE_TRANSFORM
=
1
//!< The sign +1 = FFTW_BACKWARD
};
static
void
fftRenumberRecurse
(
List
<
complex
>&
data
,
List
<
complex
>&
renumData
,
const
labelList
&
nn
,
const
UList
<
int
>
&
nn
,
label
nnprod
,
label
ii
,
label
l1
,
...
...
@@ -74,7 +74,7 @@ public:
//- fftRenumber: fold the n-d data array to get the fft components in
//- the right places.
static
void
fftRenumber
(
List
<
complex
>&
data
,
const
labelList
&
nn
);
static
void
fftRenumber
(
List
<
complex
>&
data
,
const
UList
<
int
>
&
nn
);
//- Transform real-value data
// - uses the fftw real to half-complex method
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment