Skip to content

Commit

Permalink
XCore AdaptMesh: added face neighbours extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
imadhammani committed Jul 25, 2024
1 parent 665d3a0 commit 5a95ff0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
35 changes: 34 additions & 1 deletion Cassiopee/XCore/XCore/AdaptMesh/AdaptMesh_ExtractData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
7 changes: 5 additions & 2 deletions Cassiopee/XCore/XCore/PyTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


################################################################################
Expand Down
3 changes: 2 additions & 1 deletion Cassiopee/XCore/XCore/xcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
3 changes: 2 additions & 1 deletion Cassiopee/XCore/XCore/xcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5a95ff0

Please sign in to comment.