Three-dimensional interpolation

In a couple of instances three-dimensional interpolation is necessary:

For interpolation purposes each master mesh element is remeshed into linear tetrahedra. This results in a number of fields such as kontet, cotet, ipofa, inodfa, planfa and ifatet. Kontet(1..4,i) contains the nodes belonging to the tetrahedral element i, cotet(1..3,i) contains the coordinates for nodes i. The other fields are used to catalogue the faces of the tetrahedra. Ipofa(i) is a pointer into field inodfa, containing all faces of the tetrahedral mesh. Let index=ipofa(i), then inodfa(1..3,index) contains the nodes i, j and k belonging to a face for which node i is the lowest node number, i.e. i<j<k. Entry inodfa(4,index) is a pointer to another face in inodfa for which i is the lowest node number. If no other exists, this value is zero. Each face occurs only once in field inodfa. Therefore, the index of the face in field inodfa can be considered as the number of the face. For a face stored in inodfa(1..4,index), the equation of the plane containing the face and of the form ax+by+cz+d=0, the coefficients a, b, c and d are stored in planfa(1..4,index). The field ifatet(1..4,i) contains the numbers of the 4 faces belonging to the tetrahedron i. Let the nodes of a tetrahedron a be i, j, k and l and assume that the number of the face to which nodes i,j and k belong is stored in ifatet(1,a). Let the coordinates of node l be p, q and r. Then, the entry ifatet(1,a) gets a negative sign if ap+bq+cr+d<0, else it gets a positive sign. In that way one can distinguish for each face of each element between the half space to which the tetrahedron the face we are looking at belongs and the half space to which it does not belong.