diff --git a/program/source/grid/examples_ug_optics.cc b/program/source/grid/examples_ug_optics.cc index e658989be3f5decbc5709634e77b27328461f224..1e5fc7233368a9a5bfed24820171983aca1f8ed3 100644 --- a/program/source/grid/examples_ug_optics.cc +++ b/program/source/grid/examples_ug_optics.cc @@ -111,6 +111,12 @@ D3vector transform_right_lens_diag_NW_quad ( double t1, double t2, double* point x = x*t2; double y = R_global_data*(cos ( t1*0.5*M_PI )- ( 1-t1 )) ; 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 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 double temp = t1; t1 = t2; t2 = temp; + //test + t1 = 1.0 - t1; double t = t2; double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1); x = x*t2; @@ -317,6 +325,8 @@ D3vector transform_left_lens_diag_SW_quad ( double t1, double t2, double* pointe t1 = t2; t2 = temp; double t = t2; + //test + t1 = 1.0 - t1; double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1); x = x*t2; 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 t1 = t2; t2 = temp; double t = t2; + + //test + t1 = 1.0 - t1; double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1); x = x*t2; 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 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; actualY = -actualY; - + //actualX = -actualX; double sign = (curvatureLeft_global_data > 0) ? 1 : ((curvatureLeft_global_data < 0) ? -1 : 0) ; 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 if (std::isnan(z)) {z = 0;} +// temp = x; +// x = y; +// y = temp; return D3vector ( x,y,z); } @@ -388,14 +404,21 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point t1 = t2; t2 = temp; double t = t2; + //test + t1 = 1.0 - t1; double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1); x = x*t2; double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ; 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 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; + //actualX = -actualX; double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ; double z = offsetZ_global_data+ @@ -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))) + 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)) { z = 0;} +// temp = x; +// x = y; +// y = temp; + return D3vector ( x,y,z); } @@ -427,6 +453,7 @@ D3vector transform_left_lens_diag_NE_quad ( double t1, double t2, double* pointe t1 = t2; t2 = temp; double t = t2; + t1 = 1.0 - 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 t1 = t2; t2 = temp; double t = t2; - + t1 = 1.0 - t1; double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1); x = x*t2; @@ -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)) { 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 ( (1-t2) * xAdd,(1-t2) * yAdd,z); return D3vector ( 0,0,z); @@ -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(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_quadrangle_NULL); //transform_right_lens_diag_NW_quad //bottom-west block: corner ids: 4 5 6 7 12 13 14 15 //eher: S-W-BLOCK @@ -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(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_quadrangle_NULL); construction_done(); @@ -1764,6 +1784,9 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double { 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) { std::cout << "warning : mech radius < radius\n set to radiusLeft"; diff --git a/program/source/math_lib/math_lib.h b/program/source/math_lib/math_lib.h index d66cdcd5230857ed15fa152f92632a4e7323f85a..7c33b36de681d6aa08b2f210cd23f67fb4ab0eb7 100644 --- a/program/source/math_lib/math_lib.h +++ b/program/source/math_lib/math_lib.h @@ -567,8 +567,10 @@ inline void D3vector::Print() { } inline void D3vector::PrintCoordinatesOnly() { + std::cout << x << ", " << y << ", " << z; } + inline void D3vector::Print(std::ofstream *Datei) { *Datei << x << " " << y << " " << z; } diff --git a/program2D/source/extemp/cellvar2D.h b/program2D/source/extemp/cellvar2D.h index 4b1d54fc6fcf601d0dda0d158f06964adfc4f13c..539bf23f73b21dbb8d7f69e13a228fc36ace58cd 100644 --- a/program2D/source/extemp/cellvar2D.h +++ b/program2D/source/extemp/cellvar2D.h @@ -188,6 +188,12 @@ double L_infty_cell(const Expr2D<A>& a, Marker2D& marker); template <class 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); /* @} */ diff --git a/program2D/source/grid/interpolation2D_cc.h b/program2D/source/grid/interpolation2D_cc.h index 62aa2f7c55f2df1614b6990c679cc4b866f8dc7b..c9fd360c5994ead6fd77c92d34805cfc7223e910 100644 --- a/program2D/source/grid/interpolation2D_cc.h +++ b/program2D/source/grid/interpolation2D_cc.h @@ -30,10 +30,11 @@ #else #ifdef WIN32 #include <array> + using std::array; #else #include <tr1/array> +using std::tr1::array; #endif - using std::tr1::array; #endif #endif // _NOARRAYLIB diff --git a/program2D/source/interpol/interpolTwoD.cc b/program2D/source/interpol/interpolTwoD.cc index dcd172562a900c3f9312bd88060b0d2c120c282e..9b898877f40d5c334ec270306ec52126dc1cb308 100644 --- a/program2D/source/interpol/interpolTwoD.cc +++ b/program2D/source/interpol/interpolTwoD.cc @@ -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_; ug = blockgrid->Give_unstructured_grid(); @@ -122,8 +122,9 @@ Interpolate_on_structured_2Dgrid::Interpolate_on_structured_2Dgrid(Blockgrid2D* } } - nx = Nmax*4; - ny = Nmax*4; + nx = Nmax*factorIncrease; + ny = Nmax*factorIncrease; + pWS = boxWS; pEN = boxEN; diff --git a/program2D/source/interpol/interpolTwoD.h b/program2D/source/interpol/interpolTwoD.h index 326f2bdd5dd4533be002ba7c01ed34ec597897f0..0ecdbc20f3793c0bf792e8447734ce5d26890879 100644 --- a/program2D/source/interpol/interpolTwoD.h +++ b/program2D/source/interpol/interpolTwoD.h @@ -76,7 +76,7 @@ class Interpolate_on_structured_2Dgrid { * preparation for interpolation @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 Interpolate_on_structured_2Dgrid_with_data(int nx_, int ny_, D2vector pWS, D2vector pEN, 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); @@ -361,8 +361,8 @@ Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgr } template <class DTyp> -Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgrid_with_data(Blockgrid2D& blockgrid_) - : Interpolate_on_structured_2Dgrid(&blockgrid_) { +Interpolate_on_structured_2Dgrid_with_data<DTyp>::Interpolate_on_structured_2Dgrid_with_data(Blockgrid2D& blockgrid_, double factorIncrease) + : Interpolate_on_structured_2Dgrid(&blockgrid_, factorIncrease) { data = new DTyp[nx*ny]; for(int i=0;i<nx*ny;++i) data[i] = 0.0; }