Skip to content

Commit

Permalink
Version 7.10.2. Malipp2 writer fix (file corrupted until application …
Browse files Browse the repository at this point in the history
…is exited). Python 3.12 port.
  • Loading branch information
Charles PIGNEROL committed Aug 28, 2024
1 parent c352ea9 commit 299ecfb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 9 deletions.
8 changes: 7 additions & 1 deletion cmake/python_binding.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ find_package (SWIG 3 REQUIRED)
#find_package (Python REQUIRED COMPONENTS Interpreter Development) # Rem : Python3 a la priorité => inutilisé car empêche l'accès à Python2
if (USE_PYTHON_3)
message (STATUS "========================================= UTILISATION DE PYTHON 3 =========================================")
set (Python3_FIND_STRATEGY LOCATION) # Nécessaire pour python >= 3.10
find_package (Python3 REQUIRED COMPONENTS Interpreter Development)
set (Python_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
set (Python_EXECUTABLE ${Python3_EXECUTABLE})
Expand Down Expand Up @@ -45,7 +46,12 @@ macro (_set_from_python outvar python_code)
endif ( )
endmacro ( )

_set_from_python (_GET_PYTHON_SITEARCH "import sys; from distutils import sysconfig; sys.stdout.write (sysconfig.get_python_lib (plat_specific=True, standard_lib=False, prefix=''))")
if (USE_PYTHON_3) # ATTENTION, ne marche peut être pas pour 3.0 <= python < 3.12. Le cas échéant la commande du else doit convenir.
_set_from_python (_GET_PYTHON_SITEARCH "import os, sys, sysconfig; sitepackages=os.path.relpath (sysconfig.get_path('platlib'), sys.base_prefix); sys.stdout.write (sitepackages)")
else (USE_PYTHON_3)
_set_from_python (_GET_PYTHON_SITEARCH "import sys; from distutils import sysconfig; sys.stdout.write (sysconfig.get_python_lib (plat_specific=True, standard_lib=False, prefix=''))")
endif (USE_PYTHON_3)

set (PYTHON_BINDING_DIR ${_GET_PYTHON_SITEARCH})
set (CMAKE_PYTHON_RPATH_DIR ${CMAKE_INSTALL_PREFIX}/${_GET_PYTHON_SITEARCH})

Expand Down
2 changes: 1 addition & 1 deletion cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set (LIMA_MAJOR_VERSION "7")
set (LIMA_MINOR_VERSION "10")
set (LIMA_RELEASE_VERSION "1")
set (LIMA_RELEASE_VERSION "2")
set (LIMA_VERSION ${LIMA_MAJOR_VERSION}.${LIMA_MINOR_VERSION}.${LIMA_RELEASE_VERSION})


4 changes: 2 additions & 2 deletions installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_
-DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_XLMLIMA=ON -DBUILD_TESTS:BOOL=ON -DBUILD_SCRIPTING:BOOL=ON -DMACHINE_TYPES:BOOL=OFF -DSUMESH:BOOL=OFF -DFORMAT_MLI:BOOL=OFF -DFORMAT_MLI2:BOOL=ON -DFORMAT_MLI2:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON -DINT_8:BOOL=ON -DREAL_8:BOOL=ON \
-DSWIG_EXECUTABLE=/opt/swig/4.1.1/bin/swig -DPython2_ROOT_DIR=/usr/lib/python2.7 -DHDF5_ROOT=/opt/HDF5/1.12.0 \
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.10.0
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.10.2
cmake --build /tmp/lima_build_dir
cmake --install /tmp/lima_build_dir

Expand All @@ -30,7 +30,7 @@ cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_
-DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_XLMLIMA=ON -DBUILD_TESTS:BOOL=ON -DBUILD_SCRIPTING:BOOL=ON -DMACHINE_TYPES:BOOL=ON -DSUMESH:BOOL=ON -DFORMAT_MLI:BOOL=ON -DFORMAT_MLI2:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON -DINT_8:BOOL=ON -DREAL_8:BOOL=ON \
-DSWIG_EXECUTABLE=/opt/swig/4.1.1/bin/swig -DPython2_ROOT_DIR=/usr/lib/python2.7 -DHDF5_ROOT=/opt/HDF5/1.12.0 -DHDF145_INCLUDE_DIR=/opt/hdf145/1.3.0/include -DHDF145CPP_LIBRARY=/opt/hdf145/1.3.0/lib/libhdf145_cpp.so -DHDF145_LIBRARY=/opt/hdf145/1.3.0/lib/libhdf145.so \
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.10.0
-B /tmp/lima_build_dir -DCMAKE_INSTALL_PREFIX=/opt/Lima/7.10.2
cmake --build /tmp/lima_build_dir
cmake --install /tmp/lima_build_dir

Expand Down
60 changes: 55 additions & 5 deletions src/Lima/malipp2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,27 +2041,41 @@ static size_t computeChunkSize (size_t count, size_t elementSize)


MaliPPWriter2::MaliPPWriter2 (const IN_STD string& nom_fichier, size_type num)
: m_fileName(nom_fichier), m_meshNum(num),
: m_fileName(nom_fichier), m_meshNum(num), m_meshGroup ( ), m_hdfFile ( ),
m_dim(D3),
m_unilo(1.),
m_unia(1.),
m_geom(NORMAL),
m_tycoo(CARTESIEN),
m_titre(""),
m_date(""),
m_nbMeshAttributes (0),
m_meshAttributesGroup ( ),
m_nodesIsContiguous(false),
m_nodeIndexCurrent(0),
m_nbNodes(0),
m_nbNodeSet (0),
m_nbNodeAttributes (0),
m_nbNodeSetsAttributes (0),
m_edgesIsContiguous(false),
m_edgeIndexCurrent(0),
m_nbEdges(0),
m_nbEdgeSet (0),
m_nbEdgeAttributes (0),
m_nbEdgeSetsAttributes (0),
m_facesIsContiguous(false),
m_faceIndexCurrent(0),
m_nbFaces(0),
m_nbFaceSet (0),
m_nbFaceAttributes (0),
m_nbFaceSetsAttributes (0),
m_nbNodesPerFaceIndexCurrent(0),
m_regionsIsContiguous(false),
m_regionIndexCurrent(0),
m_nbRegions(0),
m_nbRegionSet (0),
m_nbRegionAttributes (0),
m_nbRegionSetsAttributes (0),
m_nbNodesPerRegionIndexCurrent(0)
{

Expand Down Expand Up @@ -2384,10 +2398,46 @@ void MaliPPWriter2::close ( )
writeComposition (m_regionSetCompo[igrp], CELL3D_COMPOSITION_DATASET_NAME, m_regionSetGroups[igrp]);
}

m_meshGroup = Group ( );
m_hdfFile->flush(H5F_SCOPE_LOCAL);
m_hdfFile->close();
m_hdfFile.reset (0);
m_meshGroup = Group ( );
m_meshAttributesGroup = Group ( );
m_nodeGroup = Group ( );
m_nodeZCoordDataSet = DataSet ( );
m_nodeYCoordDataSet = DataSet ( );
m_nodeXCoordDataSet = DataSet ( );
m_nodeIdsDataSet = DataSet ( );
m_nodeSetGroup = Group ( );
m_nodeSetGroups.clear ( );
m_nodeSetIdsDataSet.clear ( );
m_nodeAttributesGroup = Group ( );
m_nodeSetsAttributesGroup = Group ( );
m_edgeGroup = Group ( );
m_edge2nodeIdsDataSet = DataSet ( );
m_edgeIdsDataSet = DataSet ( );
m_edgeSetGroup = Group ( );
m_edgeSetGroups.clear ( );
m_edgeSetIdsDataSet.clear ( );
m_edgeAttributesGroup = Group ( );
m_edgeSetsAttributesGroup = Group ( );
m_faceGroup = Group ( );
m_face2nodeIdsDataSet = DataSet ( );
m_nbNodesPerFaceDataSet = DataSet ( );
m_faceIdsDataSet = DataSet ( );
m_faceSetGroup = Group ( );
m_faceSetGroups.clear ( );
m_faceSetIdsDataSet.clear ( );
m_faceAttributesGroup = Group ( );
m_faceSetsAttributesGroup = Group ( );
m_regionGroup = Group ( );
m_region2nodeIdsDataSet = DataSet ( );
m_nbNodesPerRegionDataSet = DataSet ( );
m_regionIdsDataSet = DataSet ( );
m_regionSetGroup = Group ( );
m_regionSetGroups.clear ( );
m_regionSetIdsDataSet.clear ( );
m_regionAttributesGroup = Group ( );
m_regionSetsAttributesGroup = Group ( );

m_hdfFile.reset (0); // CP : invoque close ( )

COMPLETE_TRY_CATCH_BLOCK
if (throwExc) {
Expand Down

0 comments on commit 299ecfb

Please sign in to comment.