From 8ad5b9bf8aa8f09fbabab594d5ee6ca258ca3ecd Mon Sep 17 00:00:00 2001 From: rnv Date: Sat, 28 Apr 2012 06:55:12 +0000 Subject: [PATCH] Win32 compilation of the GHS3DPRLPLUGIN. --- .../GHS3DPRLPlugin_GHS3DPRL.cxx | 12 +++++----- .../GHS3DPRLPlugin_GHS3DPRL.hxx | 4 +++- .../GHS3DPRLPlugin_GHS3DPRL_i.hxx | 4 +++- .../GHS3DPRLPlugin_Hypothesis.cxx | 2 +- .../GHS3DPRLPlugin_Hypothesis.hxx | 4 +++- .../GHS3DPRLPlugin_Hypothesis_i.hxx | 4 +++- src/GHS3DPRLPlugin/GHS3DPRLPlugin_i.cxx | 6 ++++- src/GHS3DPRLPlugin/Makefile.am | 7 ++++-- src/gui/GHS3DPRLPluginGUI.cxx | 2 +- .../GHS3DPRLPluginGUI_HypothesisCreator.cxx | 1 + src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h | 13 +++++++++- src/gui/Makefile.am | 4 +++- src/tepal2med/ghs3dprl_mesh_wrap.cxx | 24 +++++++++++++++++-- src/tepal2med/tepal2med.cxx | 17 +++++++++++-- 14 files changed, 83 insertions(+), 21 deletions(-) diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx index 6204021..cb93731 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -144,7 +144,7 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString & GHS3DPRL_In, ofstream theFile; theFile.open(namefile.ToCString(),ios::out); #ifdef WIN32 - Ok=theFile->is_open(); + Ok = theFile.is_open(); #else Ok=theFile.rdbuf()->is_open(); #endif @@ -186,7 +186,7 @@ static bool writeGHS3DPRLFiles (const TCollection_AsciiString & GHS3DPRL_In, removeFile(namefile); theFile.open(namefile.ToCString(),ios::out); #ifdef WIN32 - Ok=theFile->is_open(); + Ok=theFile.is_open(); #else Ok=theFile.rdbuf()->is_open(); #endif @@ -297,8 +297,8 @@ static bool readResult(FILE * theFile, int line = 1, EndOfFile = 0, nbElem = 0, nField = 10, nbRef = 0, aGHS3DPRLNodeID = 0; const char * theField; - const char * tabField [nField]; - int tabRef [nField]; + vector tabField = vector(nField); + vector tabRef = vector(nField); tabField[0] = "MeshVersionFormatted"; tabRef[0] = 0; tabField[1] = "Dimension"; tabRef[1] = 0; @@ -345,7 +345,7 @@ static bool readResult(FILE * theFile, if ( strcmp(theField, "Vertices") == 0 ) { int aGHS3DPRLID; - double coord[nbRef]; + vector coord = vector(nbRef); SMDS_MeshNode * aGHS3DPRLNode; for ( int iElem = 0; iElem < nbElem; iElem++ ) { @@ -359,7 +359,7 @@ static bool readResult(FILE * theFile, } } else { - const SMDS_MeshNode * node[nbRef]; + vector node = vector(nbRef); SMDS_MeshElement* aGHS3DPRLElement; map ::iterator itOnGHS3DPRLNode; diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx index c449310..2ed2f90 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx @@ -25,6 +25,8 @@ #ifndef _GHS3DPRLPlugin_GHS3DPRL_HXX_ #define _GHS3DPRLPlugin_GHS3DPRL_HXX_ +#include "GHS3DPRLPlugin_Defs.hxx" + #include "SMESH_3D_Algo.hxx" #include "SMESH_Mesh.hxx" #include "Utils_SALOME_Exception.hxx" @@ -32,7 +34,7 @@ class SMESH_Mesh; class GHS3DPRLPlugin_Hypothesis; -class GHS3DPRLPlugin_GHS3DPRL: public SMESH_3D_Algo +class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_GHS3DPRL: public SMESH_3D_Algo { public: GHS3DPRLPlugin_GHS3DPRL(int hypId, int studyId, SMESH_Gen* gen); diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL_i.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL_i.hxx index cab2069..3c57137 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL_i.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL_i.hxx @@ -25,6 +25,8 @@ #ifndef _GHS3DPRLPlugin_GHS3DPRL_I_HXX_ #define _GHS3DPRLPlugin_GHS3DPRL_I_HXX_ +#include "GHS3DPRLPlugin_Defs.hxx" + #include #include CORBA_SERVER_HEADER(GHS3DPRLPlugin_Algorithm) #include CORBA_SERVER_HEADER(SALOME_Exception) @@ -35,7 +37,7 @@ // ====================================================== // GHS3DPRL 3d algorithm // ====================================================== -class GHS3DPRLPlugin_GHS3DPRL_i: +class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_GHS3DPRL_i: public virtual POA_GHS3DPRLPlugin::GHS3DPRLPlugin_GHS3DPRL, public virtual SMESH_3D_Algo_i { diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx index c378fd2..04bb483 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx @@ -62,7 +62,7 @@ static std::string cutOrReplaceBlancs(std::string theIn) for (int i = 0, j = 0; i < len; i++) { - ushort ucs = (ushort)(str1[i]); + unsigned short ucs = (unsigned short)(str1[i]); if ((9 <= ucs && ucs <= 13) || ucs == 32) { if (!del) diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx index 789a4a9..8d9808a 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx @@ -25,13 +25,15 @@ #ifndef _GHS3DPRLPlugin_Hypothesis_HXX_ #define _GHS3DPRLPlugin_Hypothesis_HXX_ +#include "GHS3DPRLPlugin_Defs.hxx" + #include "SMESH_Hypothesis.hxx" #include "Utils_SALOME_Exception.hxx" // Parameters for work of GHS3DPRL // -class GHS3DPRLPlugin_Hypothesis: public SMESH_Hypothesis +class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis: public SMESH_Hypothesis { public: diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx index 7d2a44c..0c9d0fb 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx @@ -25,6 +25,8 @@ #ifndef _GHS3DPRLPlugin_Hypothesis_i_HXX_ #define _GHS3DPRLPlugin_Hypothesis_i_HXX_ +#include "GHS3DPRLPlugin_Defs.hxx" + #include #include CORBA_SERVER_HEADER(GHS3DPRLPlugin_Algorithm) @@ -35,7 +37,7 @@ class SMESH_Gen; // GHS3DPRLPlugin parameters hypothesis -class GHS3DPRLPlugin_Hypothesis_i: +class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis_i: public virtual POA_GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis, public virtual SMESH_Hypothesis_i { diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_i.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_i.cxx index abf671a..026c483 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_i.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_i.cxx @@ -22,6 +22,7 @@ // Author : Christian VAN WAMBEKE (CEA) (from Hexotic plugin Lioka RAZAFINDRAZAKA) // --- // +#include "GHS3DPRLPlugin_Defs.hxx" #include "SMESH_Hypothesis_i.hxx" #include "utilities.h" @@ -43,7 +44,10 @@ template class GHS3DPRLPlugin_Creator_i:public HypothesisCreator_i extern "C" { - GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) + + GHS3DPRLPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName); + + GHS3DPRLPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) { MESSAGE("GetHypothesisCreator " << aHypName); diff --git a/src/GHS3DPRLPlugin/Makefile.am b/src/GHS3DPRLPlugin/Makefile.am index 60b2a21..94b935c 100644 --- a/src/GHS3DPRLPlugin/Makefile.am +++ b/src/GHS3DPRLPlugin/Makefile.am @@ -56,8 +56,11 @@ libGHS3DPRLEngine_la_CPPFLAGS = \ libGHS3DPRLEngine_la_LDFLAGS = \ ../../idl/libSalomeIDLGHS3DPRLPLUGIN.la \ - $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lStdMeshersEngine \ - $(KERNEL_LDFLAGS) -lSalomeGenericObj + $(SMESH_LDFLAGS) -lSMESHimpl -lSMESHEngine -lStdMeshersEngine \ + $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSALOMELocalTrace \ + $(MED_LDFLAGS) -lSalomeIDLMED \ + $(CAS_LDFLAGS) -lTKBRep -lTKG3d -lTKTopAlgo\ + $(SMESH_LDFLAGS) -lSMDS -lSMESH -lSMESHDS -lTKG2d # Scripts to be installed. dist_salomescript_DATA= GHS3DPRLPluginDC.py diff --git a/src/gui/GHS3DPRLPluginGUI.cxx b/src/gui/GHS3DPRLPluginGUI.cxx index 589dd28..d4d8f40 100755 --- a/src/gui/GHS3DPRLPluginGUI.cxx +++ b/src/gui/GHS3DPRLPluginGUI.cxx @@ -31,7 +31,7 @@ //============================================================================= extern "C" { - SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) + GHS3DPRLPLUGINGUI_EXPORT SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) { SMESHGUI_GenericHypothesisCreator* aCreator = NULL; if( aHypType=="GHS3DPRL_Parameters" ) diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx index 2d022bc..c0f9e48 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx @@ -46,6 +46,7 @@ GHS3DPRLPluginGUI_HypothesisCreator::GHS3DPRLPluginGUI_HypothesisCreator( const : SMESHGUI_GenericHypothesisCreator( theHypType ), myIs3D( true ) { + printf("Hypo creator !!!!!!!!!!!!!!!!!!!!!!!!!! RNV"); } GHS3DPRLPluginGUI_HypothesisCreator::~GHS3DPRLPluginGUI_HypothesisCreator() diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h index f583fdd..b7717c9 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h @@ -25,6 +25,17 @@ #ifndef GHS3DPRLPLUGINGUI_HypothesisCreator_H #define GHS3DPRLPLUGINGUI_HypothesisCreator_H +#ifdef WIN32 + #if defined GHS3DPRLPluginGUI_EXPORTS + #define GHS3DPRLPLUGINGUI_EXPORT __declspec( dllexport ) + #else + #define GHS3DPRLPLUGINGUI_EXPORT __declspec( dllimport ) + #endif +#else + #define GHS3DPRLPLUGINGUI_EXPORT +#endif + + #include class QtxIntSpinBox; @@ -44,7 +55,7 @@ typedef struct /*! * \brief Class for creation of GHS3DPRL hypotheses */ -class GHS3DPRLPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator +class GHS3DPRLPLUGINGUI_EXPORT GHS3DPRLPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator { Q_OBJECT diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 662226c..386397f 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -59,9 +59,11 @@ libGHS3DPRLPluginGUI_la_CPPFLAGS = \ -I$(top_builddir)/idl libGHS3DPRLPluginGUI_la_LDFLAGS = \ + $(QT_LIBS) \ ../GHS3DPRLPlugin/libGHS3DPRLEngine.la \ ${SMESH_LDFLAGS} -lSMESH \ - $(CAS_KERNEL) + $(CAS_KERNEL) \ + $(GUI_LDFLAGS) -lsuit -lqtx -lSalomeApp # resources files nodist_salomeres_DATA = \ diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index 704f9e2..b4206df 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -33,6 +33,14 @@ #include #include #include +#ifdef WIN32 +#include +#include +#include +#define F_OK 0 +#undef max +#undef min +#endif #include #include @@ -1371,12 +1379,20 @@ bool ghs3dprl_mesh_wrap::Write_masterxmlMEDfile() //Description tag node = xmlNewChild(root_node,0, BAD_CAST "description",0); xmlNewProp(node, BAD_CAST "what", BAD_CAST "tetrahedral mesh by tepal"); +#ifdef WIN32 + SYSTEMTIME present; + GetLocalTime ( &present ); + sprintf(buff,"%04d/%02d/%02d %02dh%02dm", + present.wYear,present.wMonth,present.wDay, + present.wHour,present.wMinute); +#else time_t present; time(&present); struct tm *time_asc = localtime(&present); sprintf(buff,"%04d/%02d/%02d %02dh%02dm", time_asc->tm_year+1900,time_asc->tm_mon+1,time_asc->tm_mday, time_asc->tm_hour,time_asc->tm_min); +#endif xmlNewProp(node, BAD_CAST "when", BAD_CAST buff); xmlNewProp(node, BAD_CAST "from", BAD_CAST "tepal2med"); @@ -1489,7 +1505,12 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles_v2(bool deletekeys) cmd=pathini+casename+"_skin.med"; int ret = access(cmd.toLatin1().constData(),F_OK); //on regarde si le fichier existe if (ret >= 0) { - cmd="cp "+pathini+casename+"_skin.med "+tmp; +#ifdef WIN32 + cmd="copy "; +#else + cmd="cp "; +#endif + cmd = cmd+pathini+casename+"_skin.med "+tmp; //std::cout<<"Copy skin.med Command = "<0) std::cout<<"CreateMEDFile for initial skin <"<\n"; } @@ -2249,4 +2270,3 @@ med_int ghs3dprl_mesh_wrap::create_families(med_idt fid, int sign) return ires; } - diff --git a/src/tepal2med/tepal2med.cxx b/src/tepal2med/tepal2med.cxx index 5fdb715..4672fd8 100755 --- a/src/tepal2med/tepal2med.cxx +++ b/src/tepal2med/tepal2med.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -43,6 +44,12 @@ #include "ghs3dprl_msg_parser.h" #include "dlg_ghs3dmain.h" +#ifdef WIN32 +#include +#include +#define F_OK 0 +#endif + //#include "MEDMEM_Exception.hxx" //#include "MEDMEM_define.hxx" @@ -112,11 +119,12 @@ bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw) med_bool tran; //version qt3 - char chaine[nomfilemed.length()+1]; + char* chaine = (char*)malloc((nomfilemed.length()+1)*sizeof(char)); strncpy(chaine,nomfilemed.toLatin1().constData(),nomfilemed.length()+1); //std::cout<<"*** ReadFileMED *** "<verbose); + free(chaine); if (fid == 0) { std::cerr<<"Problem opening file "< famdelete = std::vector(nfam); { med_int ngro; char *gro; @@ -713,6 +722,7 @@ int main(int argc, char *argv[]) "\n --deletegroups=\""< 0) { @@ -725,6 +735,9 @@ int main(int argc, char *argv[]) setsid(); system("sleep 10"); //for debug } +#else + printf("background mode is not supported on win32 platform !\n"); +#endif //"tepal -f exemple1 -n 4" if (launchtepal=="yes"){ -- 2.39.2