Commit 9bec8af0 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

adjusted interpolation method: points can be 20% instead of 10% outside of box...

adjusted interpolation method: points can be 20% instead of 10% outside of box to find a proper value
parent 5ff01c82
......@@ -29,7 +29,7 @@ unix: VTK_LIBS = \
# Pathes
# -Home Directory
HOME_DIR = /home/pflaum/UGBlocks
HOME_DIR = C:\Users\rall\Documents\UGBLOCKS\trunk
#HOME_DIR = ../../
# -UGBlocks Directory
......
......@@ -122,7 +122,7 @@ Blockgrid::Blockgrid ( Unstructured_grid *ug_, int Nx, int Ny, int Nz, int Nr )
}
Blockgrid::Blockgrid(Unstructured_grid *ug_, int Nx, int Ny, int Nz, int Nr, int Nr2){
cout << "Nx " << Nx << "Ny " << Ny << "Nz " << Nz << "Nr " << Nr << endl;
cout << "Nx " << Nx << "Ny " << Ny << "Nz " << Nz << "Nr " << Nr << "Nr2 " << Nr2 << endl;
id_of_grid = id_count_grid; ++id_count_grid;
phase_shift = NULL;
bg_coord = NULL;
......
......@@ -1527,7 +1527,7 @@ Lens_Geometry_Quad::Lens_Geometry_Quad(double Radius, double thickness, double c
constructionParameters.resize(8);
constructionParameters.resize(12);
constructionParameters[0] = Radius;
constructionParameters[1] = radius;
constructionParameters[2] = thickness;
......@@ -1575,6 +1575,10 @@ Lens_Geometry_Quad::Lens_Geometry_Quad(double Radius, double thickness, double c
z_right_outer = 0.0 + offsetZ + thickness;
}
constructionParameters[8] = std::min(offsetZ,z_left_outer);
constructionParameters[9] = std::max(offsetZ + thickness,z_right_outer);
constructionParameters[10] = 0;
constructionParameters[11] = 0;
......@@ -1781,7 +1785,7 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
constructionParameters.resize(10);
constructionParameters.resize(12);
//obacht : correct? should be! not enetiryls sure
constructionParameters[0] = Radius;
constructionParameters[0] = maxRadius;
......@@ -1862,8 +1866,29 @@ Lens_Geometry_cutted_edges::Lens_Geometry_cutted_edges(double RadiusLeft, double
}
constructionParameters[8] = z_left_edge ;
constructionParameters[9] = z_right_edge;
if (cutLeft)
{
constructionParameters[8] = z_left_edge ;
}
else
{
constructionParameters[8] = std::min(offsetZ,z_left_outer);
}
if (cutRight)
{
constructionParameters[9] = z_right_edge ;
}
else
{
constructionParameters[9] = std::max(offsetZ + thickness,z_right_outer);
}
constructionParameters[10] = cutLeft;
constructionParameters[11] = cutRight;
// if (curvatureRight < 0 && curvatureLeft < 0)
// {
......
......@@ -24,6 +24,7 @@
#include <string>
#include <list>
#include <vector>
#include <algorithm>
////////////////////////////////////////////////////////////////
......
......@@ -52,25 +52,25 @@ bool contained_in_tet(D3vector lam) {
}
bool contained_in_tet_strong(D3vector lam) {
if(lam.x < -0.1) return false;
if(lam.y < -0.1) return false;
if(lam.z < -0.1) return false;
if(lam.x + lam.y + lam.z > 1.1) return false;
if(lam.x < -0.2) return false;
if(lam.y < -0.2) return false;
if(lam.z < -0.2) return false;
if(lam.x + lam.y + lam.z > 1.2) return false;
return true;
}
bool new_lam_better(D3vector lam_old, D3vector lam_new) {
if (MIN(lam_new ) < -0.1 || MAX(lam_new) > 1.1) return false;
if (MIN(lam_old ) < -0.1 || MAX(lam_old) > 1.1) return true;
if (MIN(lam_new ) < -0.2 || MAX(lam_new) > 1.2) return false;
if (MIN(lam_old ) < -0.2 || MAX(lam_old) > 1.2) return true;
if (MIN(lam_new) < MIN(lam_old)) return true;
if (MAX(lam_new) < MAX(lam_old)) return true;
}
bool new_lam_worse(D3vector lam_old, D3vector lam_new) {
if(MIN(lam_new) < MIN(lam_old) && MIN(lam_old) < -0.1) return true;
if(MAX(lam_new) > MAX(lam_old) && MAX(lam_old) > 1.1) return true;
if(MIN(lam_new) < MIN(lam_old) && MIN(lam_old) < -0.2) return true;
if(MAX(lam_new) > MAX(lam_old) && MAX(lam_old) > 1.2) return true;
return false;
}
......@@ -2887,6 +2887,8 @@ int Interpolate_direct::checkBox(int id_Hex, int i, int j, int k, D3vector v)
boxWSD = arrayBoxWSDENT.at(id_Hex).at(i +Nx*(j +Ny* k)).at(0);
boxENT = arrayBoxWSDENT.at(id_Hex).at(i +Nx*(j +Ny* k)).at(1);
// writeBox(boxWSD,boxENT,std::string("box"));
if (boxENT>=v && boxWSD<=v)
{
......@@ -2931,7 +2933,7 @@ int Interpolate_direct::checkBox(int id_Hex, int i, int j, int k, D3vector v)
if( typ != -1 && new_lam_better(lambda,lamTemp))
{
if (MIN(lamTemp) < -0.1)
if (MIN(lamTemp) < -0.2)
{
cout << "error !" << endl;
}
......@@ -3337,6 +3339,7 @@ void Interpolate_direct::writeInterpolationEfficiency()
}
int Interpolate_direct::checkForHexaNeighbours(int idHex, int i, int j, int k, D3vector v)
{
counterHexa++;
......
......@@ -408,12 +408,18 @@ class Interpolate_direct {
bool debugTest;
D3vector lambda;
D3vector vNow, vPrev, vPrevPrev, vPrevPrevPrev;
bool vectorInBox(D3vector vWSD, D3vector vENT, D3vector v, double eps = 1e-10);
int checkBox(int idHex, int i, int j, int k, D3vector v);
private:
int idHexPrev, iPrev, jPrev, kPrev;
int idHexPrevPrevPrev, iPrevPrevPrev, jPrevPrevPrev, kPrevPrevPrev;
int idHexPrevPrev, iPrevPrev, jPrevPrev, kPrevPrev;
int idHexPrev, iPrev, jPrev, kPrev;
int idHexNow, iNow, jNow, kNow;
double lamLowerLimit{-0.1};
double lamUpperLimit{1.1};
int typ_tet;
......@@ -442,7 +448,6 @@ private:
void setPrevIndex();
void setPrevPrevIndex();
void setPrevPrevPrevIndex();
int checkBox(int idHex, int i, int j, int k, D3vector v);
int checkForHexaNeighbours(int idHex, int i, int j, int k, D3vector v);
int checkBoxSurrounding(int idHex, int i, int j, int k, D3vector v);
int checkBoxSurroundingOptimized(int idHex, int i, int j, int k, D3vector v);
......
......@@ -64,8 +64,10 @@ class D3vector {
bool operator==(const D3vector& v) {if( (v.x == x) && (v.y == y) && (v.z == z) ){return true;} else {return false;} }
bool operator<(const D3vector& v) {if(v.x > x && v.y > y && v.z > z){return true;} else {return false;} }
bool operator>(const D3vector& v) {if(v.x < x && v.y < y && v.z < z){return true;} else {return false;} }
bool operator<=(const D3vector& v) {if(v.x >= x && v.y >= y && v.z >= z){return true;} else {return false;} }
bool operator>=(const D3vector& v) {if(v.x <= x && v.y <= y && v.z <= z){return true;} else {return false;} }
// bool operator<=(const D3vector& v) {if(v.x >= x && v.y >= y && v.z >= z){return true;} else {return false;} }
// bool operator>=(const D3vector& v) {if(v.x <= x && v.y <= y && v.z <= z){return true;} else {return false;} }
bool operator<=(const D3vector& v) {if(v.x-x >= -1e-10 && v.y-y >= -1e-10 && v.z-z >= -1e-10){return true;} else {return false;} }
bool operator>=(const D3vector& v) {if(v.x-x <= +1e-10 && v.y-y <= +1e-10 && v.z-z <= +1e-10){return true;} else {return false;} }
double operator[](int i) {
if(i==0) return x;
if(i==1) return y;
......
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