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

added documentation to interpolate_direct

parent f99a441a
......@@ -28,9 +28,10 @@
/////////////////////////////////////////////////////////////
// 1. Interpolate from blockgrid to rectangular blockgrid
// 2. Interpolate from blockgrid to blockgrid
// 3. Interpolate from Variable on a blockgrid to any point using structured intermediate grid
// 4. Interpolate from blockgrid direct to any point
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// 1. Interpolate from blockgrid to rectangular blockgrid
/////////////////////////////////////////////////////////////
......@@ -328,10 +329,19 @@ private:
};
/* @} */
//template <class DTyp>
/////////////////////////////////////////////////////////////
// 4. Interpolate from blockgrid direct to any point
/////////////////////////////////////////////////////////////
/** \addtogroup InterpolationOperators **/
/* @{ */
/**
* Interpolate from blockgrid direct to any point
***/
class Interpolate_direct {
public:
Interpolate_direct (Blockgrid* bg):blockgrid(bg)
,idHexPrev(-1)
,iPrev(-1)
......@@ -362,37 +372,31 @@ class Interpolate_direct {
,typCounter4(0)
,typCounter5(0){}
/**
* preparation for interpolation : calculates the neighbour index for each cell.
* also calculates the neighbour cell, if in other blockgrid.
**/
void init();
std::vector<std::vector<int> > calculateNeighbourIndexRelation(std::vector<std::vector<int> > inner, std::vector<std::vector<int> > outer);
std::vector<int> calculateNeighbourIndex(std::vector<std::vector<int> > relation, int id_hex_outside,int id_hex_inside, int i, int j, int k, int Nx, int Ny, int Nz);
std::vector<std::vector<int> > filterCorrectNeighbours(std::vector<std::vector<int> > outer);
bool compareIndicies(std::vector<std::vector<int> > inner, std::vector<std::vector<int> > outer, int notCheck);
std::vector<std::vector<int> > switchIJ(std::vector<std::vector<int> > v);
std::vector<std::vector<int> > switchIK(std::vector<std::vector<int> > v);
std::vector<std::vector<int> > switchJK(std::vector<std::vector<int> > v);
std::vector<std::vector<int> > invertI (std::vector<std::vector<int> > v);
std::vector<std::vector<int> > invertJ (std::vector<std::vector<int> > v);
std::vector<std::vector<int> > invertK (std::vector<std::vector<int> > v);
/**
* Iterates throuh all cells : if D3vector v is inside of a cell, the weighting of the 8 cell points are calculated (D3vector lambda).
* Uses previously cell indexes and its neighbours, since it's assumed that two consecutive find_cell(v) calls are close to each other.
* Saves : idNow, idPrev, ifPrevPrev, idPrevPrevPrev
*
**/
void find_cell(D3vector v);
void setPrevIndex();
void setPrevPrevIndex();
void setPrevPrevPrevIndex();
int checkBox(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);
int checkCorner(int idHex, int i, int j, int k, D3vector v);
int checkEdge(int idHex, int i, int j, int k, D3vector v);
bool checkOverlapOfBoxes(D3vector vWSD, D3vector vENT, D3vector wWSD, D3vector wENT);
double calculateOverlapOfBoxes(D3vector vWSD, D3vector vENT, D3vector wWSD, D3vector wENT);
/**
* Print a vtk file with a box, surrounding the cell.
**/
void writeBox(D3vector vWSD, D3vector vENT, std::string str);
/**
* Print a vtk file with a point.
**/
static void writePoint(D3vector v, std::string str, int Counter);
/**
* Writes interpolation efficiency: how many direct hits, second try, iterate through all, ect...
**/
void writeInterpolationEfficiency();
int checkForHexaNeighbours(int idHex, int i, int j, int k, D3vector v);
// void interpolate(Variable<DTyp>& u, DTyp* data, DTyp defaultInterpolation);
template <class DTyp>
DTyp evaluate(Variable<DTyp>& u);
......@@ -417,11 +421,42 @@ class Interpolate_direct {
std::vector<std::vector<std::vector<D3vector> > > arrayBoxWSDENT;
std::vector<std::vector<std::vector<int> > > array_box_boundary;
// template <class DTyp>
// Variable<DTyp>* u;
};
private:
/**
* Necessary to calculate the neighbour relation.
**/
std::vector<std::vector<int> > calculateNeighbourIndexRelation(std::vector<std::vector<int> > inner, std::vector<std::vector<int> > outer);
std::vector<int> calculateNeighbourIndex(std::vector<std::vector<int> > relation, int id_hex_outside,int id_hex_inside, int i, int j, int k, int Nx, int Ny, int Nz);
std::vector<std::vector<int> > filterCorrectNeighbours(std::vector<std::vector<int> > outer);
bool compareIndicies(std::vector<std::vector<int> > inner, std::vector<std::vector<int> > outer, int notCheck);
std::vector<std::vector<int> > switchIJ(std::vector<std::vector<int> > v);
std::vector<std::vector<int> > switchIK(std::vector<std::vector<int> > v);
std::vector<std::vector<int> > switchJK(std::vector<std::vector<int> > v);
std::vector<std::vector<int> > invertI (std::vector<std::vector<int> > v);
std::vector<std::vector<int> > invertJ (std::vector<std::vector<int> > v);
std::vector<std::vector<int> > invertK (std::vector<std::vector<int> > v);
/**
* Necessary to evaluate the neighbour cell relation.
**/
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);
int checkCorner(int idHex, int i, int j, int k, D3vector v);
int checkEdge(int idHex, int i, int j, int k, D3vector v);
bool checkOverlapOfBoxes(D3vector vWSD, D3vector vENT, D3vector wWSD, D3vector wENT);
double calculateOverlapOfBoxes(D3vector vWSD, D3vector vENT, D3vector wWSD, D3vector wENT);
};
/* @} */
template<class DTyp>
DTyp Interpolate_direct::evaluate(Variable<DTyp> &u)
{
......
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