18 for ( std::size_t i = 0; i < N/2; ++i ) {
19 for ( std::size_t var = 0; var < ft.
get_nvars(); ++var ) {
21 ft_shifted( i, var ) = ft( N/2+i, var );
23 ft_shifted( N/2 + i, var ) = ft( i, var );
35 for ( std::size_t i = 0; i < N/2; ++i ) {
36 for ( std::size_t var = 0; var < ft.
get_nvars(); ++var ) {
38 ft_ishifted( i, var ) = ft( N/2 + i, var );
40 ft_ishifted( N/2 + i, var ) = ft( i, var );
43 ft_ishifted.
coord( N/2 + i ) = ft.
coord(N-1) + i*df;
54 unsigned ny =
f.get_nnodes().second;
55 unsigned nx =
f.get_nnodes().first;
57 for (
unsigned jy = 0; jy < ny; ++jy ) {
60 for (
unsigned jx = 0; jx < nx; ++jx ) {
77 for (
unsigned jy = 0; jy < ny; ++jy ) {
80 for (
unsigned jx = 0; jx < nx; ++jx ) {
91 std::size_t N =
f.get_nnodes();
93 double dt =
f.coord(1)-
f.coord(0);
95 double fs = 2*M_PI/dt;
102 const double Wn = 2*M_PI/N;
104 for ( std::size_t k = 0; k < N; ++k ) {
115 for ( std::size_t n = 0; n < N; ++n ) {
116 vars +=
f.get_nodes_vars(n)*exp(-I*Wn*
double(k*n));
162 double dt = 2*M_PI/fs;
168 const double Wn = 2*M_PI/N;
170 const std::size_t nVars( ft.
get_nvars() );
172 for ( std::size_t n = 0; n < N; ++n ) {
174 f.coord(n) = origin + n*dt;
177 for ( std::size_t k = 0; k < N; ++k ) {
181 f.set_nodes_vars(n,vars/(N*dt));
Specification for a templated DenseVector class – a dense, dynamic, vector object.
A spec for a collection of Fourier methods that act on Noddy containers.
A specification for a one dimensional mesh object.
A specification for a two dimensional mesh object.
An DenseVector class – a dense vector object.
A one dimensional mesh utility object.
std::size_t get_nvars() const
DenseVector< _Type > get_nodes_vars(const std::size_t &node) const
Get the variables stored at A SPECIFIED node.
const _Xtype & coord(const std::size_t &node) const
Access a nodal position.
void set_nodes_vars(const std::size_t node, const DenseVector< _Type > &u)
Set the variables stored at A SPECIFIED node.
std::size_t get_nnodes() const
A two dimensional mesh utility object.
std::pair< std::size_t, std::size_t > get_nnodes() const
Get the number of nodes in the two directions of the 2D mesh.
const DenseVector< double > & xnodes() const
Access the vector of x-nodal positions.
std::size_t get_nvars() const
Get the number of variables that are stored at each node.
const DenseVector< double > & ynodes() const
Access the vector of y-nodal positions.
double & xcoord(const std::size_t nodex)
Access the x-nodal (first index) position.
OneD_Node_Mesh< _Type > get_xsection_at_ynode(const std::size_t nodey) const
Get a cross section of the 2D mesh at a specified (constant) y node.
void set_nodes_vars(const std::size_t nodex, const std::size_t nodey, const DenseVector< _Type > &U)
Set the variables stored at A SPECIFIED node.
OneD_Node_Mesh< D_complex > dft(const OneD_Node_Mesh< D_complex > &f)
(Slow) DFT of the real data (x_i,f_i), i = 0, ... N-1; N must be EVEN.
OneD_Node_Mesh< D_complex > dft_with_shift(const OneD_Node_Mesh< D_complex > &f)
A wrapper that calls the 'dft' method above followed by the 'shift' method.
OneD_Node_Mesh< D_complex > idft_with_ishift(const OneD_Node_Mesh< D_complex > &ft, double origin=0)
A wrapper that calls the 'ishift' method above followed by the 'idft' method.
OneD_Node_Mesh< D_complex > shift(const OneD_Node_Mesh< D_complex > &ft)
Shift the frequency spectrum obtained from dft to give positive and negative freq.
OneD_Node_Mesh< D_complex > ishift(const OneD_Node_Mesh< D_complex > &ft)
Invert the shif operation to recover a spectrum in the form that is expected by the idft routine.
OneD_Node_Mesh< D_complex > idft(const OneD_Node_Mesh< D_complex > &ft, double origin=0)
(Slow) Inverse DFT of the complex data (omega_i,F_i), i = 0,...,N-1; N must be EVEN.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...
std::complex< double > D_complex
A complex double precision number using std::complex.