Skip to content

Commit

Permalink
Merge pull request #149 from vincentcasseau/main
Browse files Browse the repository at this point in the history
Envs/Converter/Generator: edits for Github Actions and fix mem leaks in G.close and C.convertArray2NGon
  • Loading branch information
vincentcasseau authored Aug 30, 2024
2 parents e68a72a + 0700bb4 commit 6f53b17
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 44 deletions.
18 changes: 11 additions & 7 deletions Cassiopee/Converter/Converter/convertStruct2NGon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,14 @@ PyObject* K_CONVERTER::convertStruct2NGon(PyObject* self, PyObject* args)
E_Bool rmOverlappingPts=true; E_Bool rmOrphanPts=false;
E_Bool rmDuplicatedFaces=true; E_Bool rmDuplicatedElts=false;
E_Bool rmDegeneratedFaces=true; E_Bool rmDegeneratedElts=false;
tpl = K_CONNECT::V_cleanConnectivity(varString, *f2, *cn2, "NGON", tol,
rmOverlappingPts, rmOrphanPts,
rmDuplicatedFaces, rmDuplicatedElts,
rmDegeneratedFaces, rmDegeneratedElts);
delete f2; delete cn2;
return tpl;
}
PyObject* tplClean = K_CONNECT::V_cleanConnectivity(
varString, *f2, *cn2, "NGON", tol,
rmOverlappingPts, rmOrphanPts,
rmDuplicatedFaces, rmDuplicatedElts,
rmDegeneratedFaces, rmDegeneratedElts
);

RELEASESHAREDU(tpl, f2, cn2);
if (tplClean == NULL) return tpl;
else { Py_DECREF(tpl); return tplClean; }
}
18 changes: 11 additions & 7 deletions Cassiopee/Converter/Converter/convertUnstruct2NGon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,14 @@ PyObject* K_CONVERTER::convertUnstruct2NGon(PyObject* self, PyObject* args)
E_Bool rmOverlappingPts=true; E_Bool rmOrphanPts=false;
E_Bool rmDuplicatedFaces=true; E_Bool rmDuplicatedElts=false;
E_Bool rmDegeneratedFaces=false; E_Bool rmDegeneratedElts=false;
tpl = K_CONNECT::V_cleanConnectivity(varString, *f2, *cn2, "NGON", tol,
rmOverlappingPts, rmOrphanPts,
rmDuplicatedFaces, rmDuplicatedElts,
rmDegeneratedFaces, rmDegeneratedElts);
delete f2; delete cn2;
return tpl;
}
PyObject* tplClean = K_CONNECT::V_cleanConnectivity(
varString, *f2, *cn2, "NGON", tol,
rmOverlappingPts, rmOrphanPts,
rmDuplicatedFaces, rmDuplicatedElts,
rmDegeneratedFaces, rmDegeneratedElts
);

RELEASESHAREDU(tpl, f2, cn2);
if (tplClean == NULL) return tpl;
else { Py_DECREF(tpl); return tplClean; }
}
47 changes: 24 additions & 23 deletions Cassiopee/Envs/sh_Cassiopee_local
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,30 @@ ulimit -s unlimited
# stelvio: x86 processors, intel compilers -> stv

# Detect machine (shortest first)
KC=`uname -n`
MAC0=$(echo $KC | grep 'n'); if [ "$MAC0" != "" ]; then export MAC="sator_cas"; fi
MAC0=$(echo $KC | grep 'ld'); if [ "$MAC0" != "" ]; then export MAC="ld"; fi
MAC0=$(echo $KC | grep 'clausius'); if [ "$MAC0" != "" ]; then export MAC="ld"; fi
MAC0=$(echo $KC | grep 'ubuntu'); if [ "$MAC0" != "" ]; then export MAC="ubuntu"; fi
MAC0=$(echo $KC | grep 'visio'); if [ "$MAC0" != "" ]; then export MAC="visio"; fi
MAC0=$(echo $KC | grep 'austri'); if [ "$MAC0" != "" ]; then export MAC="austri"; fi
MAC0=$(echo $KC | grep 'celeste'); if [ "$MAC0" != "" ]; then export MAC="visio"; fi
MAC0=$(echo $KC | grep 'visung'); if [ "$MAC0" != "" ]; then export MAC="juno"; fi
MAC0=$(echo $KC | grep 'giulia'); if [ "$MAC0" != "" ]; then export MAC="giulia"; fi
MAC0=$(echo $KC | grep 'sator'); if [ "$MAC0" != "" ]; then export MAC="sator_cas"; fi
MAC0=$(echo $KC | grep 'jean-zay'); if [ "$MAC0" != "" ]; then export MAC="jean-zay"; fi
MAC0=$(echo $KC | grep 'spiro'); if [ "$MAC0" != "" ]; then export MAC="spiro_el8"; fi
MAC0=$(echo $KC | grep 'f0'); if [ "$MAC0" != "" ]; then export MAC="juno"; fi
MAC0=$(echo $KC | grep 'n0'); if [ "$MAC0" != "" ]; then export MAC="juno"; fi
MAC0=$(echo $KC | grep 'v0'); if [ "$MAC0" != "" ]; then export MAC="juno"; fi
MAC0=$(echo $KC | grep 'cobalt'); if [ "$MAC0" != "" ]; then export MAC="cobalt"; fi
MAC0=$(echo $KC | grep 'irene'); if [ "$MAC0" != "" ]; then export MAC="irene"; fi
MAC0=$(echo $KC | grep 'jean-zay'); if [ "$MAC0" != "" ]; then export MAC="jean-zay"; fi
MAC0=$(echo $KC | grep 'node6.cluster'); if [ "$MAC0" != "" ]; then export MAC="macosx"; fi
MAC0=$(echo $KC | grep 'topaze'); if [ "$MAC0" != "" ]; then export MAC="topaze"; fi
MAC0=$(echo $KC | grep 'Aryen'); if [ "$MAC0" != "" ]; then export MAC="aryen"; fi
MAC0=$(echo $KC | grep 'WDAAA161Z'); if [ "$MAC0" != "" ]; then export MAC="WDAAA161Z"; fi
KC=$(uname -n)
if echo "$KC" | grep -q 'n'; then export MAC="sator_cas"; fi
if echo "$KC" | grep -q 'ld'; then export MAC="ld"; fi
if echo "$KC" | grep -q 'f0'; then export MAC="juno"; fi
if echo "$KC" | grep -q 'n0'; then export MAC="juno"; fi
if echo "$KC" | grep -q 'v0'; then export MAC="juno"; fi
if echo "$KC" | grep -q 'fv-az'; then export MAC="ubuntu"; fi
if echo "$KC" | grep -q 'clausius'; then export MAC="ld"; fi
if echo "$KC" | grep -q 'ubuntu'; then export MAC="ubuntu"; fi
if echo "$KC" | grep -q 'visio'; then export MAC="visio"; fi
if echo "$KC" | grep -q 'austri'; then export MAC="austri"; fi
if echo "$KC" | grep -q 'celeste'; then export MAC="visio"; fi
if echo "$KC" | grep -q 'visung'; then export MAC="juno"; fi
if echo "$KC" | grep -q 'giulia'; then export MAC="giulia"; fi
if echo "$KC" | grep -q 'sator'; then export MAC="sator_cas"; fi
if echo "$KC" | grep -q 'jean-zay'; then export MAC="jean-zay"; fi
if echo "$KC" | grep -q 'spiro'; then export MAC="spiro_el8"; fi
if echo "$KC" | grep -q 'cobalt'; then export MAC="cobalt"; fi
if echo "$KC" | grep -q 'irene'; then export MAC="irene"; fi
if echo "$KC" | grep -q 'jean-zay'; then export MAC="jean-zay"; fi
if echo "$KC" | grep -q 'node6.cluster'; then export MAC="macosx"; fi
if echo "$KC" | grep -q 'topaze'; then export MAC="topaze"; fi
if echo "$KC" | grep -q 'Aryen'; then export MAC="aryen"; fi
if echo "$KC" | grep -q 'WDAAA161Z'; then export MAC="WDAAA161Z"; fi

# Detect MAC environement from MACHINE
INTTYPE=""
Expand Down
12 changes: 6 additions & 6 deletions Cassiopee/Generator/Generator/close.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PyObject* K_GENERATOR::closeMesh(PyObject* self, PyObject* args)
E_Int posz = K_ARRAY::isCoordinateZPresent(varString);
if (posx == -1 || posy == -1 || posz == -1)
{
delete f;
RELEASESHAREDB(res, array, f, cn);
PyErr_SetString(PyExc_TypeError,
"close: can't find coordinates in array.");
return NULL;
Expand All @@ -68,14 +68,14 @@ PyObject* K_GENERATOR::closeMesh(PyObject* self, PyObject* args)
{
closeStructuredMesh(f->begin(posx), f->begin(posy), f->begin(posz), im, jm, km, eps);
PyObject* tpl = K_ARRAY::buildArray3(*f, varString, im, jm, km);
delete f;
RELEASESHAREDS(array, f);
return tpl;
}
else if (res == 2)
{
if (strchr(eltType, '*') != NULL)
{
delete f; delete cn;
RELEASESHAREDU(array, f, cn);
PyErr_SetString(PyExc_TypeError,
"close: array must be defined at vertices.");
return NULL;
Expand All @@ -85,10 +85,10 @@ PyObject* K_GENERATOR::closeMesh(PyObject* self, PyObject* args)
varString, *f, *cn, eltType, eps,
rmOverlappingPts, rmOrphanPts, rmDuplicatedFaces, rmDuplicatedElts,
rmDegeneratedFaces, rmDegeneratedElts);
if (tpl == NULL) tpl = K_ARRAY::buildArray3(*f, varString, *cn, eltType); // tpl = array;

delete f; delete cn;
return tpl;
RELEASESHAREDU(array, f, cn);
if (tpl == NULL) return array;
else return tpl;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Cassiopee/Post/Post/selectExteriorFaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,9 @@ PyObject* K_POST::selectExteriorFacesNGon3D(char* varString, FldArrayF& f,
{
e1 = cFE1[i]; // element voisin 1
e2 = cFE2[i]; // element voisin 2
E_Int* face = cn.getFace(i, nbnodes, ngon, indPG);
if ((e1 == 0 && e2 != 0) || (e2 == 0 && e1 != 0))
{
E_Int* face = cn.getFace(i, nbnodes, ngon, indPG);
sizeEF2 += nbnodes+shift; nfacesExt++;
exteriorFaces.push_back(i+1);

Expand Down

0 comments on commit 6f53b17

Please sign in to comment.