SALOME 9.1.0 Windows version

This commit is contained in:
rnv 2018-08-29 14:47:50 +03:00 committed by vsr
parent 00bd895f44
commit c5f8cda9bf
16 changed files with 94 additions and 23 deletions

View File

@ -37,12 +37,25 @@ extern "C"
} }
#include <utilities.h> #include <utilities.h>
#ifdef WIN32
#include <windows.h>
#endif
namespace MED namespace MED
{ {
bool exists(const std::string& fileName) bool exists(const std::string& fileName)
{ {
#ifdef WIN32 #ifdef WIN32
return (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES); #ifdef UNICODE
size_t length = strlen(fileName.c_str()) + sizeof(char);
wchar_t* path = new wchar_t[length];
memset(path, '\0', length);
mbstowcs(path, fileName.c_str(), length);
#else
cosnt char* path = xmlPath.c_str();
#endif
return (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES);
#else #else
return (access(fileName.c_str(), F_OK) == 0); return (access(fileName.c_str(), F_OK) == 0);
#endif #endif

View File

@ -54,7 +54,7 @@ class SMDS_EXPORT SMDS_Position
*/ */
template<class T> template<class T>
class SMDS_EXPORT SMDS_Ptr : public std::unique_ptr< T > class SMDS_Ptr : public std::unique_ptr< T >
{ {
bool myIsOwner; bool myIsOwner;

View File

@ -110,6 +110,10 @@ SET(SMESHimpl_SOURCES
# --- rules --- # --- rules ---
ADD_LIBRARY(SMESHimpl ${SMESHimpl_SOURCES}) ADD_LIBRARY(SMESHimpl ${SMESHimpl_SOURCES})
IF(WIN32)
TARGET_COMPILE_OPTIONS(SMESHimpl PRIVATE /bigobj)
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(SMESHimpl ${_link_LIBRARIES} ) TARGET_LINK_LIBRARIES(SMESHimpl ${_link_LIBRARIES} )
INSTALL(TARGETS SMESHimpl EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(TARGETS SMESHimpl EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})

View File

@ -52,6 +52,8 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include <Basics_Utils.hxx>
using namespace std; using namespace std;
//============================================================================= //=============================================================================
@ -1029,7 +1031,15 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
xmlPath += sep + plugin + ".xml"; xmlPath += sep + plugin + ".xml";
bool fileOK; bool fileOK;
#ifdef WIN32 #ifdef WIN32
fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES); #ifdef UNICODE
const wchar_t* path = Kernel_Utils::decode_s(xmlPath);
#else
const char* path = xmlPath.c_str();
#endif
fileOK = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES);
#ifdef UNICODE
delete path;
#endif
#else #else
fileOK = (access(xmlPath.c_str(), F_OK) == 0); fileOK = (access(xmlPath.c_str(), F_OK) == 0);
#endif #endif

View File

@ -48,7 +48,7 @@ class SMESH_Hypothesis;
class SMESH_Mesh; class SMESH_Mesh;
class SMESH_subMesh; class SMESH_subMesh;
class SMESH_subMeshEventListener; class SMESH_subMeshEventListener;
class SMESH_subMeshEventListenerData; struct SMESH_subMeshEventListenerData;
typedef SMESH_subMeshEventListener EventListener; typedef SMESH_subMeshEventListener EventListener;
typedef SMESH_subMeshEventListenerData EventListenerData; typedef SMESH_subMeshEventListenerData EventListenerData;

View File

@ -265,7 +265,7 @@ bool SMESHGUI_ConvToQuadOp::onApply()
prop->Delete(); prop->Delete();
SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData(); SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData();
myBadElemsPreview->SetData( & previewData.in() ); myBadElemsPreview->SetData( previewData._retn() );
myBadElemsPreview->SetVisibility(true); myBadElemsPreview->SetVisibility(true);
SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning, SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning,

View File

@ -536,7 +536,7 @@ void SMESHGUI_FindElemByPointOp::redisplayPreview()
myPreview->nodesXYZ[0].z = myDlg->myZ->GetValue(); myPreview->nodesXYZ[0].z = myDlg->myZ->GetValue();
if (!mySimulation) if (!mySimulation)
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
mySimulation->SetData(&myPreview.in()); mySimulation->SetData( myPreview._retn());
} }
//================================================================================ //================================================================================

View File

@ -521,7 +521,17 @@ namespace SMESH
try { try {
// load plugin library // load plugin library
if(MYDEBUG) MESSAGE("Loading client meshers plugin library ..."); if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
LibHandle libHandle = LoadLib( aClientLibName.toUtf8().data() ); #ifdef WIN32
#ifdef UNICODE
LPTSTR path = new TCHAR[aClientLibName.length() + 1];
path[aClientLibName.toWCharArray(path)] = '\0';
#else
const char* path = aClientLibName.toUtf8().data();
#endif
#else
char* path = aClientLibName.toUtf8().data();
#endif
LibHandle libHandle = LoadLib( path );
if (!libHandle) { if (!libHandle) {
// report any error, if occurred // report any error, if occurred
{ {

View File

@ -167,7 +167,7 @@ vtkIdType getCellType( const SMDSAbs_ElementType theType,
*/ */
//================================================================================ //================================================================================
void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct* previewData) void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct_var previewData)
{ {
// Create points // Create points
const SMESH::nodes_array& aNodesXYZ = previewData->nodesXYZ; const SMESH::nodes_array& aNodesXYZ = previewData->nodesXYZ;

View File

@ -37,10 +37,8 @@ class SVTK_ViewWindow;
class vtkTextActor; class vtkTextActor;
class vtkUnstructuredGrid; class vtkUnstructuredGrid;
namespace SMESH #include <SALOMEconfig.h>
{ #include CORBA_SERVER_HEADER(SMESH_Mesh)
class MeshPreviewStruct;
}
/*! /*!
* \brief Displayer of the mesh edition preview * \brief Displayer of the mesh edition preview
@ -59,7 +57,7 @@ public:
SMESHGUI_MeshEditPreview( SVTK_ViewWindow* ); SMESHGUI_MeshEditPreview( SVTK_ViewWindow* );
~SMESHGUI_MeshEditPreview(); ~SMESHGUI_MeshEditPreview();
void SetData( const SMESH::MeshPreviewStruct* ); void SetData( const SMESH::MeshPreviewStruct_var );
void SetVisibility( bool ); void SetVisibility( bool );
void SetColor( double, double, double ); void SetColor( double, double, double );

View File

@ -36,6 +36,8 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <Basics_Utils.hxx>
namespace boofs = boost::filesystem; namespace boofs = boost::filesystem;
//================================================================================ //================================================================================
@ -79,9 +81,17 @@ bool SMESH_File::open()
if ( !_map && length > 0 ) if ( !_map && length > 0 )
{ {
#ifdef WIN32 #ifdef WIN32
_file = CreateFile(_name.data(), GENERIC_READ, FILE_SHARE_READ, #ifdef UNICODE
const wchar_t* name = Kernel_Utils::decode(_name.data());
#else
char* name = name.data();
#endif
_file = CreateFile(name, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
bool ok = ( _file != INVALID_HANDLE_VALUE ); bool ok = ( _file != INVALID_HANDLE_VALUE );
#ifdef UNICODE
delete name;
#endif
#else #else
_file = ::open(_name.data(), O_RDONLY ); _file = ::open(_name.data(), O_RDONLY );
bool ok = ( _file >= 0 ); bool ok = ( _file >= 0 );
@ -291,14 +301,21 @@ bool SMESH_File::getInts(std::vector<int>& ints)
bool SMESH_File::openForWriting() bool SMESH_File::openForWriting()
{ {
#ifdef WIN32 #ifdef WIN32
#ifdef UNICODE
_file = CreateFile( _name.c_str(), // name of the write const wchar_t* name = Kernel_Utils::decode(_name.data());
#else
char* name = name.data();
#endif
_file = CreateFile( name, // name of the write
GENERIC_WRITE, // open for writing GENERIC_WRITE, // open for writing
0, // do not share 0, // do not share
NULL, // default security NULL, // default security
OPEN_ALWAYS, // CREATE NEW or OPEN EXISTING OPEN_ALWAYS, // CREATE NEW or OPEN EXISTING
FILE_ATTRIBUTE_NORMAL, // normal file FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template NULL); // no attr. template
#ifdef UNICODE
delete name;
#endif
return ( _file != INVALID_HANDLE_VALUE ); return ( _file != INVALID_HANDLE_VALUE );
#else #else

View File

@ -1999,7 +1999,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
args.push_back( theCommand->GetArg( i ) ); args.push_back( theCommand->GetArg( i ) );
} }
theCommand->RemoveArgs(); theCommand->RemoveArgs();
for ( uint i = 0; i < args.size(); i++ ) for ( unsigned int i = 0; i < args.size(); i++ )
theCommand->SetArg( i+1, args[i] ); theCommand->SetArg( i+1, args[i] );
if ( theCommand->GetNbArgs() == 4 ) if ( theCommand->GetNbArgs() == 4 )
{ {
@ -2056,7 +2056,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
args.splice( newPos, args, args.begin() ); args.splice( newPos, args, args.begin() );
} }
std::list< _AString >::iterator a = args.begin(); std::list< _AString >::iterator a = args.begin();
for ( uint i = 1; a != args.end(); ++i, ++a ) for ( unsigned int i = 1; a != args.end(); ++i, ++a )
theCommand->SetArg( i, *a ); theCommand->SetArg( i, *a );
} }
// remember file name // remember file name

View File

@ -439,7 +439,19 @@ GenericHypothesisCreator_i* SMESH_Gen_i::getHypothesisCreator(const char* theHyp
{ {
// load plugin library // load plugin library
if(MYDEBUG) MESSAGE("Loading server meshers plugin library ..."); if(MYDEBUG) MESSAGE("Loading server meshers plugin library ...");
LibHandle libHandle = LoadLib( aPlatformLibName.c_str() ); #ifdef WIN32
#ifdef UNICODE
const wchar_t* path = Kernel_Utils::decode_s(aPlatformLibName);
#else
const char* path = aPlatformLibName.c_str();
#endif
#else
const char* path = aPlatformLibName.c_str();
#endif
LibHandle libHandle = LoadLib( path );
#if defined(WIN32) && defined(UNICODE)
delete path;
#endif
if (!libHandle) if (!libHandle)
{ {
// report any error, if occurred // report any error, if occurred

View File

@ -96,8 +96,13 @@ SET(_swig_SCRIPTS
) )
# --- rules --- # --- rules ---
IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(libSMESH_Swig python ${SMESH_Swig_SOURCES})
ELSE()
SWIG_ADD_LIBRARY(libSMESH_Swig LANGUAGE python SOURCES ${SMESH_Swig_SOURCES})
ENDIF()
SWIG_ADD_MODULE(libSMESH_Swig python ${SMESH_Swig_SOURCES})
SWIG_LINK_LIBRARIES(libSMESH_Swig ${_link_LIBRARIES}) SWIG_LINK_LIBRARIES(libSMESH_Swig ${_link_LIBRARIES})
SWIG_CHECK_GENERATION(libSMESH_Swig) SWIG_CHECK_GENERATION(libSMESH_Swig)
IF(WIN32) IF(WIN32)

View File

@ -2050,8 +2050,9 @@ public:
SVTK_IndexedMapOfIds idMap; SVTK_IndexedMapOfIds idMap;
selector->GetCompositeIndex( actor->getIO(), idMap ); selector->GetCompositeIndex( actor->getIO(), idMap );
for ( int i = 1; i <= idMap.Extent(); i++ ) for ( int i = 1; i <= idMap.Extent(); i++ ) {
myResult.push_back( std::make_pair<int,int>( (int)idMap( i )[0], (int)idMap( i )[1]) ); myResult.push_back( std::make_pair( (int)idMap(i)[0], (int)idMap(i)[1]) );
}
} }
}; };

View File

@ -25,6 +25,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
#include <algorithm>
using namespace std; using namespace std;
using namespace MESHCUT; using namespace MESHCUT;
@ -924,7 +925,7 @@ void MESHCUT::champType(std::string type, med_entity_type MEM, med_geometry_type
if (debug) if (debug)
{ {
cout << endl << " Liste des valeurs du champ brut aux 3 premiers éléments:" << endl; cout << endl << " Liste des valeurs du champ brut aux 3 premiers éléments:" << endl;
for (imaille = 0; imaille < min(nmailles, 3); imaille++) for (imaille = 0; imaille < std::min(nmailles, 3); imaille++)
{ {
cout << " Maille " << imaille << endl; cout << " Maille " << imaille << endl;
for (igauss = 0; igauss < ngauss; igauss++) for (igauss = 0; igauss < ngauss; igauss++)