Commit a5b199f9 authored by Christoph Pflaum's avatar Christoph Pflaum
Browse files

Rechteck hinzu

parent 61cae642
......@@ -79,7 +79,7 @@ void VariableFFT::interpolate(Variable2D<std::complex<double> >& v,
}
VariableFFT::VariableFFT(int tx, int ty, Rectangle& ugRectangle) :
VariableFFT::VariableFFT(int tx, int ty, Rechteck& ugRectangle) :
Variable2D<std::complex<double> >(
*(blockgrid = new Blockgrid2D(&ugRectangle,powerTwo(tx)-1,powerTwo(ty)-1))) {
......
......@@ -30,7 +30,7 @@
#include "../ugopenmp.h"
#endif
class Rectangle;
class Rechteck;
class Interpolate_on_structured_2Dgrid;
/** \addtogroup ExpressionTemplates2D **/
......@@ -46,7 +46,7 @@ public:
* @param ty depth of grid in y-direction, Nx=2^ty
* @param ugRectangle description of physical domain
**/
VariableFFT(int tx, int ty, Rectangle& ugRectangle);
VariableFFT(int tx, int ty, Rechteck& ugRectangle);
VariableFFT(VariableFFT* other);
VariableFFT(const VariableFFT& other);
~VariableFFT();
......
......@@ -157,6 +157,43 @@ Rectangle::Rectangle(double lx_, double ly_,
Rechteck::Rechteck(double rx_, double ry_) : lx(0.0), rx(rx_), ly(0.0), ry(ry_) {
Set_number_points(4); // 4 an den Ecken
Set_coordinate_point(SWdir2D, D2vector(lx, ly));
Set_coordinate_point(SEdir2D, D2vector(rx, ly));
Set_coordinate_point(NWdir2D, D2vector(lx, ry));
Set_coordinate_point(NEdir2D, D2vector(rx, ry));
Set_number_rectanglEs(1);
Set_rectangle(0, SWdir2D, SEdir2D, NWdir2D, NEdir2D);
construction_rectangle_points_done();
// no transformations of the edges and faces
construction_done();
}
Rechteck::Rechteck(double lx_, double ly_,
double rx_, double ry_) : lx(lx_), ly(ly_), rx(rx_), ry(ry_) {
Set_number_points(4); // 4 an den Ecken
Set_coordinate_point(SWdir2D, D2vector(lx, ly));
Set_coordinate_point(SEdir2D, D2vector(rx, ly));
Set_coordinate_point(NWdir2D, D2vector(lx, ry));
Set_coordinate_point(NEdir2D, D2vector(rx, ry));
Set_number_rectanglEs(1);
Set_rectangle(0, SWdir2D, SEdir2D, NWdir2D, NEdir2D);
construction_rectangle_points_done();
// no transformations of the edges and faces
construction_done();
}
////////////////////////////////////////////////////////////////////
......@@ -432,6 +469,11 @@ void Rectangle::Test() const {
std::cout << "Rectangle\n";
}
void Rechteck::Test() const {
std::cout << "Rechteck\n";
}
void Disc::getCoordinate(const D2vector& point_coord, int& id, int& i, int& j, const Blockgrid2D& blockgrid) const {
const double r_Radius = 2.0*radius*sqrt(2.0)/(sqrt(6.0)-sqrt(2.0));
const double angle = fmod(0.5*M_PI + atan(point_coord.y / point_coord.x),0.5*M_PI);
......@@ -532,7 +574,7 @@ bool Disc::getCoordinate(const D2vector& point_coord, int& id, double& i, double
return (point_coord.radius() <= Radius);
}
void Rectangle::getCoordinate(const D2vector& point_coord, int& id, int& i, int& j, const Blockgrid2D& blockgrid) const {
void Rechteck::getCoordinate(const D2vector& point_coord, int& id, int& i, int& j, const Blockgrid2D& blockgrid) const {
id = 0;
const int Nx = blockgrid.Give_Nx_rectangle(0);
const int Ny = blockgrid.Give_Ny_rectangle(0);
......@@ -545,7 +587,7 @@ void Rectangle::getCoordinate(const D2vector& point_coord, int& id, int& i, int&
}
bool Rectangle::getCoordinate(const D2vector& point_coord, int& id, double& i, double& j, const Blockgrid2D& blockgrid) const {
bool Rechteck::getCoordinate(const D2vector& point_coord, int& id, double& i, double& j, const Blockgrid2D& blockgrid) const {
id = 0;
const int Nx = blockgrid.Give_Nx_rectangle(0);
const int Ny = blockgrid.Give_Ny_rectangle(0);
......@@ -558,3 +600,31 @@ bool Rectangle::getCoordinate(const D2vector& point_coord, int& id, double& i, d
if(j > Ny) j = Ny;
return false;
}
void Rectangle::getCoordinate(const D2vector& point_coord, int& id, int& i, int& j, const Blockgrid2D& blockgrid) const {
id = 0;
const int Nx = blockgrid.Give_Nx_rectangle(0);
const int Ny = blockgrid.Give_Ny_rectangle(0);
i = (point_coord.x - lx) / (rx - lx)*Nx;
j = (point_coord.y - ly) / (ry - ly)*Ny;
if (i < 0) i = 0;
if (i > Nx) i = Nx;
if (j < 0) j = 0;
if (j > Ny) j = Ny;
}
bool Rectangle::getCoordinate(const D2vector& point_coord, int& id, double& i, double& j, const Blockgrid2D& blockgrid) const {
id = 0;
const int Nx = blockgrid.Give_Nx_rectangle(0);
const int Ny = blockgrid.Give_Ny_rectangle(0);
i = (point_coord.x - lx) / (rx - lx)*Nx;
j = (point_coord.y - ly) / (ry - ly)*Ny;
if (i >= 0.0 && j >= 0.0 && i < Nx && j < Ny) return true;
if (i < 0) i = 0;
if (i > Nx) i = Nx;
if (j < 0) j = 0;
if (j > Ny) j = Ny;
return false;
}
......@@ -22,6 +22,40 @@
class Blockgrid2D;
/**
* Normal Rectangle
*
* **/
class Rechteck : public Unstructured2DGrid {
public:
/**
* [0,rx] x [0,ry]
*/
Rechteck(double rx, double ry);
/**
* [lx,rx] x [ly,ry]
*/
Rechteck(double lx, double ly,
double rx, double ry);
~Rechteck() {};
void getCoordinate(const D2vector& point_coord, int& id, int& i, int& j, const Blockgrid2D& blockgrid) const;
/**
* inverse computation
* @param point_coord input getCoordinate
* @param id id des rectangle
* @param i,j indizes der Koordinaten
* @return true falls Punkt im Gebiet, sonst false
**/
bool getCoordinate(const D2vector& point_coord, int& id, double& i, double& j, const Blockgrid2D& blockgrid) const;
void Test() const;
private:
double lx, ly, rx, ry;
};
/**
* Normal Rectangle
*
......
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