variableFFT.h 3.15 KB
Newer Older
Blue Bird's avatar
Blue Bird committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**********************************************************************************
 * Copyright 2010 Christoph Pflaum 
 * 		Department Informatik Lehrstuhl 10 - Systemsimulation
 *		Friedrich-Alexander Universität Erlangen-Nürnberg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **********************************************************************************/
 
// ------------------------------------------------------------
//
// variableFFT.h
//
// ------------------------------------------------------------
#include "../grid/marker2D.h"
#include "extemp2D.h"
#ifndef VARIABLEFFT_H
#define VARIABLEFFT_H
#ifdef _OPENMP
#include <omp.h>
#include "../ugopenmp.h"
#endif

Christoph Pflaum's avatar
Christoph Pflaum committed
33
class Rechteck;
Blue Bird's avatar
Blue Bird committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class Interpolate_on_structured_2Dgrid;

/** \addtogroup ExpressionTemplates2D **/
/* @{ */  

/**
 * 2D Variable which allows Fast Fourier Transkormation (FFT)
 **/
class VariableFFT : public Variable2D<std::complex<double> >  {
public:
    /**
     * @param tx depth of grid in x-direction, Nx=2^tx
     * @param ty depth of grid in y-direction, Nx=2^ty 
     * @param ugRectangle  description of physical domain
     **/
Christoph Pflaum's avatar
Christoph Pflaum committed
49
    VariableFFT(int tx, int ty, Rechteck& ugRectangle);
Blue Bird's avatar
Blue Bird committed
50
51
52
    VariableFFT(VariableFFT* other);    
    VariableFFT(const VariableFFT& other);      
    ~VariableFFT();
53
    void setDomainStrech(double strechX, double strechY); 
Blue Bird's avatar
Blue Bird committed
54
55
56
57
58
59
60
61
62
63

    void FFT();
    void inversFFT();     
    
    template <class A>
    void operator=(const Expr2D<A>& a){
           (static_cast<Variable2D<std::complex<double> >*>(this))->operator=(a);
    }

    void operator=(VariableFFT& v);
Christoph Pflaum's avatar
Christoph Pflaum committed
64
65
66
    
    void operator=(std::complex<double> x);       
    
Blue Bird's avatar
Blue Bird committed
67
68
    void interpolate(Variable2D<std::complex<double> >& v, 
                     std::complex<double> defaultInterpolation);
69

Christoph Pflaum's avatar
Christoph Pflaum committed
70
    
71
72
73
74
75
76
    double getHx() const;
    double getHy() const;
    double getNx();
    double getNy();
    double getSizeX();
    double getSizeY();
Christoph Pflaum's avatar
Christoph Pflaum committed
77
78
79
80
81
82
83
84
85
86
87
    
    
    /*
    double getHx() const { return  getSizeX() / Nx; }  
    double getHy() const { return  getSizeY() / Ny; }
    double getNx() const { return Nx; }
    double getNy() const { return Ny; }
    double getSizeX() const { return assignmentBlockgrid->MaximumStrechedX() - assignmentBlockgrid->MinimumStrechedX(); }
    double getSizeY() const { return assignmentBlockgrid->MaximumStrechedY() - assignmentBlockgrid->MinimumStrechedY(); }
    */
    
Blue Bird's avatar
Blue Bird committed
88
89
90
91
92
93
94
95
//     
private:
    void init();
     bool ownBlockGrid;  
     std::complex<double>* startValueY;

    int Nx;
    int Ny;        
96
97
98
99

    double Hx;
    double Hy;

Blue Bird's avatar
Blue Bird committed
100
101
102
103
104
105
106
107
108
109
     int powerTwo(int t);
     
     Interpolate_on_structured_2Dgrid* assignmentInterpolator;
     Blockgrid2D* assignmentBlockgrid;
};

/* @} */


#endif // VARIABLEFFT_H