From e95563dcbcfb3da575c10db53256d31761418564 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Emmanuel=20STR=C3=89BY?= Date: Thu, 8 Aug 2024 15:48:11 +0200 Subject: [PATCH] Patch for windows applied --- idl/CMakeLists.txt | 17 +++ idl/__init__.py | 19 +++ src/FrontTrack/FrontTrack.hxx | 12 +- src/FrontTrack/FrontTrack_Utils.cxx | 7 +- src/HOMARD/HomardDriver.cxx | 8 ++ src/HOMARD_I/CMakeLists.txt | 5 + src/HOMARD_I/HOMARD_Cas_i.cxx | 8 ++ src/HOMARD_I/HOMARD_Gen_i.cxx | 193 ++++++++++++++++++++++------ src/HOMARD_I/HOMARD_Gen_i.hxx | 1 + src/HOMARD_I/HOMARD_Iteration_i.cxx | 4 + src/HOMARD_I/try_link_kernel.cxx | 56 ++++++++ src/tests/Test/test_1.py | 5 + 12 files changed, 293 insertions(+), 42 deletions(-) create mode 100644 idl/__init__.py create mode 100644 src/HOMARD_I/try_link_kernel.cxx diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 50748900..e0836d19 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -45,3 +45,20 @@ SET(_idl_link_flags OMNIORB_ADD_MODULE(SalomeIDLHOMARD "${SalomeIDLHOMARD_IDLSOURCES}" "${_idl_include_dirs}" "${_idl_link_flags}") INSTALL(TARGETS SalomeIDLHOMARD EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +message (STATUS "OMNIORB_IDLCXXFLAGS=${OMNIORB_IDLCXXFLAGS}") +message (STATUS "OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS}") +message (STATUS "OMNIORB_IDL_COMPILER=${OMNIORB_IDL_COMPILER}") +message (STATUS "KERNEL_ROOT_DIR=${KERNEL_ROOT_DIR}") + +foreach(_idl_file ${SalomeIDLHOMARD_IDLSOURCES}) + get_filename_component(_id ${_idl_file} NAME_WE) + add_custom_target(custom_idl_${_id} ALL + COMMAND ${OMNIORB_IDL_COMPILER} -bpython -p${OMNIORB_PYTHON_BACKEND} -I${KERNEL_ROOT_DIR}/idl/salome ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file} + DEPENDS ${_idl_file} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + message(STATUS "custom_idl_${_id} => ${OMNIORB_IDL_COMPILER} -bpython -p${OMNIORB_PYTHON_BACKEND} -I${KERNEL_ROOT_DIR}/idl/salome ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_id}_idl.py DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome) +endforeach() + +install(FILES __init__.py ${CMAKE_CURRENT_BINARY_DIR}/${_id}_idl.py DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome/HOMARD) diff --git a/idl/__init__.py b/idl/__init__.py new file mode 100644 index 00000000..63611285 --- /dev/null +++ b/idl/__init__.py @@ -0,0 +1,19 @@ +# DO NOT EDIT THIS FILE! +# +# Python module HOMARD generated by omniidl + +import omniORB +omniORB.updateModule("HOMARD") + +# ** 1. Stub files contributing to this module +import HOMARD_Gen_idl +import HOMARD_Cas_idl +import HOMARD_Hypothesis_idl +import HOMARD_Iteration_idl +import HOMARD_Zone_idl +import HOMARD_Boundary_idl +import HOMARD_YACS_idl + +# ** 2. Sub-modules + +# ** 3. End diff --git a/src/FrontTrack/FrontTrack.hxx b/src/FrontTrack/FrontTrack.hxx index fb524ec5..5ab5f840 100644 --- a/src/FrontTrack/FrontTrack.hxx +++ b/src/FrontTrack/FrontTrack.hxx @@ -27,7 +27,17 @@ #include #include -class FrontTrack +#ifdef _WIN32 + #if defined(FrontTrack_EXPORTS) + #define FRONTTRACK_EXPORT __declspec(dllexport) + #else + #define FRONTTRACK_EXPORT __declspec(dllimport) + #endif +#else + #define FRONTTRACK_EXPORT +#endif + +class FRONTTRACK_EXPORT FrontTrack { public: diff --git a/src/FrontTrack/FrontTrack_Utils.cxx b/src/FrontTrack/FrontTrack_Utils.cxx index d967451b..8c196511 100644 --- a/src/FrontTrack/FrontTrack_Utils.cxx +++ b/src/FrontTrack/FrontTrack_Utils.cxx @@ -26,6 +26,11 @@ #include #include +#ifdef _WIN32 +#include +#include +#endif + #include namespace boofs = boost::filesystem; @@ -61,7 +66,7 @@ bool FT_Utils::canWrite( const std::string& path ) bool can = false; #ifdef WIN32 - HANDLE file = CreateFile( path.c_str(), // name of the write + HANDLE file = CreateFileA(path.c_str(), // name of the write GENERIC_WRITE, // open for writing 0, // do not share NULL, // default security diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index 62e1849f..5d20e614 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -50,7 +50,11 @@ HomardDriver::HomardDriver(const std::string siter, const std::string siterp1): else { executable = getenv("HOMARD_EXE") ; } MESSAGE("executable ="< _HOMARD_Exec ="<<_HOMARD_Exec) ; // _siter = siter ; @@ -1090,7 +1094,11 @@ int HomardDriver::ExecuteHomard(int option) std::string commande ; int codret ; // Copie des Fichiers HOMARD +#ifndef _WIN32 commande = "cp " + _NomFichierConf + " " + _NomFichierConfBase ; +#else + commande = "copy " + _NomFichierConf + " " + _NomFichierConfBase ; +#endif codret = system(commande.c_str()) ; // Execution de HOMARD diff --git a/src/HOMARD_I/CMakeLists.txt b/src/HOMARD_I/CMakeLists.txt index 3a5dad3f..09b0880b 100644 --- a/src/HOMARD_I/CMakeLists.txt +++ b/src/HOMARD_I/CMakeLists.txt @@ -96,3 +96,8 @@ TARGET_LINK_LIBRARIES(HOMARDEngine ${_link_LIBRARIES} ) INSTALL(TARGETS HOMARDEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${HOMARDEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) + +add_executable(try_link_kernel try_link_kernel.cxx) +#TARGET_LINK_LIBRARIES(try_link_kernel ${KERNEL_SalomeContainer} ${KERNEL_SalomeNS} ${KERNEL_Registry} ${KERNEL_SalomeHDFPersist} ${KERNEL_SalomeLifeCycleCORBA}) +TARGET_LINK_LIBRARIES(try_link_kernel ${_link_LIBRARIES} ) +INSTALL(TARGETS try_link_kernel DESTINATION bin) diff --git a/src/HOMARD_I/HOMARD_Cas_i.cxx b/src/HOMARD_I/HOMARD_Cas_i.cxx index 952820f8..bdc810b6 100644 --- a/src/HOMARD_I/HOMARD_Cas_i.cxx +++ b/src/HOMARD_I/HOMARD_Cas_i.cxx @@ -169,7 +169,11 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) MESSAGE ( "SetDirName : nom futur pour le repertoire de l iteration, nomDirIter = "<< nomDirIter); // D.3. Creation du futur repertoire local pour l'iteration de depart std::string nomDirIterTotal ; +#ifndef WIN32 nomDirIterTotal = std::string(NomDir) + "/" + std::string(nomDirIter) ; +#else + nomDirIterTotal = std::string(NomDir) + "\\" + std::string(nomDirIter) ; +#endif #ifndef WIN32 if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) #else @@ -186,7 +190,11 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) // D.4. Deplacement du contenu du repertoire std::string oldnomDirIterTotal ; oldnomDirIterTotal = std::string(oldrep) + "/" + std::string(DirNameIter) ; +#ifndef _WIN32 std::string commande = "mv " + std::string(oldnomDirIterTotal) + "/*" + " " + std::string(nomDirIterTotal) ; +#else + std::string commande = "move " + std::string(oldnomDirIterTotal) + "\\*.*" + " " + std::string(nomDirIterTotal) ; +#endif codret = system(commande.c_str()) ; if ( codret != 0 ) { diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 4eee809e..8c4dbcd3 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -175,11 +175,13 @@ void HOMARD_Gen_i::SetEtatIter(const char* nomIter, const CORBA::Long Etat) return ; }; + MESSAGE( "SetEtatIter : 1" ); myIteration->SetState(Etat); - + MESSAGE( "SetEtatIter : 2" ); SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + MESSAGE( "SetEtatIter : 3" ); SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - + MESSAGE( "SetEtatIter : 4" ); std::string icone ; if ( Etat <= 0 ) icone = "iter0.png" ; @@ -187,10 +189,12 @@ void HOMARD_Gen_i::SetEtatIter(const char* nomIter, const CORBA::Long Etat) icone = "iter_calculee.png" ; else icone = "iter_non_calculee.png" ; + + MESSAGE( "SetEtatIter : 5" ); PublishInStudyAttr(aStudyBuilder, aIterSO, NULL , NULL, icone.c_str(), NULL) ; - + MESSAGE( "SetEtatIter : 6" ); aStudyBuilder->CommitCommand(); - + MESSAGE( "SetEtatIter : 7" ); } //============================================================================= //============================================================================= @@ -452,7 +456,11 @@ CORBA::Long HOMARD_Gen_i::DeleteYACS(const char* nomYACS, CORBA::Long Option) if ( Option == 1 ) { std::string nomFichier = myYACS->GetXMLFile(); +#ifndef _WIN32 std::string commande = "rm -rf " + nomFichier ; +#else + std::string commande = "del /s /q " + nomFichier ; +#endif MESSAGE ( "commande = " << commande ); if ((system(commande.c_str())) != 0) { @@ -626,8 +634,18 @@ void HOMARD_Gen_i::InvalideIterOption(const char* nomIter, CORBA::Long Option) }; std::string nomDir = myIteration->GetDirName(); std::string nomFichier = myIteration->GetMeshFile(); +#ifndef _WIN32 std::string commande = "rm -rf " + std::string(nomDir); - if ( Option == 1 ) { commande = commande + ";rm -rf " + std::string(nomFichier) ; } +#else + std::string commande = "del /s /q " + std::string(nomDir); +#endif + if ( Option == 1 ) { +#ifndef _WIN32 + commande = commande + ";rm -rf " + std::string(nomFichier) ; +#else + commande = commande + " & del /s /q " + std::string(nomFichier) ; +#endif + } MESSAGE ( "commande = " << commande ); if ((system(commande.c_str())) != 0) { @@ -685,8 +703,13 @@ void HOMARD_Gen_i::InvalideIterInfo(const char* nomIter) return ; }; const char* nomDir = myIteration->GetDirName(); +#ifndef _WIN32 std::string commande = "rm -f " + std::string(nomDir) + "/info* " ; commande += std::string(nomDir) + "/Liste.*info" ; +#else + std::string commande = "del /s /q " + std::string(nomDir) + "\\info* "; + commande += std::string(nomDir) + "\\Liste.*info" ; +#endif /* MESSAGE ( "commande = " << commande );*/ if ((system(commande.c_str())) != 0) { @@ -727,7 +750,11 @@ void HOMARD_Gen_i::InvalideYACS(const char* YACSName) } } std::string nomFichier = myYACS->GetXMLFile(); +#ifndef _WIN32 std::string commande = "rm -rf " + std::string(nomFichier) ; +#else + std::string commande = "del /s /q " + std::string(nomFichier) ; +#endif MESSAGE ( "commande = " << commande ); if ((system(commande.c_str())) != 0) { @@ -1193,6 +1220,12 @@ HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::newYACS() // Creation des structures identifiees par leurs noms //============================================================================= //============================================================================= +void HOMARD_Gen_i::youyou0(const char* nomCas) +{ + INFOS ( "youyou0 : nomCas = " << nomCas ); +} + + HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* nomCas, const char* MeshName, const char* MeshFile) // // Creation d'un cas initial @@ -1204,7 +1237,14 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* nomCas, const char* int option = 1 ; if ( _PublisMeshIN != 0 ) option = 2 ; - HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 0, 0, option) ; + + youyou0(nomCas); + INFOS ( "CreateCase : call ptr ?"); + + HOMARD::HOMARD_Cas_ptr myCase = nullptr; + + INFOS ( "CreateCase : call CreateCase0 ?"); + myCase = CreateCase0(nomCas, MeshName, MeshFile, 0, 0, option) ; // Valeurs par defaut des filtrages myCase->SetPyram(0); @@ -1219,7 +1259,11 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, // { MESSAGE ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); +#ifndef _WIN32 std::string nomDirWork = getenv("PWD") ; +#else + std::string nomDirWork = getenv("CD") ; +#endif int codret ; // A. Decodage du point de reprise @@ -1257,10 +1301,10 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, closedir(dp); #else HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(DirNameStart, &ffd); + WIN32_FIND_DATAA ffd; + hFind = FindFirstFileA(DirNameStart, &ffd); if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { + while (FindNextFileA(hFind, &ffd) != 0) { if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories std::string file_name(ffd.cFileName); bilan = file_name.find("HOMARD.Configuration.") ; @@ -1395,7 +1439,11 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, char* nomDirIter = CreateDirNameIter(nomDirCase, 0 ); Iter->SetDirNameLoc(nomDirIter); std::string nomDirIterTotal ; +#ifndef _WIN32 nomDirIterTotal = std::string(nomDirCase) + "/" + std::string(nomDirIter) ; +#else + nomDirIterTotal = std::string(nomDirCase) + "\\" + std::string(nomDirIter) ; +#endif #ifndef WIN32 if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) #else @@ -1411,7 +1459,11 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, } // E.3. Copie du maillage HOMARD au format MED codret = CHDIR(DirNameStart) ; +#ifndef _WIN32 std::string commande = "cp " + file_maillage_homard + " " + nomDirIterTotal ; +#else + std::string commande = "copy " + file_maillage_homard + " " + nomDirIterTotal ; +#endif MESSAGE ( "commande : " << commande ) ; codret = system(commande.c_str()) ; MESSAGE ( "codret : " << codret ) ; @@ -1442,8 +1494,11 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseLastIteration(const char* MESSAGE ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); std::string DirNameStartIter = CreateCase1(DirNameStart, -1) ; - +#ifndef _WIN32 DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; +#else + DirNameStartIter = string(DirNameStart) + "\\" + DirNameStartIter ; +#endif HOMARD::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; return HOMARD::HOMARD_Cas::_duplicate(myCase); @@ -1467,8 +1522,11 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseIteration(const char* nom }; std::string DirNameStartIter = CreateCase1(DirNameStart, Number) ; - +#ifndef _WIN32 DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; +#else + DirNameStartIter = string(DirNameStart) + "\\" + DirNameStartIter ; +#endif HOMARD::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; return HOMARD::HOMARD_Cas::_duplicate(myCase); @@ -1482,7 +1540,11 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb // { MESSAGE ( "CreateCase1 : DirNameStart = " << DirNameStart << ", Number = " << Number ); +#ifndef _WIN32 std::string nomDirWork = getenv("PWD") ; +#else + std::string nomDirWork = getenv("CD") ; +#endif std::string DirNameStartIter ; int codret ; int NumeIterMax = -1 ; @@ -1507,14 +1569,13 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb std::string DirName_1(dirp->d_name); #else HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(DirNameStart, &ffd); - if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { - std::string DirName_1 = ""; - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - DirName_1 = std::string(ffd.cFileName); - } + WIN32_FIND_DATAA ffd; + hFind = FindFirstFileA(DirNameStart, &ffd); + while (INVALID_HANDLE_VALUE != hFind && FindNextFileA(hFind, &ffd) != 0) { + std::string DirName_1 = ""; + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + DirName_1 = std::string(ffd.cFileName); + } #endif if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) ) { @@ -1531,9 +1592,9 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb std::string file_name_1(dirp_1->d_name); #else HANDLE hFind1 = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd1; - hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); - while (FindNextFile(hFind1, &ffd1) != 0) + WIN32_FIND_DATAA ffd1; + hFind1 = FindFirstFileA(DirName_1.c_str(), &ffd1); + while (FindNextFileA(hFind1, &ffd1) != 0) { if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories std::string file_name_1(ffd1.cFileName); @@ -1633,8 +1694,8 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* // 1 : aucune option // x2 : publication du maillage dans SMESH { - MESSAGE ( "CreateCase0 : nomCas = " << nomCas ); - MESSAGE ( "CreateCase0 : MeshName = " << MeshName << ", MeshFile = " << MeshFile << ", MeshOption = " << MeshOption ); + INFOS ( "CreateCase0 : nomCas = " << nomCas ); + INFOS ( "CreateCase0 : MeshName = " << MeshName << ", MeshFile = " << MeshFile << ", MeshOption = " << MeshOption ); MESSAGE ( "CreateCase0 : NumeIter = " << NumeIter << ", Option = " << Option ); // // A. Controles @@ -1713,7 +1774,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* NomIteration = nom.str(); monNum += 1; } - MESSAGE ( "CreateCas0 : ==> NomIteration = " << NomIteration ); + MESSAGE ( "CreateCase0 : ==> NomIteration = " << NomIteration ); // D.2. Creation de l'iteration HOMARD::HOMARD_Iteration_var anIter = newIteration(); @@ -1721,17 +1782,22 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* anIter->SetName(NomIteration.c_str()); AssociateCaseIter (nomCas, NomIteration.c_str(), "IterationHomard"); + MESSAGE ( "CreateCase0 : existeMeshFile" ); + // D.4. Maillage correspondant if ( existeMeshFile != 0 ) { anIter->SetMeshFile(MeshFile); if ( Option % 2 == 0 ) { PublishResultInSmesh(MeshFile, 0); } } + MESSAGE ( "CreateCase0 : SetMeshName" ); anIter->SetMeshName(MeshName); + MESSAGE ( "CreateCase0 : SetNumber" ); // D.5. Numero d'iteration anIter->SetNumber(NumeIter); + MESSAGE ( "CreateCase0 : SetEtatIter" ); // D.6. Etat SetEtatIter(NomIteration.c_str(), -NumeIter); // @@ -1860,7 +1926,11 @@ HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIterat std::ostringstream iaux ; iaux << std::setw(jaux) << std::setfill('0') << nbitercase ; std::stringstream MeshFile; +#ifndef _WIN32 MeshFile << nomDirCase << "/maill." << iaux.str() << ".med"; +#else + MeshFile << nomDirCase << "\\maill." << iaux.str() << ".med"; +#endif myIteration->SetMeshFile(MeshFile.str().c_str()); // Association avec le cas @@ -2468,7 +2538,11 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena // B. Les répertoires // B.1. Le répertoire courant +#ifndef _WIN32 std::string nomDirWork = getenv("PWD") ; +#else + std::string nomDirWork = getenv("CD") ; +#endif // B.2. Le sous-répertoire de l'iteration a traiter char* DirCompute = ComputeDirManagement(myCase, myIteration, etatMenage); MESSAGE( ". DirCompute = " << DirCompute ); @@ -2476,14 +2550,22 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena // C. Le fichier des messages // C.1. Le deroulement de l'execution de HOMARD std::string LogFile = DirCompute ; +#ifndef _WIN32 LogFile += "/Liste" ; +#else + LogFile += "\\Liste" ; +#endif if ( modeHOMARD == 1 ) { LogFile += "." + siter + ".vers." + siterp1 ; } LogFile += ".log" ; MESSAGE (". LogFile = " << LogFile); if ( modeHOMARD == 1 ) { myIteration->SetLogFile(LogFile.c_str()); } // C.2. Le bilan de l'analyse du maillage std::string FileInfo = DirCompute ; +#ifndef _WIN32 FileInfo += "/" ; +#else + FileInfo += "\\" ; +#endif if ( modeHOMARD == 1 ) { FileInfo += "apad" ; } else { if ( NumeIter == 0 ) { FileInfo += "info_av" ; } @@ -2725,7 +2807,11 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOM } else { +#ifndef _WIN32 std::string commande = "rm -f " + std::string(MeshFile); +#else + std::string commande = "del /s /q " + std::string(MeshFile); +#endif codret = system(commande.c_str()); if (codret != 0) { @@ -2847,16 +2933,16 @@ CORBA::Long HOMARD_Gen_i::ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMA } #else HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(DirNameStart, &ffd); + WIN32_FIND_DATAA ffd; + hFind = FindFirstFileA(DirCompute, &ffd); if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { + while (FindNextFileA(hFind, &ffd) != 0) { std::string file_name(ffd.cFileName); bilan = file_name.find("fr") ; if ( bilan != string::npos ) { std::stringstream filename_total ; - filename_total << DirCompute << "/" << file_name ; + filename_total << DirCompute << "\\" << file_name ; theInputNodeFiles.push_back(filename_total.str()) ; icpt += 1 ; } @@ -2940,7 +3026,11 @@ CORBA::Long HOMARD_Gen_i::ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration // C. Le fichier des messages std::string LogFile = DirCompute ; +#ifndef _WIN32 LogFile += "/Liste." + siterp1 + ".maj_coords.log" ; +#else + LogFile += "\\Liste." + siterp1 + ".maj_coords.log" ; +#endif MESSAGE (". LogFile = " << LogFile); myIteration->SetFileInfo(LogFile.c_str()); @@ -3025,7 +3115,11 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) throw SALOME::SALOME_Exception(es); return 0; }; - std::string nomDirActuel = getenv("PWD") ; +#ifndef _WIN32 + std::string nomDiriActuel = getenv("PWD") ; +#else + std::string nomDirActuel = getenv("CD") ; +#endif std::string DirName ; // On boucle sur tous les noms possibles jusqu'a trouver un nom correspondant a un répertoire inconnu bool a_chercher = true ; @@ -3059,12 +3153,11 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) std::string file_name(dirp->d_name); #else HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(nomrep, &ffd); - if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories - std::string file_name(ffd.cFileName); + WIN32_FIND_DATAA ffd; + hFind = FindFirstFileA(nomrep, &ffd); + while (INVALID_HANDLE_VALUE != hFind && FindNextFileA(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); #endif if ( file_name == DirNameA.str() ) { existe = true ; } } @@ -3108,7 +3201,11 @@ char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD:: // B.3.2. Le nom complet du sous-répertoire std::stringstream DirCompute ; +#ifndef _WIN32 DirCompute << nomDirCase << "/" << nomDirIt; +#else + DirCompute << nomDirCase << "\\" << nomDirIt; +#endif MESSAGE (". DirCompute = " << DirCompute.str() ); // B.3.3. Si le sous-répertoire n'existe pas, on le cree @@ -3159,11 +3256,11 @@ char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD:: closedir(dp); #else HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(DirCompute.str().c_str(), &ffd); + WIN32_FIND_DATAA ffd; + hFind = FindFirstFileA(DirCompute.str().c_str(), &ffd); bool result = true; if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { + while (FindNextFileA(hFind, &ffd) != 0) { if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories std::string file_name(ffd.cFileName); result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false @@ -3202,7 +3299,11 @@ char* HOMARD_Gen_i::ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; const char* nomDirItPa = myIterationParent->GetDirNameLoc(); std::stringstream DirComputePa ; +#ifndef _WIN32 DirComputePa << nomDirCase << "/" << nomDirItPa; +#else + DirComputePa << nomDirCase << "\\" << nomDirItPa; +#endif MESSAGE( ". nomDirItPa = " << nomDirItPa); MESSAGE( ". DirComputePa = " << DirComputePa.str() ); @@ -3854,7 +3955,15 @@ void HOMARD_Gen_i::PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, SALOMEDS::SObject_var aResultSO, const char* name, const char* comment, const char* icone, const char* ior) { - MESSAGE("PublishInStudyAttr pour name = "<SetXMLFile( XMLFile.c_str() ) ; return HOMARD::HOMARD_YACS::_duplicate(myYACS); diff --git a/src/HOMARD_I/HOMARD_Gen_i.hxx b/src/HOMARD_I/HOMARD_Gen_i.hxx index 2cf41b11..f89e0f9d 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.hxx +++ b/src/HOMARD_I/HOMARD_Gen_i.hxx @@ -87,6 +87,7 @@ public: HOMARD::HOMARD_Cas_ptr CreateCaseFromIteration (const char* nomCas, const char* DirNameStart); HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseLastIteration (const char* nomCas, const char* DirNameStart); HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseIteration (const char* nomCas, const char* DirNameStart, CORBA::Long Number); + void youyou0(const char* nomCas); HOMARD::HOMARD_Cas_ptr CreateCase0 (const char* nomCas, const char* MeshName, const char* FileName, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option); std::string CreateCase1 (const char* DirNameStart, CORBA::Long Number); diff --git a/src/HOMARD_I/HOMARD_Iteration_i.cxx b/src/HOMARD_I/HOMARD_Iteration_i.cxx index 544e5a54..5a90708a 100644 --- a/src/HOMARD_I/HOMARD_Iteration_i.cxx +++ b/src/HOMARD_I/HOMARD_Iteration_i.cxx @@ -131,7 +131,11 @@ char* HOMARD_Iteration_i::GetDirName() std::string casename = myHomardIteration->GetCaseName() ; HOMARD::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(casename.c_str()) ; std::string dirnamecase = caseiter->GetDirName() ; +#ifndef _WIN32 std::string dirname = dirnamecase + "/" + GetDirNameLoc() ; +#else + std::string dirname = dirnamecase + "\\" + GetDirNameLoc() ; +#endif return CORBA::string_dup( dirname.c_str() ); } //============================================================================= diff --git a/src/HOMARD_I/try_link_kernel.cxx b/src/HOMARD_I/try_link_kernel.cxx new file mode 100644 index 00000000..29e03c11 --- /dev/null +++ b/src/HOMARD_I/try_link_kernel.cxx @@ -0,0 +1,56 @@ +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Cas_i.hxx" +#include "HOMARD_Hypothesis_i.hxx" +#include "HOMARD_Iteration_i.hxx" +#include "HOMARD_Boundary_i.hxx" +#include "HOMARD_Zone_i.hxx" +#include "HOMARD_YACS_i.hxx" +#include "HomardDriver.hxx" +#include "HOMARD_DriverTools.hxx" +#include "HomardMedCommun.h" +#include "YACSDriver.hxx" +#include "HOMARD.hxx" + +#include "FrontTrack.hxx" + +#include "HOMARD_version.h" + +#include "utilities.h" +#include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_CorbaException.hxx" +#include "SALOMEDS_Tool.hxx" +#include "SALOME_LifeCycleCORBA.hxx" +#include "SALOMEconfig.h" +#include + +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#endif + +int main() +{ + std::cout << "try_link_kernel cout"<