Commit 2998507e authored by Blue Bird's avatar Blue Bird
Browse files

main mit FFT

parent a5b199f9
......@@ -23,51 +23,105 @@ double isZero(double x)
return fabs(x) < 1e-10?1.0:0.0;
}
complex<double> I(0.0,1.0);
std::complex<double> expi(double x) {
return exp(I*x);
}
int main(int argc, char** argv) {
std::ofstream DATEI;
int n = 10;
//SectionedRectangle geo(v_x, v_y);
//Rectangle geo(1.0, 1.0);
Disc geo(2.0,1.0);
std::complex<double> sinExp(double x) {
return sin(x);
}
Boundary_Marker2D boundary(&geo);
Unstructured2DGrid_Marker2D inner_points(&geo);
inner_points.complement(&boundary);
std::complex<double> cosExp(double x) {
return cos(x);
}
// boudary integral test
Blockgrid2D blockBoTest(&geo,n);
Variable2D<double> one(blockBoTest);
Variable2D<double> ff(blockBoTest);
double realPart(std::complex<double> x) {
return x.real();;
}
Local_stiffness_matrix2D<double> boIntegral(blockBoTest);
double imPart(std::complex<double> x) {
return x.imag();;
}
DATEI.open("ug.vtk",std::ios :: out);
geo.PrintVtk(&DATEI);
DATEI.close();
double radiusLoch;
std::complex<double> loch(double x, double y) {
if(sqrt(x*x+y*y) < radiusLoch) return 1.0;
return 0.0;
}
X_coordinate2d X(blockBoTest);
Y_coordinate2d Y(blockBoTest);
void CalcFresnel(std::complex<double> (*loch) (double x, double y),
double distance,
double wavenumber,
VariableFFT& varIn,
VariableFFT& varFar) {
Blockgrid2D* blockGridRec = varFar.Give_blockgrid();
X_coordinate2d X(*blockGridRec);
Y_coordinate2d Y(*blockGridRec);
Function2d2<std::complex<double>,double> Loch(loch);
Function2d1<std::complex<double>,double> Expi(expi);
varFar = Loch(X,Y) * Expi(wavenumber * (X*X+Y*Y) / (2.0 * distance));
varIn = varFar;
varFar.FFT();
}
Local_stiffness_matrix2D<double> locStiff(blockBoTest);
// Test.Calculate(v_()*w_());
locStiff.Calculate_HelmBoundary();
int main(int argc, char** argv) {
std::ofstream DATEI;
one = 1.0;
ff = locStiff(one);
cout << "inegral Rand: " << product(ff,one) << endl;
DATEI.open("one.vtk");
one.Print_VTK(DATEI);
DATEI.close();
int n = 9;
double distance = 20; //[mm]
double lambda = 1.0e-3; //[mm]
radiusLoch = 1; //[mm]
double geometrySize = 2; //[mm]
double wavenumber = 2.0 * M_PI / lambda;
cout << " Test CalcFresnel!!" << endl;
double radiusGeo = 0.5 * geometrySize;
Rectangle geo(-radiusGeo, -radiusGeo, radiusGeo, radiusGeo);
VariableFFT varE(n,n,geo);
VariableFFT varIn(varE);
// VariableFFT varB(varA);
/*
Blockgrid2D* blockGridRec = varE.Give_blockgrid();
X_coordinate2d X(*blockGridRec);
Y_coordinate2d Y(*blockGridRec);
*/
CalcFresnel(loch,
distance,
wavenumber,
varIn,
varE);
std::ofstream DATEIA;
DATEIA.open("varIn.vtk");
varIn.Print_VTK(DATEIA);
DATEIA.close();
DATEIA.open("varE.vtk");
varE.Print_VTK(DATEIA);
DATEIA.close();
DATEIA.open("varEimag.vtk");
varE.Print_VTK(DATEIA,imPart);
DATEIA.close();
DATEIA.open("varEreal.vtk");
varE.Print_VTK(DATEIA,realPart);
DATEIA.close();
DATEI.open("ff.vtk");
ff.Print_VTK(DATEI);
DATEI.close();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment