Skip to content

Commit

Permalink
Update to SMESH 9.7.0 (#51)
Browse files Browse the repository at this point in the history
* Update to SMESH 9.7.0

* Don't use Int64 configuration

* Attempt a fix (hack) for VTK error
  • Loading branch information
trelau authored Sep 26, 2021
1 parent fd12010 commit 36faf9f
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 49 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.3)
project(SMESH VERSION 9.6.0.2 LANGUAGES C CXX)
project(SMESH VERSION 9.7.0.0 LANGUAGES C CXX)

# --------------------------------------------------------------------------- #
# OPTIONS
Expand All @@ -13,9 +13,9 @@ set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
# SETTINGS
# --------------------------------------------------------------------------- #
set(SMESH_VERSION_MAJOR 9)
set(SMESH_VERSION_MINOR 6)
set(SMESH_VERSION_MINOR 7)
set(SMESH_VERSION_PATCH 0)
set(SMESH_VERSION_TWEAK 2)
set(SMESH_VERSION_TWEAK 0)

# Build shared libraries
set(BUILD_SHARED_LIBS TRUE)
Expand Down Expand Up @@ -51,6 +51,7 @@ endif(UNIX)

if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
add_definitions(-D_OCC64)
# add_definitions(-DSALOME_USE_64BIT_IDS)
endif(CMAKE_SIZEOF_VOID_P STREQUAL 8)


Expand Down
2 changes: 1 addition & 1 deletion ci/conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: smesh4pyocct
version: "9.6.0.2"
version: "9.7.0.0"

source:
path: ../..
Expand Down
2 changes: 2 additions & 0 deletions cmake/Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ else()
set_target_properties(Kernel PROPERTIES COMPILE_FLAGS "-DSMESH_ONLY")
endif()

configure_file(${Kernel_SRC_DIR}/Basics/smIdType.hxx.in ${Kernel_SRC_DIR}/Basics/smIdType.hxx)

file(GLOB Kernel_INCLUDES
${Kernel_SRC_DIR}/Basics/*.h*
${Kernel_SRC_DIR}/SALOMELocalTrace/*.h*
Expand Down
2 changes: 2 additions & 0 deletions cmake/SMESH/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ install(FILES ${SMDS_INCLUDES} DESTINATION "include/smesh/SMDS")

# SMESH
file(GLOB SMESH_SRC ${SMESH_SRC_DIR}/SMESH/*.cxx)
list(REMOVE_ITEM SMESH_SRC "${SMESH_SRC_DIR}/SMESH/MG_ADAPT.cxx")
add_library(SMESH ${SMESH_SRC})
target_link_libraries(SMESH Kernel Geom Controls SMESHDS Driver DriverDAT DriverSTL DriverUNV DriverGMF TKShHealing TKPrim TKG2d TKCDF TKMeshVS ${Boost_LIBRARIES})
target_include_directories(SMESH PUBLIC
Expand Down Expand Up @@ -193,6 +194,7 @@ if(ENABLE_NETGEN)
list(REMOVE_ITEM NETGENPlugin_SRC ${NETGENPlugin_Remesher_2D_SRC})
file(GLOB NETGENPlugin_SRC_i ${NETGENPlugin_SRC_DIR}/*_i.cxx)
list(REMOVE_ITEM NETGENPlugin_SRC ${NETGENPlugin_SRC_i})

add_library(NETGENPlugin ${NETGENPlugin_SRC})
target_link_libraries(NETGENPlugin StdMeshers nglib4smesh)
target_include_directories(NETGENPlugin PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion external/Geom
Submodule Geom updated from b5f99c to 8687a5
2 changes: 1 addition & 1 deletion external/Kernel
Submodule Kernel updated from 4c6403 to 665f7c
2 changes: 1 addition & 1 deletion external/NETGENPlugin
Submodule NETGENPlugin updated from ee6a7e to c0a871
2 changes: 1 addition & 1 deletion external/SMESH
Submodule SMESH updated from cca498 to d7de79
50 changes: 36 additions & 14 deletions patch/NETGENPlugin.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx
--- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx
+++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx
@@ -41,14 +41,14 @@
@@ -39,18 +39,18 @@
#include <SMESH_Block.hxx>
#include <SMESH_Comment.hxx>
#include <SMESH_ComputeError.hxx>
#include <SMESH_ControlPnt.hxx>
#include <SMESH_File.hxx>
Expand All @@ -18,43 +20,63 @@ diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENP

#include <utilities.h>

@@ -646,6 +646,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
// mesh size file
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_Copy.hxx>
@@ -645,10 +645,11 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
mparams.meshsizefilename = hyp->GetMeshSizeFile();
#else
// const char*
mparams.meshsizefilename= hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str();

+ /*
#endif
+ /*
const NETGENPlugin_Hypothesis::TLocalSize& localSizes = hyp->GetLocalSizesAndEntries();
if ( !localSizes.empty() )
{
@@ -667,6 +668,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin();
@@ -666,10 +667,11 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
}
TopoDS_Shape S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
setLocalSize(S, val);
}
}
+ */
+ */
}
}

@@ -4430,7 +4432,8 @@ void NETGENPlugin_NetgenLibWrapper::setMesh( Ng_Mesh* mesh )
//=============================================================================
/*!
@@ -4473,11 +4475,12 @@ void NETGENPlugin_NetgenLibWrapper::CalcLocalH( netgen::Mesh * ngMesh )
*/
//================================================================================

std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
{
- std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
+ // std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
+ std::string aTmpDir = "/tmp";
+ std::string aTmpDir = "/tmp";

TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
TCollection_AsciiString aGenericName = aTmpDir.c_str();
aGenericName += "NETGEN_";
@@ -4474,6 +4477,7 @@ void NETGENPlugin_NetgenLibWrapper::RemoveTmpFiles()
#ifndef WIN32
aGenericName += getpid();
@@ -4517,10 +4520,11 @@ void NETGENPlugin_NetgenLibWrapper::RemoveTmpFiles()
*/
//================================================================================

void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
{
+ /*
+ /*
if ( !_outputFileName.empty() )
{
if ( _ngcout )
@@ -4491,4 +4495,5 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
{
delete netgen::mycout;
@@ -4534,6 +4538,7 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
aFiles.reserve(1);
aFiles.push_back(aFileName.c_str());

SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.c_str(), aFiles, true );
}
+ */
}
}
77 changes: 55 additions & 22 deletions patch/SMESH.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx
--- a/src/SMESH/SMESH_Mesh.cxx
+++ b/src/SMESH/SMESH_Mesh.cxx
@@ -44,8 +44,10 @@
@@ -42,12 +42,14 @@
#include "utilities.h"

#include "DriverDAT_W_SMDS_Mesh.h"
#include "DriverGMF_Read.hxx"
#include "DriverGMF_Write.hxx"
Expand All @@ -12,15 +14,23 @@ diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx
#include "DriverSTL_R_SMDS_Mesh.h"
#include "DriverSTL_W_SMDS_Mesh.h"
#include "DriverUNV_R_SMDS_Mesh.h"
@@ -502,6 +504,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
#include "DriverUNV_W_SMDS_Mesh.h"
#ifdef WITH_CGNS
@@ -500,10 +502,11 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
//purpose :
//=======================================================================

int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
{
+#ifdef WITH_MED
if ( _isShapeToMesh )
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
_isShapeToMesh = false;
@@ -536,6 +539,9 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)

DriverMED_R_SMESHDS_Mesh myReader;
@@ -534,10 +537,13 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)

_myMeshDS->Modified();
_myMeshDS->CompactMesh();

return (int) status;
Expand All @@ -30,47 +40,70 @@ diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx
}

//=======================================================================
@@ -1434,6 +1440,7 @@ void SMESH_Mesh::ExportMED(const char * file,
//function : STLToMesh
//purpose :
@@ -1425,10 +1431,11 @@ void SMESH_Mesh::ExportMED(const char * file,
bool theAutoDimension,
bool theAddODOnVertices,
double theZTolerance,
bool theAllElemsToGroup)
throw(SALOME_Exception)
{
+#ifdef WITH_MED
MESSAGE("MED_VERSION:"<< theVersion);

Driver_Mesh::Status status;
SMESH_TRY;

@@ -1492,6 +1499,7 @@ throw(SALOME_Exception)
myWriter.Perform();
@@ -1488,10 +1495,11 @@ void SMESH_Mesh::ExportMED(const char * file,

SMESH_CATCH( SMESH::throwSalomeEx );

if ( status == Driver_Mesh::DRS_TOO_LARGE_MESH )
throw TooLargeForExport("MED");
+#endif
}

//================================================================================
@@ -1505,6 +1513,7 @@ void SMESH_Mesh::ExportSAUV(const char *file,
/*!
* \brief Export the mesh to a SAUV file
@@ -1500,10 +1508,11 @@ void SMESH_Mesh::ExportMED(const char * file,

void SMESH_Mesh::ExportSAUV(const char *file,
const char* theMeshName,
bool theAutoGroups)
throw(SALOME_Exception)
{
+#ifdef WITH_MED
std::string medfilename(file);
medfilename += ".med";
std::string cmd;
@@ -1538,6 +1547,7 @@ void SMESH_Mesh::ExportSAUV(const char *file,
#ifdef WIN32
cmd = "%PYTHONBIN% ";
@@ -1539,10 +1548,11 @@ void SMESH_Mesh::ExportSAUV(const char *file,
#endif
cmd += "-c \"";
cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
cmd += "\"";
system(cmd.c_str());
+#endif
}

//================================================================================
diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx
--- a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx
+++ b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx
@@ -2561,7 +2561,7 @@ namespace
case 3: // at a corner
{
_Node& node = _hexNodes[ subEntity - SMESH_Block::ID_FirstV ];
- if ( node.Node() > 0 )
+ if ( node.Node() != nullptr )
{
if ( node._intPoint )
node._intPoint->Add( _eIntPoints[ iP ]->_faceIDs, _eIntPoints[ iP ]->_node );
/*!
* \brief Export the mesh to a DAT file
diff --git a/src/SMDS/SMDS_UnstructuredGrid.hxx b/src/SMDS/SMDS_UnstructuredGrid.hxx
--- a/src/SMDS/SMDS_UnstructuredGrid.hxx
+++ b/src/SMDS/SMDS_UnstructuredGrid.hxx
@@ -24,10 +24,13 @@
#ifndef _SMDS_UNSTRUCTUREDGRID_HXX
#define _SMDS_UNSTRUCTUREDGRID_HXX

#include "SMESH_SMDS.hxx"

+ // Fix for https://discourse.vtk.org/t/compilation-error-include-limits-required-in-several-files/6496
+#include <limits>
+
#include <vtkUnstructuredGrid.h>
#include <vtkCellLinks.h>
#include <smIdType.hxx>

#include <vector>
19 changes: 14 additions & 5 deletions prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def prepare_netgen():
# Patch Netgen sources for SALOME
pset = patch.fromfile('external/NETGENPlugin/src/NETGEN/netgen53ForSalome.patch')
pset.apply(strip=1, root='src/Netgen')

if sys.platform == 'win32':
pset = patch.fromfile('external/NETGENPlugin/src/NETGEN/netgen53ForWindows.patch')
pset.apply(strip=1, root='src/Netgen')
Expand Down Expand Up @@ -50,7 +51,9 @@ def prepare_kernel():

# Patch sources
pset = patch.fromfile('patch/Kernel.patch')
pset.apply(strip=0, root='src/Kernel')
success = pset.apply(strip=0, root='src/Kernel')
if not success:
raise RuntimeError('Failed to apply Kernel patch.')


def prepare_geom():
Expand Down Expand Up @@ -88,11 +91,15 @@ def prepare_smesh():

# Patch sources
pset = patch.fromfile('patch/SMESH.patch')
pset.apply(strip=0, root='src/SMESH')
success = pset.apply(strip=0, root='src/SMESH')
if not success:
raise RuntimeError('Failed to apply SMESH patch.')

# Patch sources
pset = patch.fromfile('patch/mefisto.patch')
pset.apply(strip=0, root='src/SMESH')
success = pset.apply(strip=0, root='src/SMESH')
if not success:
raise RuntimeError('Failed to apply mefisto patch.')

# Copy MeshVSLink sources
shutil.copytree('extra/MeshVSLink',
Expand All @@ -116,7 +123,9 @@ def prepare_netgen_plugin():

# Patch sources
pset = patch.fromfile('patch/NETGENPlugin.patch')
pset.apply(strip=0, root='src/SMESH/src/NETGENPlugin')
success = pset.apply(strip=0, root='src/SMESH/src/NETGENPlugin')
if not success:
raise RuntimeError('Failed to apply NETGENPlugin patch.')


def prepare_noexcept():
Expand All @@ -136,6 +145,6 @@ def prepare_noexcept():
prepare_geom()
prepare_smesh()
prepare_netgen_plugin()
prepare_noexcept()
# prepare_noexcept()


0 comments on commit 36faf9f

Please sign in to comment.