Back to index
The main purpose of this module is to propose a set of algorithms for mesh interpolation fully independant of the mesh datastructure to support several type of format. This component is parameterized as much as possible using C++ templates. For the moment only interpolators for unstructured meshes are present in the interpolation kernel.
In the interpolation kernel, algorithms that computes the intersection given the locations and geometries of source cell and target cell are called Intersectors.
As can be seen in the theory of interpolation, all the proposed interpolators aim at filling the interpolation matrix W (which is generally sparse). For each pair (i,j), is obtained by calling the desired intersector. The problem is that each call to this algorithm is CPU-expensive. To reduce the computational time, a first filtering is done to detect pairs (i,j) is obviously equal to 0. It is typically the case when a cell in the source mesh is too far from an another cell in the target mesh each.
So for a given type of interpolation, the computation of W is performed in two steps :
-# A filtering process reduces the number of pairs of elements for which the calculation must be carried out by eliminating the pairs whose bounding boxes do not intersect. -# For all remaining pairs calling for each intersector (click here for the available \ref InterpKerIntersectors).
Whatever its dimension and type, each interpolator inherits from INTERP_KERNEL::Interpolation which is a template (CRTP) class than enable an easy access to the main API without useless CPU cost.
Each Interpolators and Intersectors are parameterized (templated in C++ langage) with
MeshType . This type of generalization has been chosen to reduce at maximum overhead.
Thanks to this principle intersectors and interpolators are usable with mesh formats such as
VTK, without preformance loss.
MeshType is a concept that should strictly fulfilled the following rules :
- Const values / Types - MyConnType : represents type of connectivity index. This is typically \c int or \c long \c int . - MY_SPACEDIM : space dimension. Dimension relative to coordinates. - MY_MESHDIM : the dimension of all cells in meshes. - My_numPol : policy of numbering. C Format ( \form#20 ) or FORTRAN ( \form#21 ). - Methods -# @code void getBoundingBox(double *boundingBox) const \endcode -# @code INTERP_KERNEL::NormalizedCellType getTypeOfElement(MyConnType eltId) const \endcode -# @code unsigned char getNumberOfNodesOfElement(MyConnType eltId) const \endcode -# @code unsigned long getNumberOfNodes() const \endcode -# @code unsigned long getNumberOfElements() const \endcode -# @code const MyConnType *getConnectivityPtr() const \endcode -# @code const double *getCoordinatesPtr() const \endcode -# @code const MyConnType *getConnectivityIndexPtr() const \endcode -# @code void releaseTempArrays() \endcode - Formats of arrays - the array returned by \c getCoordinatesPtr must be a \b full \b interlace array. - the arrays returned by \c getConnectivityPtr and \c getConnectivityIndexPtr must be with the same principle as it is in \ref medmemConnArrays "medmem". Of course the numbering format may change according to \a My_numPol policy.
Note that the array format for connectivity is kept close to MED. It is close to VTK format too but slightly different. So it may require for the VTK side a copy on wrap. To avoid this copy of a part of the connectivity structure, an iterator should be used.
As already said, the matrix returned by interpolator is typically a sparse matrix. Instances of
MatrixType are used to store the resulting interpolation matrix. To be able to be filled by the interpolator the
MatrixType class has to match the following concept :
- Methods -# @code void resize(uint nbrows) \endcode -# @code Row &operator  (uint irow) \endcode
Row has to match at least the following concept :
- Methods - @code void insert(const std::pair<int,T>& myPair) \endcode
std::vector is a candidate for