diff --git a/Cassiopee/XCore/XCore/AdaptMesh/AdaptMesh_ExtractData.cpp b/Cassiopee/XCore/XCore/AdaptMesh/AdaptMesh_ExtractData.cpp index 76a1a4538..61040700e 100644 --- a/Cassiopee/XCore/XCore/AdaptMesh/AdaptMesh_ExtractData.cpp +++ b/Cassiopee/XCore/XCore/AdaptMesh/AdaptMesh_ExtractData.cpp @@ -52,6 +52,39 @@ PyObject *K_XCORE::AdaptMesh_ExtractOwners(PyObject *self, PyObject *args) return (PyObject *)OWN; } +PyObject *K_XCORE::AdaptMesh_ExtractNeighbours(PyObject *self, PyObject *args) +{ + PyObject *MESH; + + if (!PYPARSETUPLE_(args, O_, &MESH)) { + RAISE("Wrong input."); + return NULL; + } + + if (!PyCapsule_IsValid(MESH, "AdaptMesh")) { + RAISE("Bad mesh hook."); + return NULL; + } + + Mesh *M = (Mesh *)PyCapsule_GetPointer(MESH, "AdaptMesh"); + + if (M->pid == 0) puts("Extracting owners..."); + + npy_intp dims[2]; + + dims[1] = 1; + dims[0] = (npy_intp)M->nf; + PyArrayObject *NEI = (PyArrayObject *)PyArray_SimpleNew(1, dims, E_NPY_INT); + + Int *pn = (Int *)PyArray_DATA(NEI); + + for (Int i = 0; i < M->nf; i++) { + pn[i] = M->neigh[i]; + } + + return (PyObject *)NEI; +} + PyObject *K_XCORE::AdaptMesh_ExtractCellLevels(PyObject *self, PyObject *args) { PyObject *MESH; @@ -86,7 +119,7 @@ PyObject *K_XCORE::AdaptMesh_ExtractCellLevels(PyObject *self, PyObject *args) } -PyObject *K_XCORE::AdaptMesh_ExtractNeighbourCellLevels(PyObject *self, PyObject *args) +PyObject *K_XCORE::AdaptMesh_ExtractHaloCellLevels(PyObject *self, PyObject *args) { PyObject *MESH; diff --git a/Cassiopee/XCore/XCore/PyTree.py b/Cassiopee/XCore/XCore/PyTree.py index 3f523ad36..affd4851d 100644 --- a/Cassiopee/XCore/XCore/PyTree.py +++ b/Cassiopee/XCore/XCore/PyTree.py @@ -76,11 +76,14 @@ def AdaptMesh_ExtractMesh(t, conformize=1): def AdaptMesh_ExtractOwners(AM): return xcore.AdaptMesh_ExtractOwners(AM) +def AdaptMesh_ExtractNeighbours(AM): + return xcore.AdaptMesh_ExtractNeighbours(AM) + def AdaptMesh_ExtractCellLevels(AM): return xcore.AdaptMesh_ExtractCellLevels(AM) -def AdaptMesh_ExtractNeighbourCellLevels(AM): - return xcore.AdaptMesh_ExtractNeighbourCellLevels(AM) +def AdaptMesh_ExtractHaloCellLevels(AM): + return xcore.AdaptMesh_ExtractHaloCellLevels(AM) ################################################################################ diff --git a/Cassiopee/XCore/XCore/xcore.cpp b/Cassiopee/XCore/XCore/xcore.cpp index ba92c90bd..6c7c8eaa0 100644 --- a/Cassiopee/XCore/XCore/xcore.cpp +++ b/Cassiopee/XCore/XCore/xcore.cpp @@ -39,8 +39,9 @@ static PyMethodDef Pyxcore [] = {"AdaptMesh_ExtractMesh", K_XCORE::AdaptMesh_ExtractMesh, METH_VARARGS}, {"AdaptMesh_ExtractOwners", K_XCORE::AdaptMesh_ExtractOwners, METH_VARARGS}, + {"AdaptMesh_ExtractNeighbours", K_XCORE::AdaptMesh_ExtractNeighbours, METH_VARARGS}, {"AdaptMesh_ExtractCellLevels", K_XCORE::AdaptMesh_ExtractCellLevels, METH_VARARGS}, - {"AdaptMesh_ExtractNeighbourCellLevels", K_XCORE::AdaptMesh_ExtractNeighbourCellLevels, METH_VARARGS}, + {"AdaptMesh_ExtractHaloCellLevels", K_XCORE::AdaptMesh_ExtractHaloCellLevels, METH_VARARGS}, {"intersectSurf", K_XCORE::intersectSurf, METH_VARARGS}, {"removeIntersectingKPlanes", K_XCORE::removeIntersectingKPlanes, METH_VARARGS}, diff --git a/Cassiopee/XCore/XCore/xcore.h b/Cassiopee/XCore/XCore/xcore.h index dbd0eddae..ca16a3024 100644 --- a/Cassiopee/XCore/XCore/xcore.h +++ b/Cassiopee/XCore/XCore/xcore.h @@ -48,8 +48,9 @@ namespace K_XCORE PyObject *AdaptMesh_ExtractMesh(PyObject *self, PyObject *args); PyObject *AdaptMesh_ExtractOwners(PyObject *self, PyObject *args); + PyObject *AdaptMesh_ExtractNeighbours(PyObject *self, PyObject *args); PyObject *AdaptMesh_ExtractCellLevels(PyObject *self, PyObject *args); - PyObject *AdaptMesh_ExtractNeighbourCellLevels(PyObject *self, PyObject *args); + PyObject *AdaptMesh_ExtractHaloCellLevels(PyObject *self, PyObject *args); PyObject *intersectSurf(PyObject *self, PyObject *args); PyObject *removeIntersectingKPlanes(PyObject *self, PyObject *args);