From: Nabil Ghodbane Date: Thu, 1 Aug 2024 14:26:43 +0000 (+0200) Subject: spns #42665: MeshIO: GMSH and ANSYS X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a532af5445371beaee3d789cb46b05f716a64c2d;p=tools%2Fsat_salome.git spns #42665: MeshIO: GMSH and ANSYS --- diff --git a/applications/SALOME-9.13.0-native.pyconf b/applications/SALOME-9.13.0-native.pyconf index 37d4212..c7d2097 100644 --- a/applications/SALOME-9.13.0-native.pyconf +++ b/applications/SALOME-9.13.0-native.pyconf @@ -237,7 +237,7 @@ __overwrite__ : 'APPLICATION.products.cmake' : 'native' # TTK requires cmake > 3.21 'APPLICATION.products.cftime' : 'native' 'APPLICATION.products.h5py' : 'native' - 'APPLICATION.products.meshio' : 'native' + 'APPLICATION.products.meshio' : {tag: '5.3.5' , base: 'no', section: 'version_5_3_5_no_pip' } 'APPLICATION.products.netCDF4' : 'native' 'APPLICATION.products.rich' : 'native' 'APPLICATION.products.cminpack' : 'native' @@ -292,7 +292,7 @@ __overwrite__ : 'APPLICATION.products.h5py' : 'native' 'APPLICATION.products.markdown_it_py' : 'native' 'APPLICATION.products.mdurl' : 'native' - 'APPLICATION.products.meshio' : 'native' + 'APPLICATION.products.meshio' : {tag: '5.3.5', base: 'no', section: 'version_5_3_5_no_pip'} 'APPLICATION.products.netCDF4' : 'native' 'APPLICATION.products.rich' : 'native' 'APPLICATION.products.opencv' : {tag: '3.2.0', base: 'no', section: 'version_3_2_0_DB12'} diff --git a/applications/SALOME-master-native.pyconf b/applications/SALOME-master-native.pyconf index 1c9df31..87c23ab 100644 --- a/applications/SALOME-master-native.pyconf +++ b/applications/SALOME-master-native.pyconf @@ -292,7 +292,7 @@ __overwrite__ : 'APPLICATION.products.h5py' : 'native' 'APPLICATION.products.markdown_it_py' : 'native' 'APPLICATION.products.mdurl' : 'native' - 'APPLICATION.products.meshio' : 'native' + 'APPLICATION.products.meshio' : {tag: '5.3.4', base: 'no', section: 'version_5_3_4_no_pip'} 'APPLICATION.products.netCDF4' : 'native' 'APPLICATION.products.rich' : 'native' 'APPLICATION.products.opencv' : {tag: '3.2.0', base: 'no', section: 'version_3_2_0_DB12'} diff --git a/products/compil_scripts/meshio-5.3.4.sh b/products/compil_scripts/meshio-5.3.4.sh index 19ec707..ed3c5bc 100755 --- a/products/compil_scripts/meshio-5.3.4.sh +++ b/products/compil_scripts/meshio-5.3.4.sh @@ -34,5 +34,40 @@ case $LINUX_DISTRIBUTION in ;; esac +pyVersionMajor=python$($PYTHONBIN -c 'import sys; print(".".join(map(str, sys.version_info[0:1])))') +if [ $? -ne 0 ]; then + echo ERROR: Failed to extract major Python version - assuming Python version equal to 3... + pyVersionMajor=python3 +fi + +echo INFO: Python version major: ${pyVersionMajor} +if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio ]; then + sed -i "s%#\!.*python[0-9]*%#\!/usr/bin/env ${pyVersionMajor}%#g" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio +else + echo "FATAL: could not find meshio runner!" + exit 1 +fi + +# bos #42618 - https://github.com/nschloe/meshio/issues/1484 +if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py ]; then + sed -i '/"gmsh22"/a \ \ \ \ \ \ \ \ "gmsh40": lambda f, m, **kwargs: write(f, m, "4.0", **kwargs),' $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py +else + echo "FATAL: could not find gmsh meshio driver!" + exit 1 +fi + +# spns #42665 +if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py ]; then + # retrieve line number + l=$(grep -nA0 "raise KeyError" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py|cut -d':' -f1) + L=$(($l+2)) + sed -i 's/raise KeyError(/warn(/g' $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py + # move to next cell + sed -i "${L}s/)/)\n continue/g" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py +else + echo "FATAL: could not find ansys meshio driver!" + exit 1 +fi + echo echo "########## END" diff --git a/products/compil_scripts/meshio-5.3.5.sh b/products/compil_scripts/meshio-5.3.5.sh index 898f73e..8f39cef 100755 --- a/products/compil_scripts/meshio-5.3.5.sh +++ b/products/compil_scripts/meshio-5.3.5.sh @@ -28,9 +28,10 @@ done pyVersionMajor=python$($PYTHONBIN -c 'import sys; print(".".join(map(str, sys.version_info[0:1])))') if [ $? -ne 0 ]; then - echo ERROR: Failed to extract major Python version - assuming Python version equal to 3... - pyVersionMajor=python3 + echo ERROR: Failed to extract major Python version - assuming Python version equal to 3... + pyVersionMajor=python3 fi + echo INFO: Python version major: ${pyVersionMajor} if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio ]; then sed -i "s%#\!.*python[0-9]*%#\!/usr/bin/env ${pyVersionMajor}%#g" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/bin/meshio @@ -39,5 +40,26 @@ else exit 1 fi +# bos #42618 - https://github.com/nschloe/meshio/issues/1484 +if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py ]; then + sed -i '/"gmsh22"/a \ \ \ \ \ \ \ \ "gmsh40": lambda f, m, **kwargs: write(f, m, "4.0", **kwargs),' $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/gmsh/main.py +else + echo "FATAL: could not find gmsh meshio driver!" + exit 1 +fi + +# spns #42665 +if [ -f $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py ]; then + # retrieve line number + l=$(grep -nA0 "raise KeyError" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py|cut -d':' -f1) + L=$(($l+2)) + sed -i 's/raise KeyError(/warn(/g' $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py + # move to next cell + sed -i "${L}s/)/)\n continue/g" $PRODUCT_INSTALL/lib/python${PYTHON_VERSION}/site-packages/meshio/ansys/_ansys.py +else + echo "FATAL: could not find ansys meshio driver!" + exit 1 +fi + echo echo "########## END"