Commit 5ebf0313 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

math lib, printcoordinates angepasst

parents 2c481bc4 36eae1aa
...@@ -111,6 +111,12 @@ D3vector transform_right_lens_diag_NW_quad ( double t1, double t2, double* point ...@@ -111,6 +111,12 @@ D3vector transform_right_lens_diag_NW_quad ( double t1, double t2, double* point
x = x*t2; x = x*t2;
double y = R_global_data*(cos ( t1*0.5*M_PI )- ( 1-t1 )) ; double y = R_global_data*(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2; y = y*t2;
// if (t1 == 0.75 && t2 == 1.0)
// {
// std::cout << "break";
// }
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2; double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2; double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
...@@ -279,6 +285,8 @@ D3vector transform_right_lens_diag_SW_quad ( double t1, double t2, double* point ...@@ -279,6 +285,8 @@ D3vector transform_right_lens_diag_SW_quad ( double t1, double t2, double* point
double temp = t1; double temp = t1;
t1 = t2; t1 = t2;
t2 = temp; t2 = temp;
//test
t1 = 1.0 - t1;
double t = t2; double t = t2;
double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1); double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1);
x = x*t2; x = x*t2;
...@@ -317,6 +325,8 @@ D3vector transform_left_lens_diag_SW_quad ( double t1, double t2, double* pointe ...@@ -317,6 +325,8 @@ D3vector transform_left_lens_diag_SW_quad ( double t1, double t2, double* pointe
t1 = t2; t1 = t2;
t2 = temp; t2 = temp;
double t = t2; double t = t2;
//test
t1 = 1.0 - t1;
double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1); double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1);
x = x*t2; x = x*t2;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ; double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
...@@ -353,6 +363,9 @@ D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointe ...@@ -353,6 +363,9 @@ D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointe
t1 = t2; t1 = t2;
t2 = temp; t2 = temp;
double t = t2; double t = t2;
//test
t1 = 1.0 - t1;
double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1); double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2; x = x*t2;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ; double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
...@@ -361,7 +374,7 @@ D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointe ...@@ -361,7 +374,7 @@ D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointe
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2; double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2; double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
actualY = -actualY; actualY = -actualY;
//actualX = -actualX;
double sign = (curvatureLeft_global_data > 0) ? 1 : ((curvatureLeft_global_data < 0) ? -1 : 0) ; double sign = (curvatureLeft_global_data > 0) ? 1 : ((curvatureLeft_global_data < 0) ? -1 : 0) ;
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY)); double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
...@@ -370,6 +383,9 @@ D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointe ...@@ -370,6 +383,9 @@ D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointe
if (std::isnan(z)) if (std::isnan(z))
{z = 0;} {z = 0;}
// temp = x;
// x = y;
// y = temp;
return D3vector ( x,y,z); return D3vector ( x,y,z);
} }
...@@ -388,14 +404,21 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point ...@@ -388,14 +404,21 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point
t1 = t2; t1 = t2;
t2 = temp; t2 = temp;
double t = t2; double t = t2;
//test
t1 = 1.0 - t1;
double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1); double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2; x = x*t2;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ; double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2; y = y*t2;
// if (t1 == 0.75 && t2 == 1.0)
// {
// std::cout << "break";
// }
double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2; double actualX = 0 + r_global_data * t1 + 0 * t2 + (R_global_data-r_global_data) * t1 * t2;
double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2; double actualY = r_global_data - r_global_data * t1 + (R_global_data-r_global_data) * t2 - (R_global_data-r_global_data) * t1 * t2;
actualY = -actualY; actualY = -actualY;
//actualX = -actualX;
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ; double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double z = offsetZ_global_data+ double z = offsetZ_global_data+
...@@ -403,10 +426,13 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point ...@@ -403,10 +426,13 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point
((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY))) ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY)))
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data))))); + sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
if (std::isnan(z)) if (std::isnan(z))
{ {
z = 0;} z = 0;}
// temp = x;
// x = y;
// y = temp;
return D3vector ( x,y,z); return D3vector ( x,y,z);
} }
...@@ -427,6 +453,7 @@ D3vector transform_left_lens_diag_NE_quad ( double t1, double t2, double* pointe ...@@ -427,6 +453,7 @@ D3vector transform_left_lens_diag_NE_quad ( double t1, double t2, double* pointe
t1 = t2; t1 = t2;
t2 = temp; t2 = temp;
double t = t2; double t = t2;
t1 = 1.0 - t1;
double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1); double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1);
...@@ -641,7 +668,7 @@ D3vector transform_right_lens_diag_NE_quad ( double t1, double t2, double* point ...@@ -641,7 +668,7 @@ D3vector transform_right_lens_diag_NE_quad ( double t1, double t2, double* point
t1 = t2; t1 = t2;
t2 = temp; t2 = temp;
double t = t2; double t = t2;
t1 = 1.0 - t1;
double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1); double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2; x = x*t2;
...@@ -1167,15 +1194,7 @@ D3vector transform_right_lens_diag_NE_quad_cut ( double t1, double t2, double* p ...@@ -1167,15 +1194,7 @@ D3vector transform_right_lens_diag_NE_quad_cut ( double t1, double t2, double* p
if (std::isnan(x) || std::isnan(y) || std::isnan(z)) if (std::isnan(x) || std::isnan(y) || std::isnan(z))
{ z = 0;} { z = 0;}
// std::cout << "transform_right_lens_diag_NE_quad_cut ";
// D3vector ( x,y,z).Print();
// std::cout << std::endl;
// double actualZ = offsetZ_global_data+
// sign*( ( sqrt(pow(curvatureRight_global_data,2)-
// radiusSquared)
// + sign*(-curvatureRight_global_data))) ;
// return D3vector (actualX, actualY,actualZ );
//return D3vector ( xT,yT,z);
return D3vector ( x,y,z); return D3vector ( x,y,z);
//return D3vector ( (1-t2) * xAdd,(1-t2) * yAdd,z); //return D3vector ( (1-t2) * xAdd,(1-t2) * yAdd,z);
return D3vector ( 0,0,z); return D3vector ( 0,0,z);
...@@ -1726,6 +1745,7 @@ Lens_Geometry_Quad::Lens_Geometry_Quad(double Radius, double thickness, double c ...@@ -1726,6 +1745,7 @@ Lens_Geometry_Quad::Lens_Geometry_Quad(double Radius, double thickness, double c
Set_transformation_face(4,5,12,13,transform_diag_inner_faces_NE_quad); Set_transformation_face(4,5,12,13,transform_diag_inner_faces_NE_quad);
Set_transformation_face(3,5,11,13,transform_outer_boundary_NW); //transform_outer_boundary_NW Set_transformation_face(3,5,11,13,transform_outer_boundary_NW); //transform_outer_boundary_NW
Set_transformation_face(10,11,12,13,transform_right_lens_diag_NW_quad); //transform_right_lens_diag_NW_quad Set_transformation_face(10,11,12,13,transform_right_lens_diag_NW_quad); //transform_right_lens_diag_NW_quad
//Set_transformation_face(10,11,12,13,transform_quadrangle_NULL); //transform_right_lens_diag_NW_quad
//bottom-west block: corner ids: 4 5 6 7 12 13 14 15 //bottom-west block: corner ids: 4 5 6 7 12 13 14 15
//eher: S-W-BLOCK //eher: S-W-BLOCK
...@@ -1744,7 +1764,7 @@ Lens_Geometry_Quad::Lens_Geometry_Quad(double Radius, double thickness, double c ...@@ -1744,7 +1764,7 @@ Lens_Geometry_Quad::Lens_Geometry_Quad(double Radius, double thickness, double c
Set_transformation_face(6,7,14,15,transform_diag_inner_faces_NE_quad); Set_transformation_face(6,7,14,15,transform_diag_inner_faces_NE_quad);
Set_transformation_face(1,7,9,15,transform_outer_boundary_SE); Set_transformation_face(1,7,9,15,transform_outer_boundary_SE);
Set_transformation_face(8,9,14,15,transform_right_lens_diag_SE_quad); Set_transformation_face(8,9,14,15,transform_right_lens_diag_SE_quad);
//Set_transformation_face(8,9,14,15,transform_quadrangle_NULL);
construction_done(); construction_done();
...@@ -1764,6 +1784,9 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double ...@@ -1764,6 +1784,9 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
{ {
cutRight = true; cutRight = true;
} }
assert(!cutLeft || (curvatureLeft < 0 && cutLeft) && "Assertion failed! If left side of lens is cutted, its curvature must be negative (convex)!");
assert(!cutRight || (curvatureRight < 0 && cutRight) && "Assertion failed! If right side of lens is cutted, its curvature must be negative (convex)!");
if (MechanicalRadiusLeft < RadiusLeft) if (MechanicalRadiusLeft < RadiusLeft)
{ {
std::cout << "warning : mech radius < radius\n set to radiusLeft"; std::cout << "warning : mech radius < radius\n set to radiusLeft";
......
...@@ -567,8 +567,10 @@ inline void D3vector::Print() { ...@@ -567,8 +567,10 @@ inline void D3vector::Print() {
} }
inline void D3vector::PrintCoordinatesOnly() { inline void D3vector::PrintCoordinatesOnly() {
std::cout << x << ", " << y << ", " << z; std::cout << x << ", " << y << ", " << z;
} }
inline void D3vector::Print(std::ofstream *Datei) { inline void D3vector::Print(std::ofstream *Datei) {
*Datei << x << " " << y << " " << z; *Datei << x << " " << y << " " << z;
} }
......
...@@ -188,6 +188,12 @@ double L_infty_cell(const Expr2D<A>& a, Marker2D& marker); ...@@ -188,6 +188,12 @@ double L_infty_cell(const Expr2D<A>& a, Marker2D& marker);
template <class A> template <class A>
double L_infty_cell(const Expr2D<A>& a); double L_infty_cell(const Expr2D<A>& a);
template <class A>
double Maximum_cell(const Expr2D<A>& ao);
template <class A>
double Minimum_cell(const Expr2D<A>& ao);
/* @} */ /* @} */
......
...@@ -30,10 +30,11 @@ ...@@ -30,10 +30,11 @@
#else #else
#ifdef WIN32 #ifdef WIN32
#include <array> #include <array>
using std::array;
#else #else
#include <tr1/array> #include <tr1/array>
using std::tr1::array;
#endif #endif
using std::tr1::array;
#endif #endif
#endif // _NOARRAYLIB #endif // _NOARRAYLIB
......
...@@ -77,7 +77,7 @@ Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(int nx_, int ...@@ -77,7 +77,7 @@ Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(int nx_, int
} }
Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(Blockgrid2D* blockgrid_) { Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(Blockgrid2D* blockgrid_, double factorIncrease) {
blockgrid = blockgrid_; blockgrid = blockgrid_;
ug = blockgrid->Give_unstructured_grid(); ug = blockgrid->Give_unstructured_grid();
...@@ -122,8 +122,9 @@ Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(Blockgrid2D* ...@@ -122,8 +122,9 @@ Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(Blockgrid2D*
} }
} }
nx = Nmax*4; nx = Nmax*factorIncrease;
ny = Nmax*4; ny = Nmax*factorIncrease;
pWS = boxWS; pWS = boxWS;
pEN = boxEN; pEN = boxEN;
......
...@@ -76,7 +76,7 @@ class Interpolate_on_structured_2Dgrid { ...@@ -76,7 +76,7 @@ class Interpolate_on_structured_2Dgrid {
* preparation for interpolation * preparation for interpolation
@param blockgrid_ of unstructured grid @param blockgrid_ of unstructured grid
**/ **/
Interpolate_on_structured_2Dgrid(Blockgrid2D* blockgrid_); Interpolate_on_structured_2Dgrid(Blockgrid2D* blockgrid_, double factorIncrease = 4);
/** /**
...@@ -129,7 +129,7 @@ class Interpolate_on_structured_2Dgrid_with_data : protected Interpolate_on_stru ...@@ -129,7 +129,7 @@ class Interpolate_on_structured_2Dgrid_with_data : protected Interpolate_on_stru
Interpolate_on_structured_2Dgrid_with_data(int nx_, int ny_, Interpolate_on_structured_2Dgrid_with_data(int nx_, int ny_,
D2vector pWS, D2vector pEN, D2vector pWS, D2vector pEN,
Blockgrid2D& blockgrid_); Blockgrid2D& blockgrid_);
Interpolate_on_structured_2Dgrid_with_data(Blockgrid2D& blockgrid_); Interpolate_on_structured_2Dgrid_with_data(Blockgrid2D& blockgrid_, double factorIncrease = 4);
void setData(Variable2D<DTyp>& u, DTyp defaultInterpolation); void setData(Variable2D<DTyp>& u, DTyp defaultInterpolation);
...@@ -361,8 +361,8 @@ Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgr ...@@ -361,8 +361,8 @@ Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgr
} }
template <class DTyp> template <class DTyp>
Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgrid_with_data(Blockgrid2D& blockgrid_) Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgrid_with_data(Blockgrid2D& blockgrid_, double factorIncrease)
: Interpolate_on_structured_2Dgrid(&blockgrid_) { : Interpolate_on_structured_2Dgrid(&blockgrid_, factorIncrease) {
data = new DTyp[nx*ny]; data = new DTyp[nx*ny];
for(int i=0;i<nx*ny;++i) data[i] = 0.0; for(int i=0;i<nx*ny;++i) data[i] = 0.0;
} }
......
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