Skip to content

Commit

Permalink
XCore intersectMesh: split_connex + headers + camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
imadhammani committed Jan 9, 2025
1 parent 84896a6 commit 5092e4c
Show file tree
Hide file tree
Showing 12 changed files with 416 additions and 14 deletions.
43 changes: 32 additions & 11 deletions Cassiopee/XCore/XCore/PyTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,31 @@ def extractFacesFromPointTag(t, tag_name):

###############################################################################

def icapsule_init2():
def splitConnex(m):
zones = I.getNodesFromType(m, 'Zone_t')
if len(zones) != 1: raise ValueError('Master should be one zone.')
zm = zones[0]
marr = C.getFields(I.__GridCoordinates__, zm, api=3)[0]
ptag = I.getNodeFromName(zm, 'tag')
if ptag is None: raise ValueError('Missing point tags')
ctag = I.getNodeFromName(zm, 'keep')
if ctag is None: raise ValueError('Missing cell tags')
new_arrs, new_ctags, new_ptags = xcore.split_connex(marr, ctag[1], ptag[1])
zout = []
for i in range(len(new_arrs)):
z = I.createZoneNode("zone"+str(i), new_arrs[i])
cont = I.createUniqueChild(z, I.__FlowSolutionCenters__, 'FlowSolution_t')
I._createUniqueChild(cont, 'GridLocation', 'GridLocation_t', value='CellCenter', )
I.newDataArray('keep', value=new_ctags[i], parent=cont)
cont = I.createUniqueChild(z, I.__FlowSolutionNodes__, 'FlowSolution_t')
I.newDataArray('tag', value=new_ptags[i], parent=cont)
zout.append(z)
return zout

def icapsuleInit2():
return xcore.icapsule_init2()

def icapsule_set_master(IC, m):
def icapsuleSetMaster(IC, m):
zones = I.getNodesFromType(m, 'Zone_t')
if len(zones) != 1: raise ValueError('Master should be one zone.')
zm = zones[0]
Expand All @@ -496,7 +517,7 @@ def icapsule_set_master(IC, m):
if ctag is None: raise ValueError('Missing cell tags')
return xcore.icapsule_set_master(IC, marr, ctag[1])

def icapsule_set_slaves(IC, slaves):
def icapsuleSetSlaves(IC, slaves):
sarrs = []
ptags = []
ctags = []
Expand All @@ -519,13 +540,13 @@ def icapsule_set_slaves(IC, slaves):

return xcore.icapsule_set_slaves(IC, sarrs, ptags, ctags)

def icapsule_adapt2(IC):
def icapsuleAdapt2(IC):
return xcore.icapsule_adapt2(IC)

def icapsule_intersect2(IC):
def icapsuleIntersect2(IC):
return xcore.icapsule_intersect2(IC)

def icapsule_extract_master(IC):
def icapsuleExtractMaster(IC):
marr, ctag = xcore.icapsule_extract_master(IC)
zm = I.createZoneNode("master", marr)

Expand All @@ -534,7 +555,7 @@ def icapsule_extract_master(IC):
I.newDataArray("keep", value=ctag, parent=cont)
return zm

def icapsule_extract_slaves(IC):
def icapsuleExtractSlaves(IC):
sarrs, ctags = xcore.icapsule_extract_slaves(IC)
assert(len(sarrs) == len(ctags))
zones = []
Expand All @@ -550,7 +571,7 @@ def icapsule_extract_slaves(IC):

###############################################################################

def icapsule_init(mp, sp):
def icapsuleInit(mp, sp):
zm = I.getZones(mp)[0]
marr = C.getFields(I.__GridCoordinates__, zm, api=3)[0]

Expand All @@ -568,7 +589,7 @@ def icapsule_init(mp, sp):

return xcore.icapsule_init(marr, sarrs, tags)

def icapsule_adapt(IC):
def icapsuleAdapt(IC):
marr, sarrs, stags = xcore.icapsule_adapt(IC)
zm = I.createZoneNode("ma", marr)
assert(len(sarrs) == len(stags))
Expand All @@ -583,7 +604,7 @@ def icapsule_adapt(IC):
ts = C.newPyTree(['Base', slave_zones])
return tm, ts

def icapsule_intersect(ma, sa):
def icapsuleIntersect(ma, sa):
zm = I.getZones(ma)[0]
marr = C.getFields(I.__GridCoordinates__, zm, api=3)[0]

Expand Down Expand Up @@ -613,7 +634,7 @@ def icapsule_intersect(ma, sa):
ts = C.newPyTree(['Base', slave_zones])
return tm, ts

def icapsule_extract_slave(IC, index=0):
def icapsuleExtractSlave(IC, index=0):
sarr = xcore.icapsule_extract_slave(IC, index)
zs = I.createZoneNode("slave_"+str(index), sarr)
return zs
Expand Down
18 changes: 18 additions & 0 deletions Cassiopee/XCore/XCore/intersectMesh/check_manifoldness.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cassiopee is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mesh.h"
#include "common/Karray.h"

Expand Down
18 changes: 18 additions & 0 deletions Cassiopee/XCore/XCore/intersectMesh/icapsule_adapt.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cassiopee is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icapsule.h"

PyObject *K_XCORE::icapsule_adapt2(PyObject *self, PyObject *args)
Expand Down
18 changes: 18 additions & 0 deletions Cassiopee/XCore/XCore/intersectMesh/icapsule_extract.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cassiopee is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icapsule.h"

PyObject *K_XCORE::icapsule_extract_master(PyObject *self, PyObject *args)
Expand Down
18 changes: 18 additions & 0 deletions Cassiopee/XCore/XCore/intersectMesh/icapsule_init.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cassiopee is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <queue>
#include "icapsule.h"
#include "common/Karray.h"
Expand Down
18 changes: 18 additions & 0 deletions Cassiopee/XCore/XCore/intersectMesh/icapsule_intersect.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cassiopee is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icapsule.h"
#include "dcel.h"

Expand Down
18 changes: 18 additions & 0 deletions Cassiopee/XCore/XCore/intersectMesh/initSurf.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cassiopee is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/Karray.h"
#include "smesh.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,9 @@ PyObject *handle_slave2(IMesh *M, Karray& sarray, E_Int kmax)
char *varString, *eltType;
K_ARRAY::getFromArray3(tpl, varString, f, ni, nj, nk, c, eltType);

E_Float* xt = f->begin(1);
E_Float* yt = f->begin(2);
E_Float* zt = f->begin(3);
E_Float *xt = f->begin(1);
E_Float *yt = f->begin(2);
E_Float *zt = f->begin(3);

// Copy all the points up to kmax
for (E_Int k = 0; k < kmax+1; k++) {
Expand Down
Loading

0 comments on commit 5092e4c

Please sign in to comment.