Commit 09102163 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

face transform almost finished. missing is only the correct implementation of...

face transform almost finished. missing is only the correct implementation of edge transform, in case face transform is present.
parent a93df634
......@@ -486,22 +486,8 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
hex = ug->Give_hexahedron ( id_hex );
// cout << "for testing, calculating psi twice, delete this part !!!!" << endl;
// for ( int ed = 0; ed < 12; ++ed )
// {
// p = find_p ( ( Edges_cell ) ed,eta,xi,phi );
// Psi[ed] = hex->transform[ed] ( change ( hex->orientation[ed],p ) ,
// hex->shiftPointer(ug->Get_pointer_global_data()));
// PL = hex->Give_coord ( Transform ( ( Edges_cell ) ed,Ldir1D ) );
// PR = hex->Give_coord ( Transform ( ( Edges_cell ) ed,Rdir1D ) );
// Psi[ed] = Psi[ed] + PL + ( PR-PL ) * p;
// }
//enum dir3D_sons { WSDdir3D, ESDdir3D, WNDdir3D, ENDdir3D, WSTdir3D, ESTdir3D, WNTdir3D, ENTdir3D };
int idWSD = hex->Give_id_corner(WSDdir3D);
int idESD = hex->Give_id_corner(ESDdir3D);
int idWND = hex->Give_id_corner(WNDdir3D);
......@@ -617,45 +603,7 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
for ( int md = 0; md < 3; ++md )
{
//for testing, which side is the correct one!
// std::vector<int> iterList = {i,j,k};
// std::vector<int> iterSides = { idW , idE , idS , idN , idD , idT};
// D3vector temp;
// for ( int ed = 1; ed < 12; ++ed )
// {
// temp = Psi[ed];
// for(auto iterID=iterSides.begin(); iterID!=iterSides.end(); ++iterID)
// {
// for(auto t=iterList.begin(); t!=iterList.end(); ++t)
// {
// cout << "( " <<*iterID << " , "<< *t << " , " << "0" << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,*t,0));
// cout << "( " <<*iterID << " , n-"<< *t << " , " << "0" << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,nEdge-*t,0));
// cout << "( " <<*iterID << " , "<< 0 << " , " << *t << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,0,*t));
// cout << "( " <<*iterID << " , "<< 0 << " , n-" << *t << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,0,nEdge-*t));
// cout << "( " <<*iterID << " , "<< *t << " , " << "n"<< ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,*t,nEdge));
// cout << "( " <<*iterID << " , n-"<< *t << " , " << "n" << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,nEdge-*t,nEdge));
// cout << "( " <<*iterID << " , n" << " , " << *t << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,nEdge,*t));
// cout << "( " <<*iterID << " , "<< "n" << " , " << "n-"<<*t << ")"<<endl;
// compareVectors(temp,Give_coord_quadrangle(*iterID,nEdge,nEdge-*t));
// }
// }
// cout << endl;
// }
......@@ -911,10 +859,6 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
p_EW = xi;
p_NS = phi;
// cout << "md0: old ";
// D3vector t = ( PSW +( PSE - PSW ) * p_EW +( PNW - PSW ) * p_NS +( PNE - PSE - PNW + PSW ) * p_EW * p_NS);
// t.Print();
// cout<<endl;
}
if ( md==1 ) // NS
{
......@@ -925,10 +869,6 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
p_EW = eta;
p_NS = phi;
// cout << "md1: old ";
// D3vector t = ( PSW +( PSE - PSW ) * p_EW +( PNW - PSW ) * p_NS +( PNE - PSE - PNW + PSW ) * p_EW * p_NS);
// t.Print();
// cout<<endl;
}
if ( md==2 ) // TD
{
......@@ -939,10 +879,6 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
p_EW = eta;
p_NS = xi;
// cout << "md2: old ";
// D3vector t = ( PSW +( PSE - PSW ) * p_EW +( PNW - PSW ) * p_NS +( PNE - PSE - PNW + PSW ) * p_EW * p_NS);
// t.Print();
// cout<<endl;
}
// Version: 0 x Flaechen + 1 x Kanten + 3 x Ecken
......@@ -966,18 +902,7 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
Pres = Pres -
2.0 * ( PD + ( PT-PD ) * phi );
//cout << "PT-PD old ";( PD + ( PT-PD ) * phi ).Print();cout<<endl;
//if (!(PresQuad==Pres))
//{
// cout << "Pres with quadrangle: "<<endl;
// PresQuad.Print();
// cout<<endl;
// cout << "Pres without quadrangle: "<<endl;
// Pres.Print();
// cout<<endl;
// cout<<endl;
//}
if ( hex->transform_hex== NULL )
return Pres;
else
......@@ -1064,6 +989,9 @@ D3vector Blockgrid::Give_coord_edge ( int id, int i ) const
{
//Phillip hinzu
//ACHTUNG : an kanten stimmt es noch nicht ganz. ähnlich wie bei give_coord_hexahedra, manchmal stimmt die richtung nicht ( n-i anstatt i) oder n anstatt 0.
//test überlegen, der das hinbekommt? vllt einfacher:
Quadrangle_el* quad;
D3vector Psi;
//if ()
......
......@@ -112,11 +112,7 @@ D3vector transform_right_lens_inner_quad ( double t1, double t2, double* pointer
t2 = temp;
double t = t2;
t2 = (1-t2);
double x = -( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
x = y = 0;
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
......@@ -126,38 +122,25 @@ D3vector transform_right_lens_inner_quad ( double t1, double t2, double* pointer
actualY = -actualY;
actualX = -actualX;
double actualRadius = (actualY*actualY+actualX*actualX);
double z = 0;
double radiusSquared = (actualY*actualY+actualX*actualX);
z = offsetZ_global_data
+sign*(( sqrt(pow(curvatureRight_global_data,2)- actualRadius) //pow(r_global_data,2) * (t*t + (1-t)*(1-t)))
double z = offsetZ_global_data
+sign*(( sqrt(pow(curvatureRight_global_data,2)- radiusSquared) //pow(r_global_data,2) * (t*t + (1-t)*(1-t)))
+sign*(- curvatureRight_global_data + (thickness_global_data-z_right_inner_global_data)) ));
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
//cout << "x " << actualX << " y " << actualY <<endl;
if ( fabs(x) > 1e-10 || fabs(y) > 1e-10 || fabs(z) > 1e-10)
if ( fabs(z) > 1e-10)
{
cout << " stop "<<endl;
}
}
// if (( t1 == 0 && t2 == 0.5)||( t1 == 1 && t2 == 0.5)||( t1 == 0.5 && t2 == 0)||( t1 == 0.5 && t2 == 1))
// {
// cout << " actualX " <<actualX << endl;
// cout << " actualY " <<actualY << endl;
// cout << " offsetZ_global_data " << offsetZ_global_data<< endl;
// cout << " sign " << sign<< endl;
// cout << " z_right_inner_global_data " <<z_right_inner_global_data << endl;
// cout << " thickness_global_data " <<thickness_global_data << endl;
// cout << " curvatureRight_global_data " << curvatureRight_global_data<< endl;
// cout << "z " << z << endl;
// cout << endl;
// }
//return D3vector (0 , 0 , fabs((t1-0)*(t2-0)*(t1-1)*(t2-1)) * 10);
return D3vector (0 , 0 , z);
return R_global_data*D3vector ( x,y,z);
// return R_global_data*D3vector ( x,y,z);
}
D3vector transform_left_lens_inner_quad ( double t1, double t2, double* pointer_global_data) {
......@@ -176,11 +159,9 @@ D3vector transform_left_lens_inner_quad ( double t1, double t2, double* pointer_
t2 = temp;
double t = t2;
t2 = (1-t2);
double x = -( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
x = y = 0;
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
......@@ -195,21 +176,18 @@ D3vector transform_left_lens_inner_quad ( double t1, double t2, double* pointer_
double z = 0;
z = offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-actualRadius)
- sign* (curvatureLeft_global_data - z_left_inner_global_data)) );
z = offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-actualRadius) - sign* (curvatureLeft_global_data - z_left_inner_global_data)) );
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
//cout << "x " << actualX << " y " << actualY <<endl;
if ( fabs(x) > 1e-10 || fabs(y) > 1e-10 || fabs(z) > 1e-10)
if ( fabs(z) > 1e-10)
{
cout << " stop "<<endl;
}
}
return D3vector (0 , 0 , z);
return R_global_data*D3vector ( x,y,z);
}
D3vector transform_left_lens_diag_NW_quad ( double t1, double t2, double* pointer_global_data) {
......@@ -228,19 +206,22 @@ D3vector transform_left_lens_diag_NW_quad ( double t1, double t2, double* pointe
t2 = temp;
double t = t2;
// t2 = (1-t2);
double x = -( sin ( t1*0.5*M_PI )-t1);
double x = -R_global_data*( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = R_global_data*(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
//x = y = 0;
//double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double z = 0;
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;
actualX = -actualX;
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double z =offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-radiusSquared) +sign *(-curvatureLeft_global_data +( (1-t)*z_left_inner_global_data + t * z_left_outer_global_data))));
if (std::isnan(z))
{z = 0;}
return R_global_data*D3vector ( x,y,z);
return D3vector ( x,y,z);
}
......@@ -285,38 +266,74 @@ D3vector transform_right_lens_diag_SW_quad ( double t1, double t2, double* point
}
D3vector transform_left_lens_diag_SW_quad ( double t1, double t2, double* pointer_global_data) {
double R_global_data = pointer_global_data[0];
double R_global_data = pointer_global_data[0];
double r_global_data = pointer_global_data[1];
double curvatureLeft_global_data = pointer_global_data[2];
double curvatureRight_global_data = pointer_global_data[3];
double thickness_global_data = pointer_global_data[4];
double offsetZ_global_data = pointer_global_data[5];
double z_left_inner_global_data = pointer_global_data[6];
double z_left_outer_global_data = pointer_global_data[7];
double z_right_inner_global_data = pointer_global_data[8];
double z_right_outer_global_data = pointer_global_data[9];
double temp = t1;
t1 = t2;
t2 = temp;
// t2 = (1-t2);
double x = -( sin ( t1*0.5*M_PI )-t1);
double t = t2;
double x = -R_global_data *( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = -(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
double z = 0;
//x = y = 0;
return R_global_data*D3vector ( x,y,z);
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 radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
double z =offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-radiusSquared) +sign *(-curvatureLeft_global_data +( (1-t)*z_left_inner_global_data + t * z_left_outer_global_data))));
if (std::isnan(z))
{z = 0;}
return D3vector ( x,y,z);
}
D3vector transform_left_lens_diag_SE_quad ( double t1, double t2, double* pointer_global_data) {
double R_global_data = pointer_global_data[0];
double R_global_data = pointer_global_data[0];
double r_global_data = pointer_global_data[1];
double curvatureLeft_global_data = pointer_global_data[2];
double curvatureRight_global_data = pointer_global_data[3];
double thickness_global_data = pointer_global_data[4];
double offsetZ_global_data = pointer_global_data[5];
double z_left_inner_global_data = pointer_global_data[6];
double z_left_outer_global_data = pointer_global_data[7];
double z_right_inner_global_data = pointer_global_data[8];
double z_right_outer_global_data = pointer_global_data[9];
double temp = t1;
t1 = t2;
t2 = temp;
// t2 = (1-t2);
double x = ( sin ( t1*0.5*M_PI )-t1);
double t = t2;
double x =R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = -(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = -R_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
double z = 0;
//x = y = 0;
return R_global_data*D3vector ( x,y,z);
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;
double sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
double z =offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-radiusSquared) +sign *(-curvatureLeft_global_data +( (1-t)*z_left_inner_global_data + t * z_left_outer_global_data))));
if (std::isnan(z))
{z = 0;}
return D3vector ( x,y,z);
}
D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* pointer_global_data) {
double R_global_data = pointer_global_data[0];
double R_global_data = pointer_global_data[0];
double r_global_data = pointer_global_data[1];
double curvatureLeft_global_data = pointer_global_data[2];
double curvatureRight_global_data = pointer_global_data[3];
......@@ -354,18 +371,44 @@ D3vector transform_right_lens_diag_SE_quad ( double t1, double t2, double* point
}
D3vector transform_left_lens_diag_NE_quad ( double t1, double t2, double* pointer_global_data) {
double R_global_data = pointer_global_data[0];
double R_global_data = pointer_global_data[0];
double r_global_data = pointer_global_data[1];
double curvatureLeft_global_data = pointer_global_data[2];
double curvatureRight_global_data = pointer_global_data[3];
double thickness_global_data = pointer_global_data[4];
double offsetZ_global_data = pointer_global_data[5];
double z_left_inner_global_data = pointer_global_data[6];
double z_left_outer_global_data = pointer_global_data[7];
double z_right_inner_global_data = pointer_global_data[8];
double z_right_outer_global_data = pointer_global_data[9];
double temp = t1;
t1 = t2;
t2 = temp;
// t2 = (1-t2);
double x = ( sin ( t1*0.5*M_PI )-t1);
double t = t2;
double x = R_global_data * ( sin ( t1*0.5*M_PI )-t1);
x = x*t2;
double y = (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
double y = R_global_data * (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
double z = 0;
//x = y = 0;
return R_global_data*D3vector ( x,y,z);
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 sign = (curvatureRight_global_data > 0) ? 1 : ((curvatureRight_global_data < 0) ? -1 : 0) ;
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
double z = offsetZ_global_data+
sign*( ( sqrt(pow(curvatureRight_global_data,2)-radiusSquared)
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
z =offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-radiusSquared) +sign *(-curvatureLeft_global_data +( (1-t)*z_left_inner_global_data + t * z_left_outer_global_data))));
if (std::isnan(z))
{z = 0;}
return D3vector ( x,y,z);
}
D3vector transform_diag_inner_faces_NE_quad( double t1, double t2, double* pointer_global_data) {
......@@ -399,14 +442,13 @@ D3vector transform_diag_inner_faces_NE_quad( double t1, double t2, double* point
radiusSquared = radiusSquared * radiusSquared;
//WORKONLYHERE
double z = offsetZ_global_data+
double zRight = offsetZ_global_data+
sign*( ( sqrt(pow(curvatureRight_global_data,2)-
( radiusSquared))
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
z=0;
double z = zRight * (1-t1) ;
z = 0;
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
if ( fabs(z) > 1e-10)
......@@ -447,13 +489,15 @@ D3vector transform_inner_faces_NE_quad( double t1, double t2, double* pointer_gl
double y = r_global_data* (t1);
double radiusSquared = x*x+y*y;
double z = offsetZ_global_data
double zRight = offsetZ_global_data
+sign*(( sqrt(pow(curvatureRight_global_data,2)- radiusSquared) //pow(r_global_data,2) * (t*t + (1-t)*(1-t)))
+sign*(- curvatureRight_global_data + (thickness_global_data-z_right_inner_global_data)) ));
double zLeft = offsetZ_global_data
+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)- radiusSquared)
- sign* (curvatureLeft_global_data - z_left_inner_global_data)) );
//works for one side only:
z = z * (t2);
double z = zRight * (t2) + zLeft * (1-t2);
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
......@@ -988,7 +1032,7 @@ LensQuadrangle::LensQuadrangle(double Radius, double radius, double thickness, d
//inner block: corner ids: 0 2 4 6 8 10 12 14
Set_transformation_face(0,2,4,6,transform_quadrangle_NULL); // z=0 plane transform_left_lens_inner_quad
Set_transformation_face(0,2,4,6,transform_left_lens_inner_quad); // z=0 plane transform_left_lens_inner_quad
Set_transformation_face(0,2,8,10,transform_inner_faces_NE_quad); //transform_inner_quad_NE transform_inner_quad_NW transform_inner_quad_SW transform_inner_quad_SE
Set_transformation_face(2,4,10,12,transform_inner_faces_NE_quad); //??
Set_transformation_face(4,6,12,14,transform_inner_faces_NE_quad); //??
......@@ -1000,16 +1044,16 @@ LensQuadrangle::LensQuadrangle(double Radius, double radius, double thickness, d
Set_transformation_face(0,1,8,9,transform_diag_inner_faces_NE_quad);
Set_transformation_face(0,2,8,10,transform_inner_faces_NE_quad);
Set_transformation_face(2,3,10,11,transform_diag_inner_faces_NE_quad);
Set_transformation_face(1,3,9,11,transform_outer_boundary_NE); // transform_boundary_NE
Set_transformation_face(1,3,9,11,transform_outer_boundary_NE); //
Set_transformation_face(8,9,10,11,transform_right_lens_diag_NE_quad);
//north-west block: corner ids: 2 3 4 5 10 11 12 13
Set_transformation_face(2,3,4,5,transform_left_lens_diag_NW_quad);//
Set_transformation_face(2,3,4,5,transform_left_lens_diag_NW_quad);//transform_left_lens_diag_NW_quad
Set_transformation_face(2,3,10,11,transform_diag_inner_faces_NE_quad);
Set_transformation_face(2,4,10,12,transform_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_boundary_NW
Set_transformation_face(10,11,12,13,transform_right_lens_diag_NW_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
//bottom-west block: corner ids: 4 5 6 7 12 13 14 15
//eher: S-W-BLOCK
......
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