Commit 4f3e9058 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

trilinear interpolation for grids available, but doesn't always give good...

trilinear interpolation for grids available, but doesn't always give good results. needs to be improved
parent 1178403f
......@@ -372,6 +372,11 @@ inline std::vector<int> find_p_quad ( dir3D quad, Hexahedron_el *hex )
// WDed, EDed, WTed, ETed,
// SWed, SEed, NWed, NEed };
std::vector<int> ijk = {1 , 1 , 1};
// for (int iter = 0 ; iter < 12; iter++)
// {
// std::cout << hex->orientation[iter] << "\n" ;
// }
// std::cout << std::endl;
if (quad == Wdir3D)
{
......@@ -550,14 +555,45 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
int quadWaddK = (p_quad_Wdir3D[2] == 1) ? 0 : nEdgeZ;
// std::cout <<"Nx " << Give_Nx_quadrangle ( idW ) << " Ny " << Give_Ny_quadrangle ( idW ) << "\n";
// std::cout <<"Nx " << Give_Nx_quadrangle ( idE ) << " Ny " << Give_Ny_quadrangle ( idE ) << "\n";
// std::cout <<"Nx " << Give_Nx_quadrangle ( idS ) << " Ny " << Give_Ny_quadrangle ( idS ) << "\n";
// std::cout <<"Nx " << Give_Nx_quadrangle ( idN ) << " Ny " << Give_Ny_quadrangle ( idN ) << "\n";
// std::cout <<"Nx " << Give_Nx_quadrangle ( idD ) << " Ny " << Give_Ny_quadrangle ( idD ) << "\n";
// std::cout <<"Nx " << Give_Nx_quadrangle ( idT ) << " Ny " << Give_Ny_quadrangle ( idT ) << std::endl;
// std::cout << std::endl;
// std::cout << " transface coordiantes: "<< std::endl;
//with modification
QPsi[0] = Give_coord_quadrangle( idW , quadWaddJ + j*p_quad_Wdir3D[1] , quadWaddK + k*p_quad_Wdir3D[2]);
QPsi[1] = Give_coord_quadrangle( idE , quadEaddJ + j*p_quad_Edir3D[1] , quadEaddK + k*p_quad_Edir3D[2]);
QPsi[2] = Give_coord_quadrangle( idS , quadSaddI + i*p_quad_Sdir3D[0] , quadSaddK + k*p_quad_Sdir3D[2]);
QPsi[3] = Give_coord_quadrangle( idN , quadNaddI + i*p_quad_Ndir3D[0] , quadNaddK + k*p_quad_Ndir3D[2]);
QPsi[4] = Give_coord_quadrangle( idD , quadDaddI + i*p_quad_Ddir3D[0] , quadDaddJ + j*p_quad_Ddir3D[1]);
QPsi[5] = Give_coord_quadrangle( idT , quadTaddI + i*p_quad_Tdir3D[0] , quadTaddJ + j*p_quad_Tdir3D[1]);
bool invertTD = false;
bool invertNS = false;
bool invertEW = false;
if (!(nEdgeY == Give_Nx_quadrangle ( idW ) && nEdgeZ == Give_Ny_quadrangle ( idW )))
{
invertEW = true;
}
if (!(nEdgeX == Give_Nx_quadrangle ( idS ) && nEdgeZ == Give_Ny_quadrangle ( idS ) ))
{
invertNS = true;
}
if (!(nEdgeX == Give_Nx_quadrangle ( idD ) && nEdgeY == Give_Ny_quadrangle ( idD )))
{
invertTD = true;
}
QPsi[0] = Give_coord_quadrangle( idW , quadWaddJ + j*p_quad_Wdir3D[1] , quadWaddK + k*p_quad_Wdir3D[2],invertEW);
QPsi[1] = Give_coord_quadrangle( idE , quadEaddJ + j*p_quad_Edir3D[1] , quadEaddK + k*p_quad_Edir3D[2],invertEW);
QPsi[2] = Give_coord_quadrangle( idS , quadSaddI + i*p_quad_Sdir3D[0] , quadSaddK + k*p_quad_Sdir3D[2],invertNS);
QPsi[3] = Give_coord_quadrangle( idN , quadNaddI + i*p_quad_Ndir3D[0] , quadNaddK + k*p_quad_Ndir3D[2],invertNS);
QPsi[4] = Give_coord_quadrangle( idD , quadDaddI + i*p_quad_Ddir3D[0] , quadDaddJ + j*p_quad_Ddir3D[1],invertTD);
QPsi[5] = Give_coord_quadrangle( idT , quadTaddI + i*p_quad_Tdir3D[0] , quadTaddJ + j*p_quad_Tdir3D[1],invertTD);
//delete again!!!
// QPsi[5] = Give_coord_quadrangle( idT , quadTaddJ + j*p_quad_Tdir3D[1] , quadTaddI + i*p_quad_Tdir3D[0]);
//std::cout << std::endl;
// Version: 1 x Flaechen + 2 x Kanten + 3 x Ecken
// /////////////////////////////////////////////////////////
Pres = (QPsi[0] + eta * (QPsi[1]-QPsi[0]) + QPsi[2] + xi * (QPsi[3]-QPsi[2]) + QPsi[4] + phi * (QPsi[5]-QPsi[4]));
......@@ -597,21 +633,21 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
if ( md==0 ) // EW
{
PSW = Give_coord_quadrangle(idS,quadSaddI+i*p_quad_Sdir3D[0] ,quadSaddK);
PSW = Give_coord_quadrangle(idS,quadSaddI+i*p_quad_Sdir3D[0] ,quadSaddK, invertNS);
if(coordianteFromCorners)
PSW = Psi[SDed];
PSE = Give_coord_quadrangle(idN,quadNaddI+i * p_quad_Ndir3D[0],quadNaddK);
PSE = Give_coord_quadrangle(idN,quadNaddI+i * p_quad_Ndir3D[0],quadNaddK, invertNS);
if(coordianteFromCorners)
PSE = Psi[NDed];
PNW = Give_coord_quadrangle(idS,quadSaddI+i*p_quad_Sdir3D[0] ,nEdgeZ-quadSaddK);
PNW = Give_coord_quadrangle(idS,quadSaddI+i*p_quad_Sdir3D[0] ,nEdgeZ-quadSaddK, invertNS);
if(coordianteFromCorners)
PNW = Psi[STed];
PNE = Give_coord_quadrangle(idN,quadNaddI+i * p_quad_Ndir3D[0],nEdgeZ-quadNaddK);
PNE = Give_coord_quadrangle(idN,quadNaddI+i * p_quad_Ndir3D[0],nEdgeZ-quadNaddK, invertNS);
if(coordianteFromCorners)
PNE = Psi[NTed];
......@@ -625,21 +661,21 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
{
PSW = Give_coord_quadrangle(idD,quadDaddI,quadDaddJ+j*p_quad_Ddir3D[1]);
PSW = Give_coord_quadrangle(idD,quadDaddI,quadDaddJ+j*p_quad_Ddir3D[1], invertTD);
if(coordianteFromCorners)
PSW = Psi[WDed];
PSE = Give_coord_quadrangle(idD,nEdgeX-quadDaddI,quadDaddJ+j*p_quad_Ddir3D[1]);
PSE = Give_coord_quadrangle(idD,nEdgeX-quadDaddI,quadDaddJ+j*p_quad_Ddir3D[1], invertTD);
if(coordianteFromCorners)
PSE = Psi[EDed];
PNW = Give_coord_quadrangle(idT,quadTaddI,quadTaddJ+j*p_quad_Tdir3D[1]);
PNW = Give_coord_quadrangle(idT,quadTaddI,quadTaddJ+j*p_quad_Tdir3D[1], invertTD);
if(coordianteFromCorners)
PNW = Psi[WTed];
PNE = Give_coord_quadrangle(idT,nEdgeX-quadTaddI,quadTaddJ+j*p_quad_Tdir3D[1]);
PNE = Give_coord_quadrangle(idT,nEdgeX-quadTaddI,quadTaddJ+j*p_quad_Tdir3D[1], invertTD);
if(coordianteFromCorners)
PNE = Psi[ETed];
......@@ -654,20 +690,20 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
{
PSW = Give_coord_quadrangle(idW,quadWaddJ,quadWaddK+k*p_quad_Wdir3D[2]);
PSW = Give_coord_quadrangle(idW,quadWaddJ,quadWaddK+k*p_quad_Wdir3D[2], invertEW);
if(coordianteFromCorners)
PSW = Psi[SWed];
PSE = Give_coord_quadrangle(idE,quadEaddJ,quadEaddK+k*p_quad_Edir3D[2]);
PSE = Give_coord_quadrangle(idE,quadEaddJ,quadEaddK+k*p_quad_Edir3D[2], invertEW);
if(coordianteFromCorners)
PSE = Psi[SEed];
PNW = Give_coord_quadrangle(idW,nEdgeY-quadWaddJ,quadWaddK+k*p_quad_Wdir3D[2]);
PNW = Give_coord_quadrangle(idW,nEdgeY-quadWaddJ,quadWaddK+k*p_quad_Wdir3D[2], invertEW);
if(coordianteFromCorners)
PNW = Psi[NWed];
PNE = Give_coord_quadrangle(idE,nEdgeY-quadEaddJ,quadEaddK+k*p_quad_Edir3D[2]);
PNE = Give_coord_quadrangle(idE,nEdgeY-quadEaddJ,quadEaddK+k*p_quad_Edir3D[2], invertEW);
if(coordianteFromCorners)
PNE = Psi[NEed];
......@@ -764,7 +800,7 @@ D3vector Blockgrid::Give_coord_hexahedron ( int id_hex,
return Pres + hex->transform_hex ( id_hex,eta,xi,phi );
}
D3vector Blockgrid::Give_coord_quadrangle ( int id, int i, int j ) const
D3vector Blockgrid::Give_coord_quadrangle (int id, int i, int j, bool invert) const
{
if(bg_coord != NULL) if(bg_coord->blockgrid_quad_coordinates_calculated)
{
......@@ -775,6 +811,8 @@ D3vector Blockgrid::Give_coord_quadrangle ( int id, int i, int j ) const
}
double eta, xi;
D3vector PSW, PSE, PNW, PNE, PW, PE, PN, PS;
D3vector PTransFace, PWithoutTrans;
......@@ -783,9 +821,30 @@ D3vector Blockgrid::Give_coord_quadrangle ( int id, int i, int j ) const
quad = this->ug->Give_quadrangle ( id );
double Nx = (double) Give_Nx_quadrangle ( id );
double Ny = ( double ) Give_Ny_quadrangle ( id );
// std::cout << "nx ny " << Nx << " " << Ny << std::endl;
// if (id == 23 && Nx != Ny)
// {
// std::cout << "break";
// }
// std::cout << "nx ny " << Nx << " " << Ny << std::endl;
if (invert)
{
double temp = Nx; Nx = Ny; Ny = temp;
}
//std::cout << "nx ny " << Nx << " " << Ny << std::endl;
eta = ( double ) i/ Nx;
xi = ( double ) j/ Ny;
if (eta > 1 || xi > 1)
{
std::cout << "debug : flag is " << invert << ", but should be " << !invert << std::endl;
std::cout << std::endl;
}
eta = ( double ) i/ ( double ) Give_Nx_quadrangle ( id );
xi = ( double ) j/ ( double ) Give_Ny_quadrangle ( id );
// @todo : so sollte es sein
PSW = quad->Give_coord ( SWdir2D );
......@@ -814,7 +873,9 @@ D3vector Blockgrid::Give_coord_quadrangle ( int id, int i, int j ) const
if (quad->transform != NULL)
{
PTransFace = quad->transform ( eta, xi, quad->shiftPointer(ug->Get_pointer_global_data()));
PTransFace = PSW + (PSE-PSW) * eta + (PNW-PSW)*xi + (PNE-PSE-PNW+PSW)*xi*eta + PTransFace;
//std::cout << "PTransFace ";PTransFace.Print();
D3vector TEMP = PSW + (PSE-PSW) * eta + (PNW-PSW)*xi + (PNE-PSE-PNW+PSW)*xi*eta ;
PTransFace = TEMP + PTransFace;// + PTransFace;
return PTransFace;
}
......@@ -849,7 +910,6 @@ D3vector Blockgrid::Give_coord_edge ( int id, int i ) const
if(bg_coord != NULL) if(bg_coord->blockgrid_edge_coordinates_calculated)
{
return bg_coord->blockgrid_edge_coordinates.at(id).at(i) ;
}
......@@ -903,49 +963,85 @@ D3vector Blockgrid::Give_coord_edge ( int id, int i ) const
}
}
}
ug->Set_edge_to_hex_id(id, idHex);
ug->Set_edge_to_quad_id(id,quadId);
ug->Set_edge_to_quad_dir(id,(int)dirForQuad);
}
else
{
idHex = ug->Give_edge_to_hex_id(id);
quadId = ug->Give_edge_to_quad_id(id);
dirForQuad = (dir3D)ug->Give_edge_to_quad_dir(id);
quad = ug->Give_quadrangle(quadId);
}
int Nx = Give_Nx_quadrangle(dirForQuad);
int Ny = Give_Ny_quadrangle(dirForQuad);
int Nx = Give_Nx_quadrangle(quadId);
int Ny = Give_Ny_quadrangle(quadId);
int nEdgeX = Give_Nx_hexahedron ( idHex );
int nEdgeY = Give_Ny_hexahedron ( idHex );
int nEdgeZ = Give_Nz_hexahedron ( idHex );
bool invert = false;
// std::cout << "dirForQuad " << dirForQuad << std::endl;
// std::cout << "Nx " << Nx << " Ny " << Ny << std::endl;
// if (!(Nx == Give_Nx_quadrangle ( dirForQuad ) && Ny == Give_Ny_quadrangle ( dirForQuad ) ))
// {
// invert = true;
// }
// if (dirForQuad == Edir3D || dirForQuad == Wdir3D)
// {
// if (!(nEdgeY == Give_Nx_quadrangle ( dirForQuad ) && nEdgeZ == Give_Ny_quadrangle ( dirForQuad ) ))
// {
// invert = true;
// }
// }
// else if (dirForQuad == Ndir3D || dirForQuad == Sdir3D)
// {
// if (!(nEdgeX == Give_Nx_quadrangle ( dirForQuad ) && nEdgeZ == Give_Ny_quadrangle ( dirForQuad ) ))
// {
// invert = true;
// }
// }
// else if (dirForQuad == Tdir3D || dirForQuad == Ddir3D)
// {
// if (!(nEdgeX == Give_Nx_quadrangle ( dirForQuad ) && nEdgeY == Give_Ny_quadrangle ( dirForQuad )))
// {
// invert = true;
// }
// }
// else
// {
// std::cout << "should not happen, dirForQuad only has 6 possibilities\n";
// }
if (Nx == nEdgeX && Ny == nEdgeY || Nx == nEdgeX && Ny == nEdgeZ || Nx == nEdgeY && Ny == nEdgeZ )
{
invert = false;
}
else
{
invert = true;
}
invert = false;
if (id == quad->Give_id_edge(Wdir2D)) //Wdir2D
{
Psi = Give_coord_quadrangle(quadId,0,i);
Psi = Give_coord_quadrangle(quadId,0,i,invert);
}
if (id == quad->Give_id_edge(Edir2D)) //Edir2D
{
Psi = Give_coord_quadrangle(quadId,Nx,i);
Psi = Give_coord_quadrangle(quadId,Nx,i,invert);
}
if (id == quad->Give_id_edge(Sdir2D)) //Sdir2D
{
Psi = Give_coord_quadrangle(quadId,i,0);
Psi = Give_coord_quadrangle(quadId,i,0,invert);
}
if (id == quad->Give_id_edge(Ndir2D)) //Ndir2D
{
Psi = Give_coord_quadrangle(quadId,i,Ny);
Psi = Give_coord_quadrangle(quadId,i,Ny,invert);
}
return Psi;
......@@ -1066,6 +1162,8 @@ void Blockgrid_coordinates::init_blockgrid_coordinates()
}
}
//test:: ??? Nx = 3????
blockgrid_edge_coordinates.resize(bg->Give_unstructured_grid()->Give_number_edges());
for (int id_edge = 0 ; id_edge < bg->Give_unstructured_grid()->Give_number_edges() ; id_edge++)
{
......
......@@ -114,7 +114,7 @@ class Blockgrid {
void Set_blockgrid_coordinates(Blockgrid_coordinates* bg_coord_ ) { bg_coord = bg_coord_; };
D3vector Give_coord_hexahedron(int id, int i, int j, int k) const ;
D3vector Give_coord_quadrangle(int id, int i, int j) const;
D3vector Give_coord_quadrangle(int id, int i, int j, bool invert = false) const;
D3vector Give_coord_edge(int id, int i) const;
D3vector Give_coord_point(int id) const;
......
......@@ -450,6 +450,7 @@ D3vector transform_left_lens_diag_NE_quad ( double t1, double t2, double* pointe
}
D3vector transform_diag_inner_faces_NE_quad( double t1, double t2, double* pointer_global_data) {
return D3vector{0,0,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];
......@@ -507,6 +508,7 @@ D3vector transform_diag_inner_faces_NE_quad( double t1, double t2, double* point
}
D3vector transform_diag_inner_faces_NE_quad_cut( double t1, double t2, double* pointer_global_data) {
return D3vector{0,0,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];
......@@ -562,6 +564,7 @@ D3vector transform_diag_inner_faces_NE_quad_cut( double t1, double t2, double* p
zLeft = 0;
}
double z = zRight * (t1) + zLeft * (1-t1) ;
if (( t1 == 0 && t2 == 0)||( t1 == 1 && t2 == 0)||( t1 == 0 && t2 == 1)||( t1 == 1 && t2 == 1))
{
......@@ -658,8 +661,12 @@ D3vector transform_right_lens_diag_NE_quad ( double t1, double t2, double* point
radiusSquared)
+ sign*(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data)))));
//std::cout << "z inner " << z << std::endl;
if (std::isnan(x) || std::isnan(y) || std::isnan(z))
{ z = 0;}
// std::cout << "transform_right_lens_diag_NE_quad ";
// D3vector ( x,y,z).Print();
// std::cout << std::endl;
return D3vector ( x,y,z);
}
......@@ -1060,13 +1067,15 @@ D3vector transform_left_lens_diag_NE_quad_cut ( double t1, double t2, double* po
x = x*t2;
double y = R_global_data * (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
double xT = x;
double yT = y;
//added due to bended inner part :
double xAdd = r_global_data * ( sin ( t1*0.5*M_PI )-t1);
double yAdd = r_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
x += (1-t2) * xAdd;
y += (1-t2) * yAdd;
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;
......@@ -1079,12 +1088,14 @@ D3vector transform_left_lens_diag_NE_quad_cut ( double t1, double t2, double* po
if (z_left_inner_global_data == z_left_outer_global_data)
{
//std::cout << "set to zero again!\n";
z = 0;
}
if (std::isnan(z))
{z = 0;}
//return D3vector ( xT,yT,z);
return D3vector ( x,y,z);
}
......@@ -1121,6 +1132,8 @@ D3vector transform_right_lens_diag_NE_quad_cut ( double t1, double t2, double* p
double y = R_global_data * (cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
y = y*t2;
double xT = x;
double yT = y;
//added due to bended inner part :
double xAdd = r_global_data * ( sin ( t1*0.5*M_PI )-t1);
double yAdd = r_global_data *(cos ( t1*0.5*M_PI )- ( 1-t1 )) ;
......@@ -1133,11 +1146,18 @@ D3vector transform_right_lens_diag_NE_quad_cut ( double t1, double t2, double* p
double radiusSquared = ((x+actualX)*(x+actualX)+(y+actualY)*(y+actualY));
// std::cout << "(-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data))) " << (-curvatureRight_global_data +( (1-t)*(thickness_global_data-z_right_inner_global_data) + t * (thickness_global_data-z_right_outer_global_data))) << "\n";
// std::cout << "t1,2 :: " << t1 << " " << t2 << "\n";
//std::cout << "radius " << sqrt(radiusSquared) << std::endl;
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 =radiusSquared;
//z *= 10;
//z = 1;
//std::cout << "z outer" << z << std::endl;
// double ADAD = offsetZ_global_data+sign*(-1*( sqrt(pow(curvatureLeft_global_data,2)-pow(r_global_data * (1-t) + R_global_data * t,2)) +sign *(-curvatureLeft_global_data +( (1-t)*z_left_inner_global_data + t * z_left_outer_global_data))));
if (z_right_inner_global_data == z_right_outer_global_data)
{
......@@ -1146,7 +1166,19 @@ 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);
}
......@@ -2021,17 +2053,26 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
//1,16,3,17,1+8,16+4,3+8,17+4
Set_transformation_face(1,16,3,17,transform_left_lens_diag_NE_quad_cut);
Set_transformation_face(1,16,9,20,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(1,3,9,11,transform_quadrangle_NULL); // inner face : no transform necessary
//Set_transformation_face(1,3,9,11,transform_quadrangle_NULL); // inner face : no transform necessary
Set_transformation_face(1,3,9,11,transform_outer_boundary_NE); // inner face :
Set_transformation_face(3,17,11,21,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(16,17,20,21,transform_outer_boundary_NE_cut); //
Set_transformation_face(9,20,11,21,transform_right_lens_diag_NE_quad_cut);
//all set to zero!!!
// Set_transformation_face(1,16,3,17,transform_quadrangle_NULL);
// Set_transformation_face(1,16,9,20,transform_diag_inner_faces_NE_quad_cut);
// Set_transformation_face(1,3,9,11,transform_quadrangle_NULL); // inner face :
// Set_transformation_face(3,17,11,21,transform_diag_inner_faces_NE_quad_cut);
// Set_transformation_face(16,17,20,21,transform_outer_boundary_NE_cut); //
// Set_transformation_face(9,20,11,21,transform_quadrangle_NULL);
//north-west outer block: corner ids: 2 3 4 5 10 11 12 13
//north-west outer block: corner ids: 3 17 5 18 11 21 13 22
//3,17,5,18,3+8,17+4,5+8,18+4
Set_transformation_face(3,17,5,18,transform_left_lens_diag_NW_quad_cut);//transform_left_lens_diag_NW_quad
Set_transformation_face(3,17,11,21,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(3,5,11,13,transform_quadrangle_NULL); // inner face : no transform necessary
//Set_transformation_face(3,5,11,13,transform_quadrangle_NULL); // inner face : no transform necessary
Set_transformation_face(3,5,11,13,transform_outer_boundary_NW); // inner face : no transform necessary
Set_transformation_face(5,18,13,22,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(17,18,21,22,transform_outer_boundary_NW_cut); //transform_outer_boundary_NW
Set_transformation_face(11,21,13,22,transform_right_lens_diag_NW_quad_cut); //transform_right_lens_diag_NW_quad
......@@ -2041,7 +2082,8 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
//5,18,7,19,5+8,18+4,7+8,19+4
Set_transformation_face(5,18,7,19,transform_left_lens_diag_SW_quad_cut);
Set_transformation_face(5,18,13,22,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(5,7,13,15,transform_quadrangle_NULL); // inner face : no transform necessary
//Set_transformation_face(5,7,13,15,transform_quadrangle_NULL); // inner face : no transform necessary
Set_transformation_face(5,7,13,15,transform_outer_boundary_SW); // inner face : no transform necessary
Set_transformation_face(7,19,15,23,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(18,19,22,23,transform_outer_boundary_SW_cut); //
Set_transformation_face(13,22,15,23,transform_right_lens_diag_SW_quad_cut);
......@@ -2051,7 +2093,8 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
//7,19,1,16,7+8,19+4,1+8,16+4
Set_transformation_face(1,16,7,19,transform_left_lens_diag_SE_quad_cut);
Set_transformation_face(1,16,9,20,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(1,7,9,15,transform_quadrangle_NULL); // inner face : no transform necessary
//Set_transformation_face(1,7,9,15,transform_quadrangle_NULL); // inner face : no transform necessary
Set_transformation_face(1,7,9,15,transform_outer_boundary_SE); // inner face : no transform necessary
Set_transformation_face(7,19,15,23,transform_diag_inner_faces_NE_quad_cut);
Set_transformation_face(16,19,20,23,transform_outer_boundary_SE_cut);
Set_transformation_face(9,20,15,23,transform_right_lens_diag_SE_quad_cut);
......@@ -2073,6 +2116,7 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
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);//transform_left_lens_diag_NW_quad
Set_transformation_face(2,3,10,11,transform_diag_inner_faces_NE_quad);
......
......@@ -229,7 +229,11 @@ void Unstructured_grid::Set_hexahedron(int id,
// Anwender muss sehr schlau sein beim Anwenden dieser
// Funktion, da sonst Orientierung nicht stimmt.
// std::cout <<
// i_WSD << " " << i_ESD
// << " " << i_WND << " " << i_END
// << " " << i_WST << " " << i_EST
// << " " << i_WNT << " " << i_ENT << std::endl;
hexahedra[id].Set_id_corner(WSDdir3D,i_WSD);
hexahedra[id].Set_id_corner(ESDdir3D,i_ESD);
hexahedra[id].Set_id_corner(WNDdir3D,i_WND);
......@@ -974,10 +978,11 @@ void Unstructured_grid::construction_done() {
if (transformFromQuadrangle)
{ edge_to_quad_id.resize(Give_number_edges());
edge_to_quad_dir.resize(Give_number_edges());
edge_to_hex_id.resize(Give_number_edges());
for (int iter = 0 ; iter <edge_to_quad_id.size(); iter++ )
{
edge_to_quad_id.at(iter) = -1;
edge_to_hex_id.at(iter) = -1;
}}
}
......
......@@ -190,11 +190,15 @@ class Unstructured_grid : public Partitioning {
bool Give_transform_From_Quadrangle() {return transformFromQuadrangle;}
// bool Adjacent(int num_hex, int num_edge);
void Set_edge_to_quad_id(int index, int value){ if(index < Give_number_edges()){edge_to_quad_id.at(index) = value; } };
int Give_edge_to_quad_id(int index){ if(index < Give_number_edges()){return edge_to_quad_id.at(index); } };
void Set_edge_to_quad_id(int index, int value){ if(index < Give_number_edges()){edge_to_quad_id.at(index) = value; } }
int Give_edge_to_quad_id(int index){ if(index < Give_number_edges()){return edge_to_quad_id.at(index); } }
void Set_edge_to_hex_id(int index, int value){ if(index < Give_number_edges()){edge_to_hex_id.at(index) = value; } }
int Give_edge_to_hex_id(int index){ if(index < Give_number_edges()){return edge_to_hex_id.at(index); } }
void Set_edge_to_quad_dir(int index, int value){ if(index < Give_number_edges()){edge_to_quad_dir.at(index) = value; } }
int Give_edge_to_quad_dir(int index){ if(index < Give_number_edges()){return edge_to_quad_dir.at(index); } }
void Set_edge_to_quad_dir(int index, int value){ if(index < Give_number_edges()){edge_to_quad_dir.at(index) = value; } };
int Give_edge_to_quad_dir(int index){ if(index < Give_number_edges()){return edge_to_quad_dir.at(index); } };
Hexahedron_el* Give_hexahedron(int i) { return &(hexahedra[i]); }
Quadrangle_el* Give_quadrangle(int i) { return &(quadrangles[i]); }
......@@ -314,6 +318,7 @@ class Unstructured_grid : public Partitioning {
bool periodic; // is num_poi == num_poi_plus_periodic
//* Necessary for getting edge transfrom from quad transform. Stores edge id and the direction, such that the correct edge from the quad is used.
std::vector<int> edge_to_quad_id;
std::vector<double> edge_to_hex_id;
std::vector<int> edge_to_quad_dir;
Topf<2, sorted_pair> topf_edges; // spaeter löschen?
......
......@@ -286,6 +286,11 @@ void Interpolate_on_structured_grid::update_Interpolate_on_structured_grid(Block
}
}
}
if (trilinearInterpolationFlag && MIN(lam)>= 0.0 && MAX(lam) <= 1.0 )
{
lam = trilinarInterpolation(ploc, id_hex,i, j, k);
typ = 6;
}
/*
cout << " typ " << typ << id_hex
......@@ -338,12 +343,178 @@ void Interpolate_on_structured_grid::update_Interpolate_on_structured_grid(Block
//cout << i << " Interpolate_on_structured_grid: o.k.!" << endl;
}
}
}
}
D3vector Interpolate_on_structured_grid::trilinarInterpolation(D3vector X, int id_Hex, int i, int j, int k)
{
D3vector cWSD = blockgrid->Give_coord_hexahedron(id_Hex,i, j, k );
D3vector cESD = blockgrid->Give_coord_hexahedron(id_Hex,i+1,j ,k );
D3vector cWND = blockgrid->Give_coord_hexahedron(id_Hex,i, j+1,k );
D3vector cEND = blockgrid->Give_coord_hexahedron(id_Hex,i+1,j+1,k );
D3vector cWST = blockgrid->Give_coord_hexahedron(id_Hex,i, j, k+1);
D3vector cEST = blockgrid->Give_coord_hexahedron(id_Hex,i+1,j ,k+1);
D3vector cWNT = blockgrid->Give_coord_hexahedron(id_Hex,i, j+1,k+1);
D3vector cENT = blockgrid->Give_coord_hexahedron(id_Hex,i+1,j+1,k+1);
D3vector B = cESD - cEND; // 100 - 000
D3vector C = cWND - cEND; // 010 - 000
D3vector D = cENT - cEND; // 001 - 000
//std::cout << "to be implemented" << std::endl;