FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Classes | Public Member Functions | Static Public Member Functions | List of all members
UniGridMapper Class Reference

The UniGridMapper Maps a cell in a uniform grid to curvilinear cells, which are contained or intersect a unicell. More...

#include <UniGridMapper.hpp>

Inheritance diagram for UniGridMapper:

Public Member Functions

 UniGridMapper (const RefPtr< CoordsArray_t > &_CurviCoords, const double res_scale=1.0, const double prec_scale=1.0)
 Initializes the Mapper.
 
int MaximalCurvicellPerUnicell () const
 
MultiIndex< 3 > Size () const
 return the size of the curvi linear index list (Thats not a helpful comment, is it?)
 
point operator[] (const MultiIndex< 3 > &m) const
 return point at a given uni-grid index
 
IndexList_toperator() (const MultiIndex< 3 > &m) const
 return list of curvi-cell indices at a given uni-grid index
 
RefPtr< CoordsArray_tgetCurviCoords () const
 
RefPtr< UniformCartesianArraygetUniCoords () const
 
point getMin ()
 Get the minimum coord of the bounding box of the UniGridMapper.
 
point getMax ()
 Get the maximum coord of the bounding box of the UniGridMapper.
 
bool add (MultiIndex< 3 > &curvi_i)
 add (map) curvi cell to all uni grid cells it is contained, or intersecting
 
bool inUniCell (const point &p, MultiIndex< 3 > &index)
 Given a world point return true and the index of the unigrid cell, in which the point is contained, return false otherwise.
 
bool curviCells (const point &p, IndexList_t &list)
 Given a world point return true and the list of all curvi-cell that are mapped to the unigrid-cell, in which the point is located, return false if point is not located in a uni-cell of the UniGridMapper.
 
unsigned localCellCoordinatesFromCurviGrid (const point &p, point &uvw, double grid_epsilon=0.0)
 This should be called as a 'user' of UniGridMapper.
 
bool localCellCoordinatesFromCell (point &uvw, const point &P, MultiIndex< 3 > &it, const CoordsArray_t &Data, const MultiIndex< 3 > &max, const double prec)
 This function is the heart of the mapper.
 
unsigned localCellCoordinatesFromCurviGridProjective (const point &p, point &uvw, const double &grid_epsilon)
 

Static Public Member Functions

static double avg (const double a, const double b)
 
static void clampRange (point &p, const double min, const double max)
 
static bool uvwInRange2 (point &u, const MultiIndex< 3 > &it, const MultiIndex< 3 > &max, const double prec)
 
static bool localPointToIndex (const point &p, MultiIndex< 3 > &cc)
 

Detailed Description

The UniGridMapper Maps a cell in a uniform grid to curvilinear cells, which are contained or intersect a unicell.

This is useful for fast choosing certain candidates of a curvilinear coordinategrid. It is by now a special solution for the 3-dimensional case. Initialisation of the UniGridMapper traverses all cells of the curvi coords grid for each uni cell to build the lookup structure. UniGridMapper is Ref-Pointer-able.

Constructor & Destructor Documentation

◆ UniGridMapper()

UniGridMapper::UniGridMapper ( const RefPtr< CoordsArray_t > &  _CurviCoords,
const double  res_scale = 1.0,
const double  prec_scale = 1.0 
)

Initializes the Mapper.

It tries to choose a similar number of cubish cells as the curvilinear source.

Parameters
_CurviCoordsthe curvi linear coordinate grid, the uni grid mapper shalld operate on
res_scalerelative scale for the number of cells. Higher scale means more cells in the uni grid.
prec_scalerelative scale for the precision for the newton iteration. Initial precision is 1/100 of the average of all edges of the curvi cells.

References add(), floor(), max(), Eagle::norm2(), and std::sqrt().

Member Function Documentation

◆ localCellCoordinatesFromCell()

bool UniGridMapper::localCellCoordinatesFromCell ( point uvw,
const point P,
MultiIndex< 3 > &  it,
const CoordsArray_t Data,
const MultiIndex< 3 > &  max,
const double  prec 
)

This function is the heart of the mapper.

It does an initial guess in the cell. Then it does a taylor approximation and iterates with newton in direction of the given point to calculate the local coordinates. vgl Stalling p.

Returns
true and the local coordinates of a worldpoint by given cell in curvi index space, false if the point is not locates inside the given curvilinear cell.
Parameters
uvwreturns the local index
Pspecifies the world point
precspecify the precision until the newton continues

References std::cout, std::endl(), max(), and Eagle::norm2().

Referenced by localCellCoordinatesFromCurviGrid().

◆ localCellCoordinatesFromCurviGrid()

unsigned UniGridMapper::localCellCoordinatesFromCurviGrid ( const point p,
point uvw,
double  grid_epsilon = 0.0 
)

This should be called as a 'user' of UniGridMapper.

Given a world point return the local curvi-cell coordinate.

Returns
0 if the point is not located in a curvi cell, 1 if it is located inside and it is a nice point, 2 if it is located inside but iterated to the outside and was corrected
Parameters
pworld point
uvwreturns the local index of the curvi-grid
Todo:
remove the un-nice epsilon grid boundary via neighbourhood

References curviCells(), std::fabs(), localCellCoordinatesFromCell(), and max().