mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 02:00:34 +05:00
0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported
make CGNS library an optional prerequisite
This commit is contained in:
parent
54d766ea04
commit
39841ffadd
@ -44,32 +44,37 @@ cgns_ok=no
|
|||||||
LOCAL_INCLUDES=""
|
LOCAL_INCLUDES=""
|
||||||
LOCAL_LIBS="-lcgns $HDF5_LIBS"
|
LOCAL_LIBS="-lcgns $HDF5_LIBS"
|
||||||
|
|
||||||
if test -z $CGNSHOME
|
if test "x$CGNSHOME" != "xno"; then
|
||||||
then
|
if test "x$CGNSHOME" == "xyes"; then
|
||||||
AC_MSG_WARN(undefined CGNSHOME variable which specify CGNS library installation directory)
|
CGNSHOME=""
|
||||||
AC_PATH_PROG(BINDIR, cgnsversion)
|
fi
|
||||||
if test "x$BINDIR" != "x" ; then
|
if test -z $CGNSHOME
|
||||||
CGNSHOME=$BINDIR
|
then
|
||||||
CGNSHOME=`echo ${CGNSHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
|
AC_MSG_WARN(undefined CGNSHOME variable which specify CGNS library installation directory)
|
||||||
CGNSHOME=`echo ${CGNSHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
|
AC_PATH_PROG(BINDIR, cgnsversion)
|
||||||
fi
|
if test "x$BINDIR" != "x" ; then
|
||||||
fi
|
CGNSHOME=$BINDIR
|
||||||
if test ! -z $CGNSHOME
|
CGNSHOME=`echo ${CGNSHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
|
||||||
then
|
CGNSHOME=`echo ${CGNSHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
|
||||||
LOCAL_INCLUDES="-I$CGNSHOME/include"
|
fi
|
||||||
if test "x$CGNSHOME" != "x/usr"; then
|
fi
|
||||||
LOCAL_LIBS="-L$CGNSHOME/lib $LOCAL_LIBS"
|
if test ! -z $CGNSHOME
|
||||||
fi
|
then
|
||||||
fi
|
LOCAL_INCLUDES="-I$CGNSHOME/include"
|
||||||
|
if test "x$CGNSHOME" != "x/usr"; then
|
||||||
|
LOCAL_LIBS="-L$CGNSHOME/lib $LOCAL_LIBS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
dnl check cgnslib header
|
dnl check cgnslib header
|
||||||
|
|
||||||
CPPFLAGS_old=$CPPFLAGS
|
CPPFLAGS_old=$CPPFLAGS
|
||||||
CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
|
CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
|
||||||
|
|
||||||
AC_CHECK_HEADER(cgnslib.h,cgns_ok=yes ,cgns_ok=no)
|
AC_CHECK_HEADER(cgnslib.h,cgns_ok=yes ,cgns_ok=no)
|
||||||
|
|
||||||
CPPFLAGS=$CPPFLAGS_old
|
CPPFLAGS=$CPPFLAGS_old
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$cgns_ok" = "xyes"
|
if test "x$cgns_ok" = "xyes"
|
||||||
then
|
then
|
||||||
@ -88,11 +93,11 @@ if test "x$cgns_ok" = "xyes"
|
|||||||
then
|
then
|
||||||
CGNS_LIBS="$LOCAL_LIBS"
|
CGNS_LIBS="$LOCAL_LIBS"
|
||||||
CGNS_INCLUDES="$LOCAL_INCLUDES"
|
CGNS_INCLUDES="$LOCAL_INCLUDES"
|
||||||
#CPPFLAGS="-DWITH_CGNS $CPPFLAGS"
|
CPPFLAGS="-DWITH_CGNS $CPPFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_RESULT(for CGNS: $cgns_ok)
|
AC_MSG_RESULT(for CGNS: $cgns_ok)
|
||||||
|
|
||||||
#AM_CONDITIONAL(WITH_CGNS, [test x"$cgns_ok" = xyes])
|
AM_CONDITIONAL(WITH_CGNS, [test x"$cgns_ok" = xyes])
|
||||||
|
|
||||||
])dnl
|
])dnl
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
#
|
#
|
||||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||||
|
|
||||||
|
if WITH_CGNS
|
||||||
|
DriverCGNS_SUDIR = DriverCGNS
|
||||||
|
endif
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
SMDS \
|
SMDS \
|
||||||
SMESHDS \
|
SMESHDS \
|
||||||
@ -35,7 +39,7 @@ SUBDIRS = \
|
|||||||
DriverDAT \
|
DriverDAT \
|
||||||
DriverUNV \
|
DriverUNV \
|
||||||
DriverSTL \
|
DriverSTL \
|
||||||
DriverCGNS \
|
$(DriverCGNS_SUDIR) \
|
||||||
SMESH \
|
SMESH \
|
||||||
SMESH_I \
|
SMESH_I \
|
||||||
SMESHClient \
|
SMESHClient \
|
||||||
@ -56,6 +60,6 @@ if SMESH_ENABLE_GUI
|
|||||||
StdMeshersGUI
|
StdMeshersGUI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DIST_SUBDIRS = SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL SMESH \
|
DIST_SUBDIRS = SMDS SMESHDS Controls Driver DriverMED DriverDAT DriverUNV DriverSTL DriverCGNS \
|
||||||
SMESH_I SMESHClient SMESH_SWIG MEFISTO2 StdMeshers StdMeshers_I OBJECT \
|
SMESH SMESH_I SMESHClient SMESH_SWIG MEFISTO2 StdMeshers StdMeshers_I OBJECT \
|
||||||
SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY Tools
|
SMESHFiltersSelection SMESHGUI PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI SMESH_PY Tools
|
||||||
|
@ -87,6 +87,10 @@ libSMESHimpl_la_CPPFLAGS = \
|
|||||||
-I$(srcdir)/../SMESHDS \
|
-I$(srcdir)/../SMESHDS \
|
||||||
-I$(srcdir)/../SMESHUtils
|
-I$(srcdir)/../SMESHUtils
|
||||||
|
|
||||||
|
if WITH_CGNS
|
||||||
|
DriverCGNS_LIB = ../DriverCGNS/libMeshDriverCGNS.la
|
||||||
|
endif
|
||||||
|
|
||||||
libSMESHimpl_la_LDFLAGS = \
|
libSMESHimpl_la_LDFLAGS = \
|
||||||
../SMESHDS/libSMESHDS.la \
|
../SMESHDS/libSMESHDS.la \
|
||||||
../Controls/libSMESHControls.la \
|
../Controls/libSMESHControls.la \
|
||||||
@ -94,7 +98,7 @@ libSMESHimpl_la_LDFLAGS = \
|
|||||||
../DriverSTL/libMeshDriverSTL.la \
|
../DriverSTL/libMeshDriverSTL.la \
|
||||||
../DriverMED/libMeshDriverMED.la \
|
../DriverMED/libMeshDriverMED.la \
|
||||||
../DriverUNV/libMeshDriverUNV.la \
|
../DriverUNV/libMeshDriverUNV.la \
|
||||||
../DriverCGNS/libMeshDriverCGNS.la \
|
$(DriverCGNS_LIB) \
|
||||||
../SMESHUtils/libSMESHUtils.la \
|
../SMESHUtils/libSMESHUtils.la \
|
||||||
$(GEOM_LDFLAGS) -lNMTTools \
|
$(GEOM_LDFLAGS) -lNMTTools \
|
||||||
$(CAS_LDPATH) -lTKShHealing -lTKPrim -lTKG2d
|
$(CAS_LDPATH) -lTKShHealing -lTKPrim -lTKG2d
|
||||||
|
@ -48,8 +48,10 @@
|
|||||||
#include "DriverMED_R_SMESHDS_Mesh.h"
|
#include "DriverMED_R_SMESHDS_Mesh.h"
|
||||||
#include "DriverUNV_R_SMDS_Mesh.h"
|
#include "DriverUNV_R_SMDS_Mesh.h"
|
||||||
#include "DriverSTL_R_SMDS_Mesh.h"
|
#include "DriverSTL_R_SMDS_Mesh.h"
|
||||||
|
#ifdef WITH_CGNS
|
||||||
#include "DriverCGNS_Read.hxx"
|
#include "DriverCGNS_Read.hxx"
|
||||||
#include "DriverCGNS_Write.hxx"
|
#include "DriverCGNS_Write.hxx"
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef _Precision_HeaderFile
|
#undef _Precision_HeaderFile
|
||||||
#include <BRepBndLib.hxx>
|
#include <BRepBndLib.hxx>
|
||||||
@ -455,16 +457,20 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
|
|||||||
const int theMeshIndex,
|
const int theMeshIndex,
|
||||||
std::string& theMeshName)
|
std::string& theMeshName)
|
||||||
{
|
{
|
||||||
|
int res = Driver_Mesh::DRS_FAIL;
|
||||||
|
#ifdef WITH_CGNS
|
||||||
|
|
||||||
DriverCGNS_Read myReader;
|
DriverCGNS_Read myReader;
|
||||||
myReader.SetMesh(_myMeshDS);
|
myReader.SetMesh(_myMeshDS);
|
||||||
myReader.SetFile(theFileName);
|
myReader.SetFile(theFileName);
|
||||||
myReader.SetMeshId(theMeshIndex);
|
myReader.SetMeshId(theMeshIndex);
|
||||||
int res = myReader.Perform();
|
res = myReader.Perform();
|
||||||
theMeshName = myReader.GetMeshName();
|
theMeshName = myReader.GetMeshName();
|
||||||
|
|
||||||
// create groups
|
// create groups
|
||||||
SynchronizeGroups();
|
SynchronizeGroups();
|
||||||
|
|
||||||
|
#endif
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,11 +1262,15 @@ void SMESH_Mesh::ExportSTL(const char * file,
|
|||||||
void SMESH_Mesh::ExportCGNS(const char * file,
|
void SMESH_Mesh::ExportCGNS(const char * file,
|
||||||
const SMESHDS_Mesh* meshDS)
|
const SMESHDS_Mesh* meshDS)
|
||||||
{
|
{
|
||||||
|
int res = Driver_Mesh::DRS_FAIL;
|
||||||
|
#ifdef WITH_CGNS
|
||||||
DriverCGNS_Write myWriter;
|
DriverCGNS_Write myWriter;
|
||||||
myWriter.SetFile( file );
|
myWriter.SetFile( file );
|
||||||
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||||
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
|
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
|
||||||
if ( myWriter.Perform() != Driver_Mesh::DRS_OK )
|
res = myWriter.Perform();
|
||||||
|
#endif
|
||||||
|
if ( res != Driver_Mesh::DRS_OK )
|
||||||
throw SALOME_Exception("Export failed");
|
throw SALOME_Exception("Export failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3502,14 +3502,16 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createMenu( 112, importId, -1 );
|
createMenu( 112, importId, -1 );
|
||||||
createMenu( 113, importId, -1 );
|
createMenu( 113, importId, -1 );
|
||||||
createMenu( 115, importId, -1 );
|
createMenu( 115, importId, -1 );
|
||||||
|
#ifdef WITH_CGNS
|
||||||
createMenu( 116, importId, -1 );
|
createMenu( 116, importId, -1 );
|
||||||
|
#endif
|
||||||
createMenu( 121, exportId, -1 );
|
createMenu( 121, exportId, -1 );
|
||||||
createMenu( 122, exportId, -1 );
|
createMenu( 122, exportId, -1 );
|
||||||
createMenu( 123, exportId, -1 );
|
createMenu( 123, exportId, -1 );
|
||||||
createMenu( 140, exportId, -1 ); // export to STL
|
createMenu( 140, exportId, -1 ); // export to STL
|
||||||
|
#ifdef WITH_CGNS
|
||||||
createMenu( 142, exportId, -1 ); // export to CGNS
|
createMenu( 142, exportId, -1 ); // export to CGNS
|
||||||
|
#endif
|
||||||
createMenu( separator(), fileId, 10 );
|
createMenu( separator(), fileId, 10 );
|
||||||
|
|
||||||
createMenu( 33, editId, -1 );
|
createMenu( 33, editId, -1 );
|
||||||
@ -3810,7 +3812,9 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createPopupItem( 125, OB, mesh_group, multiple_non_empty ); // EXPORT_MED
|
createPopupItem( 125, OB, mesh_group, multiple_non_empty ); // EXPORT_MED
|
||||||
createPopupItem( 126, OB, mesh_group, only_one_non_empty ); // EXPORT_UNV
|
createPopupItem( 126, OB, mesh_group, only_one_non_empty ); // EXPORT_UNV
|
||||||
createPopupItem( 141, OB, mesh_group, only_one_2D ); // EXPORT_STL
|
createPopupItem( 141, OB, mesh_group, only_one_2D ); // EXPORT_STL
|
||||||
|
#ifdef WITH_CGNS
|
||||||
createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS
|
createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS
|
||||||
|
#endif
|
||||||
createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE
|
createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE
|
||||||
popupMgr()->insert( separator(), -1, 0 );
|
popupMgr()->insert( separator(), -1, 0 );
|
||||||
|
|
||||||
|
@ -100,7 +100,9 @@
|
|||||||
|
|
||||||
#include "DriverMED_W_SMESHDS_Mesh.h"
|
#include "DriverMED_W_SMESHDS_Mesh.h"
|
||||||
#include "DriverMED_R_SMESHDS_Mesh.h"
|
#include "DriverMED_R_SMESHDS_Mesh.h"
|
||||||
|
#ifdef WITH_CGNS
|
||||||
#include "DriverCGNS_Read.hxx"
|
#include "DriverCGNS_Read.hxx"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "SALOMEDS_Tool.hxx"
|
#include "SALOMEDS_Tool.hxx"
|
||||||
#include "SALOME_NamingService.hxx"
|
#include "SALOME_NamingService.hxx"
|
||||||
@ -1036,6 +1038,9 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char* theFileName,
|
|||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
|
||||||
|
SMESH::mesh_array_var aResult = new SMESH::mesh_array();
|
||||||
|
|
||||||
|
#ifdef WITH_CGNS
|
||||||
// Retrieve nb meshes from the file
|
// Retrieve nb meshes from the file
|
||||||
DriverCGNS_Read myReader;
|
DriverCGNS_Read myReader;
|
||||||
myReader.SetFile( theFileName );
|
myReader.SetFile( theFileName );
|
||||||
@ -1043,7 +1048,6 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char* theFileName,
|
|||||||
int nbMeshes = myReader.GetNbMeshes(aStatus);
|
int nbMeshes = myReader.GetNbMeshes(aStatus);
|
||||||
theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
|
theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
|
||||||
|
|
||||||
SMESH::mesh_array_var aResult = new SMESH::mesh_array();
|
|
||||||
aResult->length( nbMeshes );
|
aResult->length( nbMeshes );
|
||||||
|
|
||||||
{ // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups()
|
{ // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups()
|
||||||
@ -1098,6 +1102,9 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char* theFileName,
|
|||||||
// Dump creation of groups
|
// Dump creation of groups
|
||||||
for ( int i = 0; i < aResult->length(); ++i )
|
for ( int i = 0; i < aResult->length(); ++i )
|
||||||
SMESH::ListOfGroups_var groups = aResult[ i ]->GetGroups();
|
SMESH::ListOfGroups_var groups = aResult[ i ]->GetGroups();
|
||||||
|
#else
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR);
|
||||||
|
#endif
|
||||||
|
|
||||||
return aResult._retn();
|
return aResult._retn();
|
||||||
}
|
}
|
||||||
|
@ -2784,6 +2784,7 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
|
|||||||
CORBA::Boolean overwrite)
|
CORBA::Boolean overwrite)
|
||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_CGNS
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
|
||||||
PrepareForWriting(file,overwrite);
|
PrepareForWriting(file,overwrite);
|
||||||
@ -2793,6 +2794,9 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
|
|||||||
|
|
||||||
TPythonDump() << _this() << ".ExportCGNS( "
|
TPythonDump() << _this() << ".ExportCGNS( "
|
||||||
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
|
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
|
||||||
|
#else
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user