You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's my implementation in C++ from here) which was an extension to 3D of this one:
//Obtain the topological coordinates (IJK) of the cell that contains the location.
uint i, j, k;
if( ! XYZtoIJK( x, y, z, i, j, k ) )
returnfalse;
//Obtain the index of the cell.
uint cellIndex = IJKtoIndex( i, j, k );
//Make a point object corresponding to the query location.
Vertex3D location{ x, y, z };
//Get the faces' geometries of the cell.
std::vector<Face3D> cellFaces = getFaces( cellIndex );
//faces 2 and 3 are along I direction, thus are respect to U depositional coordinate//faces 4 and 5 are along J direction, thus are respect to V depositional coordinate//faces 0 and 1 are along K direction, thus are respect to W depositional coordinate//compute the six distances between the location and the facesdouble dU0 = cellFaces[2].distance( location );
double dU1 = cellFaces[3].distance( location );
double dV0 = cellFaces[4].distance( location );
double dV1 = cellFaces[5].distance( location );
double dW0 = cellFaces[0].distance( location );
double dW1 = cellFaces[1].distance( location );
//compute the UVW within the cell (min = 0.0, max = 1.0)double local_u = dU0 / (dU0 + dU1);
double local_v = dV0 / (dV0 + dV1);
double local_w = dW0 / (dW0 + dW1);
//compute the global UVW steps.double du = 1.0 / m_nI;
double dv = 1.0 / m_nJ;
double dw = 1.0 / m_nK;
//compute the UVW coordinates.
u = du * i + du * local_u;
v = dv * j + dv * local_v;
w = dw * k + dw * local_w;
//enforcing sanityif( std::isfinite( u ) && std::isfinite( v ) && std::isfinite( w ) )
returntrue;
elsereturnfalse;
Maybe this can help someone get started on a Python implementation.
Activity
PauloCarvalhoRJ commentedon Jul 3, 2025
Hello,
Here's my implementation in C++ from here) which was an extension to 3D of this one:
Maybe this can help someone get started on a Python implementation.
best,
PC