From 8c6661feb04d2aff60a196b5acbebd4a6efdc8ec Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 17 Aug 2016 09:40:25 +0200 Subject: [PATCH 01/13] fix spps copy issue --- src/spps/input_output/reportmanager.h | 4 ++-- src/spps/sppsNantes.cpp | 4 ++-- src/spps/sppsTypes.cpp | 4 ++-- src/spps/sppsTypes.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/spps/input_output/reportmanager.h b/src/spps/input_output/reportmanager.h index 80fb5159..3d37c035 100644 --- a/src/spps/input_output/reportmanager.h +++ b/src/spps/input_output/reportmanager.h @@ -84,8 +84,8 @@ class ReportManager : public BaseReportManager * @brief Structure décrivant les paramètres d'un objet de rapport */ struct t_ParamReport{ - uentier nbParticles; - uentier nbTimeStep; + size_t nbParticles; + entier nbTimeStep; uentier freqIndex; uentier freqValue; decimal timeStep; diff --git a/src/spps/sppsNantes.cpp b/src/spps/sppsNantes.cpp index 2fd12652..d32f9681 100644 --- a/src/spps/sppsNantes.cpp +++ b/src/spps/sppsNantes.cpp @@ -298,9 +298,9 @@ int MainProcess(int argc, char* argv[]) CoreString sceneMeshPath=*configManager.FastGetConfigValue(Core_Configuration::SPROP_MODEL_FILE_PATH); sceneMeshPath=workingDir+sceneMeshPath; // Chargement du Random SEED - unsigned long seedValue = *configManager.FastGetConfigValue(Core_Configuration::I_PROP_RANDOM_SEED); + entier seedValue = *configManager.FastGetConfigValue(Core_Configuration::I_PROP_RANDOM_SEED); if(seedValue!=0) { - SetRandSeed(seedValue); + SetRandSeed((uint32_t)seedValue); } //************************************************** diff --git a/src/spps/sppsTypes.cpp b/src/spps/sppsTypes.cpp index 43798e5f..d62b932b 100644 --- a/src/spps/sppsTypes.cpp +++ b/src/spps/sppsTypes.cpp @@ -8,7 +8,7 @@ #include -//base_generator_type correspond au générateur aléatoire choisi +//base_generator_type correspond au g�n�rateur al�atoire choisi typedef boost::lagged_fibonacci607 base_generator_type; base_generator_type generator; @@ -22,7 +22,7 @@ float GetRandValue() return uni(); } -void SetRandSeed(unsigned long seed) { +void SetRandSeed(uint32_t seed) { generator.seed(seed); } diff --git a/src/spps/sppsTypes.h b/src/spps/sppsTypes.h index c8513b3f..73a57f16 100644 --- a/src/spps/sppsTypes.h +++ b/src/spps/sppsTypes.h @@ -18,7 +18,7 @@ * @return Decimal de 0 à 1 */ float GetRandValue(); - void SetRandSeed(unsigned long seed); + void SetRandSeed(uint32_t seed); #else /** * Cette méthode permet le tirage aléatoire d'un nombre décimal @@ -28,7 +28,7 @@ { return ((float)rand()) / (float)RAND_MAX; } - inline void SetRandSeed(unsigned long seed) { + inline void SetRandSeed(uint32_t seed) { srand(seed); } #endif From f06ad189269bbebfbea8184388a79f6507439e4c Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 17 Aug 2016 13:48:30 +0200 Subject: [PATCH 02/13] Fix event handling in python shell --- src/isimpa/IHM/pyConsole.cpp | 13 ++----------- src/isimpa/data_manager/projet_python.cpp | 3 +-- .../python_interface/pythonshell.cpp | 11 +++++------ .../python_interface/pythonshell.hpp | 1 - src/isimpa/main/i_simpa_main.cpp | 17 ----------------- 5 files changed, 8 insertions(+), 37 deletions(-) diff --git a/src/isimpa/IHM/pyConsole.cpp b/src/isimpa/IHM/pyConsole.cpp index 715101a9..313c5abc 100644 --- a/src/isimpa/IHM/pyConsole.cpp +++ b/src/isimpa/IHM/pyConsole.cpp @@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE( PyConsole, wxTextCtrl ) END_EVENT_TABLE() PyConsole::PyConsole(wxWindow* parent) -: wxTextCtrl(parent,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_RICH | wxNO_BORDER | wxTE_MULTILINE | wxTE_PROCESS_TAB ) +: wxTextCtrl(parent,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_RICH | wxNO_BORDER | wxTE_MULTILINE | wxTE_PROCESS_TAB | wxTE_PROCESS_ENTER ) { waitingForNextPrompt=true; promptSize=0; @@ -93,17 +93,8 @@ void PyConsole::OnTextEnter(wxCommandEvent& txtEvent) command.Replace("\n","\\n"); PostPythonCodeUpdate.SetString(command); wxPostEvent(this, PostPythonCodeUpdate); + AppendText("\n"); waitingForNextPrompt=true; - /* - wxArrayString commands; - SplitString(command,"\n",commands); - for(size_t i=0;i #include "last_cpp_include.hpp" @@ -90,7 +89,7 @@ void ProjectManager::InitPythonEngine() { Py_Initialize(); - pyShell=new PythonShell(shellControl); + pyShell = new PythonShell(shellControl); pyShell->Init(); diff --git a/src/isimpa/data_manager/python_interface/pythonshell.cpp b/src/isimpa/data_manager/python_interface/pythonshell.cpp index fbd7b332..3b1a1690 100644 --- a/src/isimpa/data_manager/python_interface/pythonshell.cpp +++ b/src/isimpa/data_manager/python_interface/pythonshell.cpp @@ -60,14 +60,11 @@ PythonShell::PythonShell(PyConsole* pyCtrl) outputRedirectIn=NULL; main_module = import("__main__"); - inspect_module = import("inspect"); main_namespace = main_module.attr("__dict__"); //Enregistrement des modules PyImport_AppendInittab("uictrl", inituictrl); - //throw std::runtime_error(_("Impossible d'importer le module de psps dans l'interpreteur python.").t_str()); - - //Python va copier les objets passés en paramètre + // main_namespace["PythonStdIoRedirect"] = class_("PythonStdIoRedirect", no_init) .def("write", &PythonStdIoRedirect::Write) @@ -86,6 +83,7 @@ PythonShell::PythonShell(PyConsole* pyCtrl) outputRedirectIn=extract(sys.attr("stdin")); //Ajout du dossier de script + boost::python::import("site").attr("addsitedir")(""); boost::python::import("site").attr("addsitedir")("UserScript"); boost::python::import("site").attr("addsitedir")("SystemScript"); } @@ -249,13 +247,14 @@ void PythonShell::call_event(const int& eventid,const int& elementid) //Il faut définir si la méthode attent 1 ou 2 argument //On utilise le module inspect afin d'obtenir le nombre d'argument boost::python::object event_function=event_lst[eventid]; - boost::python::list arglist=extract_or_throw(inspect_module.attr("getargspec")(event_function).attr("args")); + boost::python::list arglist=extract_or_throw(event_function.attr("func_code"). + attr("co_argnames")); boost::python::ssize_t argCount=len(arglist); //Self ne doit pas être pris en compte dans le nombre d'argument if(extract_or_throw(arglist.attr("__contains__")("self"))) argCount--; if(argCount==2) - event_function(elementid,eventid); + event_function(elementid, eventid); else event_function(elementid); } catch( error_already_set ) { diff --git a/src/isimpa/data_manager/python_interface/pythonshell.hpp b/src/isimpa/data_manager/python_interface/pythonshell.hpp index 7a6fc23b..dd0983f2 100644 --- a/src/isimpa/data_manager/python_interface/pythonshell.hpp +++ b/src/isimpa/data_manager/python_interface/pythonshell.hpp @@ -99,7 +99,6 @@ class PythonShell protected: boost::python::object main_module; boost::python::object main_namespace; - boost::python::object inspect_module; wxString cmd; wxString oldcmd; wxString promptNewCmd; diff --git a/src/isimpa/main/i_simpa_main.cpp b/src/isimpa/main/i_simpa_main.cpp index f4ffefa4..9b8735e0 100644 --- a/src/isimpa/main/i_simpa_main.cpp +++ b/src/isimpa/main/i_simpa_main.cpp @@ -256,23 +256,6 @@ MainUiFrame::MainUiFrame(wxLocale &lang) : wxFrame(NULL, -1, _("Interface ")+APP view_line_menu->Check(ID_wireframe_none,true); view_menu->Append(ID_fold_wireframe, _("Lines"),view_line_menu); - - -/* - view_menu->AppendSeparator(); - - wxMenu* affichage_simulation_menu = new wxMenu; - - LinkMenuItemWithElement(affichage_simulation_menu->Append(ID_simulation_particle, _("Rendu des particules"),"",wxITEM_CHECK), - Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_PARTICULES, - "showparticle"); - LinkMenuItemWithElement(affichage_simulation_menu->Append(ID_simulation_recepteurss, _("Rendu des récepteurs surfaciques"),"",wxITEM_CHECK), - Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_PARTICULES, - "showrecepteurss"); - view_menu->Append(ID_fold_simulation, _("Simulation"),affichage_simulation_menu); -*/ - - view_menu->AppendSeparator(); view_menu->Append(ID_ShowHideMailler, _("Hide meshing"),"Hide meshing",wxITEM_CHECK); From 78a644ba16c9ff24dd2fcfa1252b27e7db9bfdaf Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Thu, 1 Sep 2016 15:05:37 +0200 Subject: [PATCH 03/13] fix paths --- src/isimpa/data_manager/projet.cpp | 1 + .../tree_rapport/e_report_file.cpp | 2 +- src/lib_interface/CMakeLists.txt | 12 +-- src/lib_interface/coreinitialisation.cpp | 46 +++++----- .../input_output/baseReportManager.cpp | 40 +++++---- src/lib_interface/std_tools.cpp | 13 ++- src/lib_interface/std_tools.hpp | 4 +- src/python_bindings/CMakeLists.txt | 2 +- src/spps/data_manager/core_configuration.cpp | 7 -- src/spps/input_output/reportmanager.cpp | 27 +++--- src/spps/input_output/reportmanager.h | 6 +- src/spps/sppsNantes.cpp | 10 +-- src/theorie_classique/TC_CalculationCore.cpp | 86 +++++++++---------- src/theorie_classique/main_tc.cpp | 4 +- 14 files changed, 126 insertions(+), 134 deletions(-) diff --git a/src/isimpa/data_manager/projet.cpp b/src/isimpa/data_manager/projet.cpp index e2b81241..448d313f 100644 --- a/src/isimpa/data_manager/projet.cpp +++ b/src/isimpa/data_manager/projet.cpp @@ -1365,6 +1365,7 @@ void ProjectManager::OnMenuCopy(uiTreeCtrl* fromCtrl,Element* eRoot) tmpDocXml.Save(tmpStr); wxTextDataObject* data=new wxTextDataObject; data->SetText(tmpStr.GetString()); + wxTheClipboard->Open(); wxTheClipboard->SetData(data); wxTheClipboard->Flush(); wxTheClipboard->Close(); diff --git a/src/isimpa/data_manager/tree_rapport/e_report_file.cpp b/src/isimpa/data_manager/tree_rapport/e_report_file.cpp index a7f8bd84..dece5077 100644 --- a/src/isimpa/data_manager/tree_rapport/e_report_file.cpp +++ b/src/isimpa/data_manager/tree_rapport/e_report_file.cpp @@ -294,7 +294,7 @@ void E_Report_File::RefreshFolderContents() wxArrayString dirs=childFile.GetDirs(); wxString dirName=dirs[dirs.size()-1]; //Type inconnue, création d'un élément dossier générique - E_Report_Folder* newFolder=new E_Report_Folder(this,dirName,dirName+"\\"); + E_Report_Folder* newFolder=new E_Report_Folder(this,dirName,dirName+wxFileName::GetPathSeparator()); this->AppendFils(newFolder); newFolder->RefreshFolderContents(); } else if(wxFileExists(childFile.GetFullPath())) diff --git a/src/lib_interface/CMakeLists.txt b/src/lib_interface/CMakeLists.txt index 7015b44e..597b41fa 100644 --- a/src/lib_interface/CMakeLists.txt +++ b/src/lib_interface/CMakeLists.txt @@ -99,12 +99,12 @@ source_group( "Core" FILES ${CORE_SOURCES} ) source_group( "data_manager" FILES ${DATA_MANAGER_SOURCES} ) source_group( "input_output" FILES ${IO_SOURCES} ) -source_group( "input_output\\exportRecepeteurSurf" FILES ${IO_RECSURF_SOURCES} ) -source_group( "input_output\\gabe" FILES ${IO_GABE_SOURCES} ) -source_group( "input_output\\importExportMaillage" FILES ${IO_MAILLAGE_SOURCES} ) -source_group( "input_output\\particles" FILES ${IO_PARTICLES_SOURCES} ) -source_group( "input_output\\ply" FILES ${IO_PLY_SOURCES} ) -source_group( "input_output\\directivity" FILES ${IO_DIRECTIVITY_SOURCES} ) +source_group( "input_output/exportRecepeteurSurf" FILES ${IO_RECSURF_SOURCES} ) +source_group( "input_output/gabe" FILES ${IO_GABE_SOURCES} ) +source_group( "input_output/importExportMaillage" FILES ${IO_MAILLAGE_SOURCES} ) +source_group( "input_output/particles" FILES ${IO_PARTICLES_SOURCES} ) +source_group( "input_output/ply" FILES ${IO_PLY_SOURCES} ) +source_group( "input_output/directivity" FILES ${IO_DIRECTIVITY_SOURCES} ) source_group( "tools" FILES ${TOOLS_SOURCES} ) diff --git a/src/lib_interface/coreinitialisation.cpp b/src/lib_interface/coreinitialisation.cpp index 270a1043..e26ece85 100644 --- a/src/lib_interface/coreinitialisation.cpp +++ b/src/lib_interface/coreinitialisation.cpp @@ -28,7 +28,7 @@ * or write to scientific.computing@ifsttar.fr * ----------------------------------------------------------------------*/ -// sppsNantes.cpp : définit le point d'entrée pour l'application console. +// sppsNantes.cpp�: d�finit le point d'entr�e pour l'application console. // @@ -67,8 +67,8 @@ void genprintVec(vec3 inf) /** - * Initialise la propriété de tétraèdre courant des sources - * @param tetraMesh Maillage tétraèdrique de la scène + * Initialise la propri�t� de t�tra�dre courant des sources + * @param tetraMesh Maillage t�tra�drique de la sc�ne * @param lstSources Liste des sources */ void InitSourcesTetraLocalisation(t_TetraMesh* tetraMesh,std::vector* lstSources) @@ -83,7 +83,7 @@ void InitSourcesTetraLocalisation(t_TetraMesh* tetraMesh,std::vector* for(int idFace=0;idFace<4;idFace++) { t_Tetra_Faces* currentFace=&tetraMesh->tetraedres[idtetra].faces[idFace]; - //Calcul du vecteur entre la position de la source et le premier sommet de la face du tétrahèdre + //Calcul du vecteur entre la position de la source et le premier sommet de la face du t�trah�dre vec3 pSrcA=tetraMesh->nodes[currentFace->indiceSommets.a]-(*currentSource).Position; if(pSrcA.dot(currentFace->normal)>0)//si normal de la face va vers la position de la source { @@ -99,7 +99,7 @@ void InitSourcesTetraLocalisation(t_TetraMesh* tetraMesh,std::vector* } /** - * Retourne la longueur entre la position Z du tetraèdre en paramètre et la position Z du centre de la face la plus haute + * Retourne la longueur entre la position Z du tetra�dre en param�tre et la position Z du centre de la face la plus haute */ decimal GetHeight( t_TetraMesh* tetraMesh, t_Tetra* currentTetra ) { @@ -125,7 +125,7 @@ decimal GetHeight( t_TetraMesh* tetraMesh, t_Tetra* currentTetra ) } } currentTetra=z_min_neigh; - if(currentTetra && currentTetra->z!=-1) //Si ce tétraèdre a déjà été testé + if(currentTetra && currentTetra->z!=-1) //Si ce t�tra�dre a d�j� �t� test� { z_min=currentTetra->g.z-currentTetra->z; break; @@ -137,7 +137,7 @@ void InitTetraCelerite(t_TetraMesh* tetraMesh,Base_Core_Configuration& configMan { decimal alog=*configManager.FastGetConfigValue(Base_Core_Configuration::FPROP_ALOG); decimal blin=*configManager.FastGetConfigValue(Base_Core_Configuration::FPROP_BLIN); - if(!(alog==0 && blin==0)) //si milieu non homogène + if(!(alog==0 && blin==0)) //si milieu non homog�ne { std::cout<<"Compute of z ground inside each tetra."<tetraedresSize;idtetra++) @@ -166,7 +166,7 @@ void InitEncombrementTetraLocalisation(t_TetraMesh* tetraMesh,Base_Core_Configur if(tetraMesh->tetraedres[idtetra].idVolume!=0) { tetraMesh->tetraedres[idtetra].volumeEncombrement=lastEncombrementUsedPt; - //Sur chaque face du tétrahèdre associer à l'encombrement + //Sur chaque face du t�trah�dre associer � l'encombrement for(int idface=0;idface<4;idface++) { if(tetraMesh->tetraedres[idtetra].faces[idface].face_scene) @@ -190,7 +190,7 @@ void InitRecepteurPTetraLocalisation(t_TetraMesh* tetraMesh,std::vectortetraedres[idtetra].faces[idFace]; - //Calcul du vecteur entre la position de la source et le premier sommet de la face du tétrahèdre + //Calcul du vecteur entre la position de la source et le premier sommet de la face du t�trah�dre vec3 pRcpA=tetraMesh->nodes[currentFace->indiceSommets.a]-(*currentRecepteurp).position; if(pRcpA.dot(currentFace->normal)>0)//si normal de la face va vers la position du recepteur ponctuel { @@ -241,7 +241,7 @@ void InitCutMapTetraLocalisation(t_TetraMesh* tetraMesh,std::vector* } } /** - * Réserve l'espace mémoire correspondant à une bande de fréquence. + * R�serve l'espace m�moire correspondant � une bande de fr�quence. */ void InitRecepteurSBfreq(std::vector& recepteursSurfaciques,uentier idFreq,uentier nbTimeStep) { @@ -292,7 +292,7 @@ void InitRecepteurS(t_TetraMesh* tetraModel,std::vector& recepteursSurf if(tetraModel->tetraedres[idtetra].faces[i].face_scene) { int idRs=tetraModel->tetraedres[idtetra].faces[i].face_scene->idRecepteurS; - if(idRs!=-1 && tetraModel->tetraedres[idtetra].faces[i].face_scene->normal.barelyEqual(-tetraModel->tetraedres[idtetra].faces[i].normal)) //added && tetraModel->tetraedres[idtetra].faces[i].face_scene->normal==tetraModel->tetraedres[idtetra].faces[i].normal 21 aout 2008 (pour les recepteurs de surface placé entre deux tétraèdres, associer uniquement à la face ayant la même normal que la face de tetraèdre) + if(idRs!=-1 && tetraModel->tetraedres[idtetra].faces[i].face_scene->normal.barelyEqual(-tetraModel->tetraedres[idtetra].faces[i].normal)) //added && tetraModel->tetraedres[idtetra].faces[i].face_scene->normal==tetraModel->tetraedres[idtetra].faces[i].normal 21 aout 2008 (pour les recepteurs de surface plac� entre deux t�tra�dres, associer uniquement � la face ayant la m�me normal que la face de tetra�dre) { int localIdRecept; if(last_xmlIdRecept!=idRs) @@ -305,7 +305,7 @@ void InitRecepteurS(t_TetraMesh* tetraModel,std::vector& recepteursSurf RsIndex.push_back(localIdRecept); tetraFaceRs.push_back(&tetraModel->tetraedres[idtetra].faces[i]); recepteursSurfaciques[localIdRecept]->nbFaces++; - //De l'autre coté, c'est à dire sur l'autre tétraèdre il faut lier sa face au récepteur surfacique + //De l'autre cot�, c'est � dire sur l'autre t�tra�dre il faut lier sa face au r�cepteur surfacique if(tetraModel->tetraedres[idtetra].voisins[i]) { entier_court ifacemirror=GetTetraFaceWithNormal(tetraModel->tetraedres[idtetra].voisins[i],tetraModel->tetraedres[idtetra].faces[i].normal*-1); @@ -385,13 +385,13 @@ void InitRecepteurS(t_Mesh* sceneMesh,std::vector& recepteursSurfacique } } /** - * Chargement des faces dans les structures appropriées + * Chargement des faces dans les structures appropri�es */ bool initMesh(t_Mesh &sceneMesh,CoreString workingDir,CoreString sceneMeshPath,Base_Core_Configuration& configManager, bool verbose_mode) { formatCoreBIN::ioModel modelEntree; //************************************************** - // 1: Lire le fichier de modèle en entrée + // 1: Lire le fichier de mod�le en entr�e if (verbose_mode) { cout << "Scene mesh is currently loading .." << endl; } formatCoreBIN::CformatBIN binImporter; if(!binImporter.ImportBIN(modelEntree,sceneMeshPath.c_str()) || modelEntree.vertices.size()==0) @@ -402,7 +402,7 @@ bool initMesh(t_Mesh &sceneMesh,CoreString workingDir,CoreString sceneMeshPath,B if (verbose_mode) { cout << "Opening " << sceneMeshPath << endl << "Load of the scene mesh file has been completed successfully." << endl; } } //************************************************** - // Chargement des faces dans les structures appropriées + // Chargement des faces dans les structures appropri�es sceneMesh.pvert_size=modelEntree.vertices.size(); sceneMesh.pvertices=new vec3[sceneMesh.pvert_size]; for(unsigned int i=0;i reportFreqLbl; - //Instanciation du tableau des libellé des pas de temps + //Instanciation du tableau des libell� des pas de temps std::vector reportStepLbl; BaseReportManager::InitHeaderArrays(configManager, reportFreqLbl, reportStepLbl); CoreString rootRaw=workingDir; - CoreString rootRp=rootRaw+CoreString(*configManager.FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FOLDER_PATH)+"\\"); - st_mkdir(rootRaw.c_str()); - st_mkdir(rootRp.c_str()); + CoreString rootRp=rootRaw+CoreString(*configManager.FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FOLDER_PATH)+"/"); + st_mkdir(rootRaw); + st_mkdir(rootRp); BaseReportManager::SauveRecepteursPonctuels(rootRp,*configManager.FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FILE_PATH),reportFreqLbl,reportStepLbl,&configManager.recepteur_p_List); } diff --git a/src/lib_interface/input_output/baseReportManager.cpp b/src/lib_interface/input_output/baseReportManager.cpp index 2fd1d890..66862249 100644 --- a/src/lib_interface/input_output/baseReportManager.cpp +++ b/src/lib_interface/input_output/baseReportManager.cpp @@ -31,6 +31,7 @@ #include "baseReportManager.h" #include "exportRecepteurSurf/rsbin.h" #include "gabe/gabe.h" +#include using namespace std; @@ -54,7 +55,7 @@ void ExportTouteBande(formatRSBIN::t_ExchangeData& mainData,std::vector for(int idTimeStep=0;idTimeStepfaces[idFace].nbfreq && !somethingRecordedAtThisTimeStep;idfreq++) { @@ -159,25 +160,25 @@ void BaseReportManager::SauveRecepteurPonctuel(const stringClass& recpFolder, co if(currentRecP->energy_sum[idfreq]) nbFreqUsed++; - GABE binExporter(nbFreqUsed+1); //+1 pour le libellé - binExporter.LockData(); //L'utilisateur ne pourra pas modifier les données - //Ajout du libellé + GABE binExporter(nbFreqUsed+1); //+1 pour le libell� + binExporter.LockData(); //L'utilisateur ne pourra pas modifier les donn�es + //Ajout du libell� GABE_Data_ShortString* lblCol = new GABE_Data_ShortString(nbTimeStep); for(int idstep=0;idstepSetString(idstep,timeStepLst[idstep].c_str()); lblCol->SetLabel("SPL"); binExporter.SetCol(0,lblCol); - //Pour chaque bande de frequence utilisé + //Pour chaque bande de frequence utilis� int idcol=1; for(int idfreq=0;idfreqenergy_sum[idfreq]) { ////////////////////////////////// - // Copie des données de densité d'énergie J + // Copie des donn�es de densit� d'�nergie J GABE_Data_Float* freqCol = new GABE_Data_Float(nbTimeStep); (*freqCol).SetLabel(freqLst[idfreq].c_str()); - //Copie rapide des données + //Copie rapide des donn�es //(*freqCol).FastCopy(currentRecP->energy_sum[idfreq]); for(int timeStp=0;timeStp& freqLst,const std::vector& timeStepLst,std::vector* tabRecepteurP) { - //Créé un fichier pour chaque récépteur - for(std::size_t idrp=0;idrpsize();idrp++) - { - t_Recepteur_P* currentRecP=(*tabRecepteurP)[idrp]; + //Create a new file for each receiver + for(std::size_t idrp=0;idrpsize();idrp++) { + t_Recepteur_P *currentRecP = (*tabRecepteurP)[idrp]; stringClass recpFolder; - uentier counter=0; - recpFolder=(rootFolder+currentRecP->lblRp); - while(-1==st_mkdir(recpFolder.c_str()) && counter<20) //renomme les dossiers au cas où deux recepteur ont le même nom - recpFolder=(rootFolder+currentRecP->lblRp+stringClass::FromInt(counter++)); + uentier counter = 0; + recpFolder = (rootFolder + currentRecP->lblRp); + // Rename path if receivers have the same names + while (boost::filesystem::exists(recpFolder) && counter < 20) { + recpFolder = (rootFolder + currentRecP->lblRp + stringClass::FromInt(counter++)); + } currentRecP->pathRp=recpFolder+"/"; recpFolder=recpFolder+"/"+fileName; SauveRecepteurPonctuel(recpFolder, freqLst, timeStepLst, currentRecP); @@ -247,7 +249,7 @@ void BaseReportManager::SauveRecepteursSurfaciquesCoupe(stringClass rootFolder,s } } - //Ajout d'un récepteur surfacique + //Ajout d'un r�cepteur surfacique mainData.tabRs[idRs].dataRec.xmlIndex=(**itrs).idRecepteurS; mainData.tabRs[idRs].dataRec.quantFaces=(**itrs).nbrows*(**itrs).nbcols*2; tabRecepteurS[idRs]->name.copy(mainData.tabRs[idRs].dataRec.recepteurSName,STRING_SIZE-1); @@ -259,7 +261,7 @@ void BaseReportManager::SauveRecepteursSurfaciquesCoupe(stringClass rootFolder,s { for(uentier idcol=0;idcol<(*itrs)->nbcols;idcol++) { - //Affectation des données pour la surface, divisé en 2 faces + //Affectation des donn�es pour la surface, divis� en 2 faces int idFace=(idcol+(idrow*(*itrs)->nbcols))*2; mainData.tabRs[idRs].dataFaces[idFace].dataFace.nbRecords=0; //Indices de sommets @@ -418,10 +420,10 @@ void BaseReportManager::SauveGlobalRecepteursSurfaciques(stringClass rootFolder, void BaseReportManager::InitHeaderArrays(Base_Core_Configuration& configManager, std::vector& lblFreq, std::vector& lblTime) { - //Instanciation du tableau des libellé des champs de fréquences + //Instanciation du tableau des libell� des champs de fr�quences for(std::size_t idfreq=0;idfreqfreqValue)+" Hz"); - //Instanciation du tableau des libellé des pas de temps + //Instanciation du tableau des libell� des pas de temps decimal pasdetemps=(*configManager.FastGetConfigValue(Base_Core_Configuration::FPROP_TIME_STEP)); int nbpasdetemps=(*configManager.FastGetConfigValue(Base_Core_Configuration::IPROP_QUANT_TIMESTEP)); for(entier idstep=0;idstep #include +#include + #ifdef _WIN32 #include #endif @@ -39,14 +41,9 @@ #include #endif -int st_mkdir(const char* pathname, int perm) +bool st_mkdir(const std::string& pathname) { - #ifdef _WIN32 - return mkdir(pathname); - #endif - #ifdef _UNIX - return mkdir(pathname,perm); - #endif + return boost::filesystem::create_directory(pathname); } @@ -55,6 +52,6 @@ bool st_isfinite(const float& value) #ifdef _MSC_VER return _finite(value); #else - return isfinite(value); + return std::isfinite(value); #endif } diff --git a/src/lib_interface/std_tools.hpp b/src/lib_interface/std_tools.hpp index 99268110..4b642273 100644 --- a/src/lib_interface/std_tools.hpp +++ b/src/lib_interface/std_tools.hpp @@ -36,7 +36,9 @@ #ifndef _ST_TOOLS_H_ #define _ST_TOOLS_H_ -int st_mkdir(const char* pathname, int perm = 775); +#include + +bool st_mkdir(const std::string& path); bool st_isfinite(const float& value); diff --git a/src/python_bindings/CMakeLists.txt b/src/python_bindings/CMakeLists.txt index 67084fd2..ca08087c 100644 --- a/src/python_bindings/CMakeLists.txt +++ b/src/python_bindings/CMakeLists.txt @@ -23,7 +23,7 @@ SET(CMAKE_SWIG_OUTDIR ${PROJECT_BINARY_DIR}/bin/libsimpa) SET_SOURCE_FILES_PROPERTIES(libsimpa.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(libsimpa python libsimpa.i) -SWIG_LINK_LIBRARIES(libsimpa ${PYTHON_LIBRARIES} lib_interface) +SWIG_LINK_LIBRARIES(libsimpa lib_interface ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) if(WIN32) # Check if we are on Windows if(MSVC) # Check if we are using the Visual Studio compiler diff --git a/src/spps/data_manager/core_configuration.cpp b/src/spps/data_manager/core_configuration.cpp index 2aaf2b14..bb2a140c 100644 --- a/src/spps/data_manager/core_configuration.cpp +++ b/src/spps/data_manager/core_configuration.cpp @@ -6,13 +6,6 @@ Core_Configuration::Core_Configuration( CoreString xmlFilePath, bool verbose_mod { CXml fichierXml(xmlFilePath); LoadCfgFile( fichierXml, verbose_mode ); - - #ifdef _PROFILE_ - SetConfigInformation(SPROP_CORE_WORKING_DIRECTORY,"tmp\\"); - #endif - #ifdef _DEBUG - //SetConfigInformation(SPROP_CORE_WORKING_DIRECTORY,"tmp\\"); - #endif CXmlNode* root=fichierXml.GetRoot(); if(root) { diff --git a/src/spps/input_output/reportmanager.cpp b/src/spps/input_output/reportmanager.cpp index 086f329e..d7ce54b4 100644 --- a/src/spps/input_output/reportmanager.cpp +++ b/src/spps/input_output/reportmanager.cpp @@ -65,7 +65,7 @@ ReportManager::ReportManager(t_ParamReport& _paramReport) { paramReport=_paramReport; nbSource = paramReport.configManager->srcList.size(); - timeStepInSourceOutput = *paramReport.configManager->FastGetConfigValue(Core_Configuration::I_PROP_OUTPUT_RECEIVER_BY_SOURCE); + timeStepInSourceOutput = (bool)*paramReport.configManager->FastGetConfigValue(Core_Configuration::I_PROP_OUTPUT_RECEIVER_BY_SOURCE); tabEnergyByTimeStep=new l_decimal[_paramReport.nbTimeStep]; memset(tabEnergyByTimeStep,0,sizeof(l_decimal)*_paramReport.nbTimeStep); lst_rp_lef.insert(lst_rp_lef.begin(),_paramReport.configManager->recepteur_p_List.size(),t_rp_lef()); @@ -92,14 +92,12 @@ void ReportManager::writeParticleFile() delete particleSurfaceCSVFile; if (particleReceiverCSVFile) delete particleReceiverCSVFile; - //Cr�ation du dossier de particule - //_mkdir(paramReport._particlePath.c_str()); - st_mkdir(paramReport._particlePath.c_str()); + // Create particules folder + st_mkdir(paramReport._particlePath); stringClass freqFolder; - freqFolder=paramReport._particlePath+stringClass::FromInt(paramReport.freqValue)+stringClass("\\"); - //Cr�ation du dossier de fr�quence - //_mkdir(freqFolder.c_str()); - st_mkdir(freqFolder.c_str()); + freqFolder=paramReport._particlePath+stringClass::FromInt(paramReport.freqValue)+stringClass("/"); + + st_mkdir(freqFolder); stringClass fileNamePath=freqFolder+paramReport._particleFileName; particleFile = new fstream(fileNamePath.c_str() , ios::out | ios::binary); stringClass fileCSVNamePath=freqFolder+"particle_surface_collision_statistics.csv"; @@ -637,7 +635,7 @@ void ReportManager::SaveSoundLevelBySource(const CoreString& filename,std::vecto receiverData.lblRp = currentRP->lblRp; receiverData.cdt_vol = currentRP->cdt_vol; CoreString file = rootRp + receiverData.lblRp + "/" + params.configManager->srcList[idsource]->sourceName + "/"; - st_mkdir(file.c_str()); + st_mkdir(file); file += *params.configManager->FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FILE_PATH); BaseReportManager::SauveRecepteurPonctuel(file, reportFreqLbl, reportStepLbl, &receiverData); } @@ -705,9 +703,8 @@ void ReportManager::SaveRecpIntensity(const CoreString& filename,std::vectorfreqList[idfreq]->doCalculation) { std::vector freq_gabe_cols; - CoreString freqdir=workpath+CoreString::FromInt(params.configManager->freqList[idfreq]->freqValue)+" Hz\\"; - //mkdir(freqdir.c_str()); - st_mkdir(freqdir.c_str()); + CoreString freqdir=workpath+CoreString::FromInt(params.configManager->freqList[idfreq]->freqValue)+" Hz/"; + + st_mkdir(freqdir); for(uentier idrecp=0;idrecprecepteur_p_List.size();idrecp++) { t_Recepteur_P* currentRP=params.configManager->recepteur_p_List[idrecp]; diff --git a/src/spps/input_output/reportmanager.h b/src/spps/input_output/reportmanager.h index 3d37c035..3f57574d 100644 --- a/src/spps/input_output/reportmanager.h +++ b/src/spps/input_output/reportmanager.h @@ -49,9 +49,9 @@ class t_rp_lef public: t_rp_lef(){Lf=NULL;Lfc=NULL;intensity=NULL;SrcContrib=NULL;} ~t_rp_lef(){delete[] Lf;delete[] Lfc;delete[] intensity;delete[] SrcContrib;} - void Init(const uentier& nbTimeStep,const uentier& nbsources, const bool& sourceLvlByTimeStep) + void Init(const int & nbTimeStep,const size_t & nbsources, const bool& sourceLvlByTimeStep) { - int sourceContribCols; + size_t sourceContribCols; if(sourceLvlByTimeStep) { sourceContribCols = nbsources * nbTimeStep; } else { @@ -143,7 +143,7 @@ class ReportManager : public BaseReportManager binaryFHeader enteteSortie; uentier_long nbPasDeTempsMax; uentier_long realNbParticle; - uentier nbSource; + size_t nbSource; bool timeStepInSourceOutput; entier firstTimeStep; std::vector positionsCurrentParticule; diff --git a/src/spps/sppsNantes.cpp b/src/spps/sppsNantes.cpp index d32f9681..708af8a9 100644 --- a/src/spps/sppsNantes.cpp +++ b/src/spps/sppsNantes.cpp @@ -181,10 +181,10 @@ void runFrequenceCalculation( progressOperation* parentOperation, ReportManager if((applicationTools.configurationTool->recepteur_s_List.size()>0 || applicationTools.configurationTool->recepteur_scut_List.size()>0 ) && *applicationTools.configurationTool->FastGetConfigValue(Core_Configuration::IPROP_OUTPUT_RECEPTEURS_SURF_BY_FREQ)) { //Création du dossier pour le récepteur surfacique à cette fréquence - reportParameter._recepteur_surf_Path+=stringClass::FromInt(reportParameter.freqValue)+stringClass(" Hz\\"); + reportParameter._recepteur_surf_Path+=stringClass::FromInt(reportParameter.freqValue)+stringClass(" Hz/"); reportParameter._recepteur_surf_cut_Path=reportParameter._recepteur_surf_Path; //Création du dossier de fréquence - st_mkdir(reportParameter._recepteur_surf_Path.c_str()); + st_mkdir(reportParameter._recepteur_surf_Path); //Ajout du nom du fichier à la fin reportParameter._recepteur_surf_Path+=*applicationTools.configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_PATH); reportParameter._recepteur_surf_cut_Path+=*applicationTools.configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_CUT_PATH); @@ -331,7 +331,7 @@ int MainProcess(int argc, char* argv[]) //Création du dossier contenant les recepteurs surfaciques if(configManager.recepteur_s_List.size()>0 || configManager.recepteur_scut_List.size()>0 ) - st_mkdir(reportParameter._recepteur_surf_Path.c_str()); + st_mkdir(reportParameter._recepteur_surf_Path); //************************************************** @@ -397,9 +397,9 @@ int MainProcess(int argc, char* argv[]) if (verbose_mode) { cout << "Saving sound level for each Ponctual Receiver per source..." << endl; } ReportManager::SaveSoundLevelBySource("Sound level per source.recp",threadsData,reportParameter); if (verbose_mode) { cout << "End of save sound level for each Ponctual Receiver per source." << endl; } - stringClass globalRecSurfPath=workingDir+*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH)+"Global\\"; + stringClass globalRecSurfPath=workingDir+*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH)+"Global/"; //Création du dossier Global - st_mkdir(globalRecSurfPath.c_str()); + st_mkdir(globalRecSurfPath); stringClass globalSurfCutPath=globalRecSurfPath+*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_CUT_PATH); globalRecSurfPath+=*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_PATH); if (verbose_mode) { cout << "Saving Global Surface Receiver Data..." << endl; } diff --git a/src/theorie_classique/TC_CalculationCore.cpp b/src/theorie_classique/TC_CalculationCore.cpp index ff00862e..cfe766f9 100644 --- a/src/theorie_classique/TC_CalculationCore.cpp +++ b/src/theorie_classique/TC_CalculationCore.cpp @@ -45,10 +45,10 @@ CalculationCore::~CalculationCore() bool CalculationCore::Run() { /////////////////////////////////////////// - // Calcul du volume de la scène + // Calcul du volume de la sc�ne mainData.sceneVolume=Get_Volume_Scene(); /////////////////////////////////////////// - // Calcul globaux pour chaque théories de calcul + // Calcul globaux pour chaque th�ories de calcul std::cout<<"Step 1/3 : Main calculation."<0) progressOperation stepOneOp(progressOutput.GetMainOperation()); @@ -59,7 +59,7 @@ bool CalculationCore::Run() } progressOutput.OutputCurrentProgression(); /////////////////////////////////////////// - // Calcul pour chaque récepteurs ponctuels + // Calcul pour chaque r�cepteurs ponctuels if(configurationTool->recepteur_p_List.size()>0) { std::cout<<"Step 2/3 : Punctual receivers calculation."<sceneMesh->pface_size;idface++) { //Si la surface n'est pas une surface d'un encombrement @@ -103,7 +103,7 @@ decimal CalculationCore::Get_A_Eyring ( entier idFreq ) { decimal A_Eyring=0.f; decimal A_Moyen=0.f; - //Pour chaque surface composant la scène + //Pour chaque surface composant la sc�ne double aireTot=0.; for(uentier idface=0;idfacesceneMesh->pface_size;idface++) @@ -167,7 +167,7 @@ decimal CalculationCore::Get_Champ_Direct_Lin( entier idFreq, vec3 positionRecep receiveEnergie=this->configurationTool->srcList[idsource]->bandeFreqSource[idFreq].w_j/ ( 4 * M_PI * pow((vecSrcToReceiver).length(),2)); if(angleAttenuation) { - if(vecSrcToReceiver.dot(dotNormal)<0) //si la face du recepteur est orienté dans l'autre direction on inverse la normal + if(vecSrcToReceiver.dot(dotNormal)<0) //si la face du recepteur est orient� dans l'autre direction on inverse la normal dotNormal*=-1; receiveEnergie*=cosf(dotNormal.angle(vecSrcToReceiver)); } @@ -213,11 +213,11 @@ void CalculationCore::RunStep1( MODE_CALCUL modeCalcul ) { /////////////////////////////////////////// - // Calcul pour chaque bande de fréquence + // Calcul pour chaque bande de fr�quence for(std::size_t idFreq=0;idFreqconfigurationTool->freqList.size();idFreq++) { /////////////////////////////////////////// - // Calcul de l'aire d'absorption équivalente (m²) + // Calcul de l'aire d'absorption �quivalente (m�) float AireAbsorptionEquivalente; if(modeCalcul==MODE_CALCUL_SABINE) AireAbsorptionEquivalente=Get_A_Sabine(idFreq); @@ -226,25 +226,25 @@ void CalculationCore::RunStep1( MODE_CALCUL modeCalcul ) mainData.frequencyDependentValues[idFreq].modeCalcul[modeCalcul].AireAbsorptionEquivalente=AireAbsorptionEquivalente; /////////////////////////////////////////// - // Calcul du temps de réverberation (s) + // Calcul du temps de r�verberation (s) mainData.frequencyDependentValues[idFreq].modeCalcul[modeCalcul].TR=Get_TR_(AireAbsorptionEquivalente,idFreq); /////////////////////////////////////////// - // Calcul du niveau sonore du champ reverbéré linéaire + // Calcul du niveau sonore du champ reverb�r� lin�aire mainData.frequencyDependentValues[idFreq].modeCalcul[modeCalcul].NiveauSonoreChampReverbereLineaire=Get_L_lin(AireAbsorptionEquivalente,idFreq); /////////////////////////////////////////// - // Calcul du niveau sonore du champ reverbéré + // Calcul du niveau sonore du champ reverb�r� mainData.frequencyDependentValues[idFreq].modeCalcul[modeCalcul].NiveauSonoreChampReverbere=Get_L(mainData.frequencyDependentValues[idFreq].modeCalcul[modeCalcul].NiveauSonoreChampReverbereLineaire); } } /* - * Calcul des valeurs par récepteurs ponctuels + * Calcul des valeurs par r�cepteurs ponctuels */ void CalculationCore::RunStep2( progressOperation* parentProgressOp ) { /////////////////////////////////////////// - // Initialisation des données des récepteurs ponctuels + // Initialisation des donn�es des r�cepteurs ponctuels progressOperation Step2op(parentProgressOp,recepteurPList.size()); for(std::size_t idRp=0;idRpinit(this->configurationTool->freqList.size()); currentRecepteurP->linkedRecepteurP=this->configurationTool->recepteur_p_List[idRp]; /////////////////////////////////////////// - // Calcul pour chaque bande de fréquence + // Calcul pour chaque bande de fr�quence for(int idFreq=0;idFreqnbFreq;idFreq++) { @@ -265,7 +265,7 @@ void CalculationCore::RunStep2( progressOperation* parentProgressOp ) currentRecepteurP->tabDataByFreq[idFreq].ChampDirect=Get_Recepteur_P_Direct(ChampDirectLineaire); /////////////////////////////////////////// - // Calcul pour chaque théorie + // Calcul pour chaque th�orie for(int idTheorie=0;idTheorieconfigurationTool->FastGetConfigValue(Core_Configuration::SPROP_CORE_WORKING_DIRECTORY); ///////////////////////////////////////////////////// - // Pour chaque mode de calcul, création des dossiers + // Pour chaque mode de calcul, cr�ation des dossiers for(int idTheorie=0;idTheorieconfigurationTool->FastGetConfigValue(Core_Configuration::SPROP_EYRING_RECEPTEUR_S_FILE_PATH); if(!configurationTool->CalculationForOutsideCore()) - st_mkdir(modeCalculFolder.c_str()); + st_mkdir(modeCalculFolder); modeCalculFolder+=*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH); if(!configurationTool->CalculationForOutsideCore()) - st_mkdir(modeCalculFolder.c_str()); + st_mkdir(modeCalculFolder); } ///////////////////////////////////////////////////// - // Création des dossiers pour le mode de calcul direct + // Cr�ation des dossiers pour le mode de calcul direct CoreString modeCalculFolderDirect=rootFolder; modeCalculFolderDirect+=*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_DIRECT_RECEPTEUR_S_FILE_PATH); if(!configurationTool->CalculationForOutsideCore()) - st_mkdir(modeCalculFolderDirect.c_str()); + st_mkdir(modeCalculFolderDirect); modeCalculFolderDirect+=*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH); if(!configurationTool->CalculationForOutsideCore()) - st_mkdir(modeCalculFolderDirect.c_str()); + st_mkdir(modeCalculFolderDirect); @@ -323,7 +323,7 @@ void CalculationCore::RunStep3( progressOperation* parentProgressOp ) progressOperation thisOperation(parentProgressOp,this->configurationTool->freqList.size()); /////////////////////////////////////////////////////////////////////////// - // Création de NB_THEORIES copies des récepteurs de surface + // Cr�ation de NB_THEORIES copies des r�cepteurs de surface std::vector recepteurSLin[NB_THEORIES]; std::vector recepteurSCutLin[NB_THEORIES]; @@ -336,28 +336,28 @@ void CalculationCore::RunStep3( progressOperation* parentProgressOp ) } } /////////////////////////////////////////// - // Calcul pour chaque bande de fréquence + // Compute for each frequency band for(std::size_t idFreq=0;idFreqconfigurationTool->freqList.size();idFreq++) { if(this->configurationTool->freqList[idFreq]->doCalculation) { progressOperation thisFreq(&thisOperation,NB_THEORIES); - this->confEnv.reportParameter.freqIndex=idFreq; + this->confEnv.reportParameter.freqIndex=(int)idFreq; this->confEnv.reportParameter.freqValue=this->configurationTool->freqList[idFreq]->freqValue; CoreString pathFreq; - pathFreq=stringClass::FromInt(this->confEnv.reportParameter.freqValue)+stringClass(" Hz\\"); + pathFreq=stringClass::FromInt(this->confEnv.reportParameter.freqValue)+stringClass(" Hz/"); //////////////////////// - // Création des dossier pour la fréquence en cours + // Cr�ation des dossier pour la fr�quence en cours if(!configurationTool->CalculationForOutsideCore() && this->configurationTool->FastGetConfigValue(Core_Configuration::IPROP_OUTPUT_RECEPTEURS_SURF_BY_FREQ)) { - st_mkdir((directFolder+pathFreq).c_str()); - st_mkdir((SabineFolder+pathFreq).c_str()); - st_mkdir((EyringFolder+pathFreq).c_str()); + st_mkdir((directFolder+pathFreq)); + st_mkdir((SabineFolder+pathFreq)); + st_mkdir((EyringFolder+pathFreq)); } /////////////////////////////////////////// - // paramètre gestionnaire de sortie de données + // param�tre gestionnaire de sortie de donn�es ReportManager::t_ParamReport thCfgDir=this->confEnv.reportParameter; thCfgDir._recepteur_surf_Path=directFolder+pathFreq; //thCfgDir._recepteur_surf_Path+=*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_DIRECT_RECEPTEUR_S_FILE_PATH); @@ -366,7 +366,7 @@ void CalculationCore::RunStep3( progressOperation* parentProgressOp ) SetEnergyDirectCut(idFreq, configurationTool->recepteur_scut_List ); /////////////////////////////////////////// - // Calcul pour chaque théorie + // Calcul pour chaque th�orie ReportManager::t_ParamReport thCfg=this->confEnv.reportParameter; if(!configurationTool->CalculationForOutsideCore()) { @@ -407,19 +407,19 @@ void CalculationCore::RunStep3( progressOperation* parentProgressOp ) { stringClass filePath; if((MODE_CALCUL)idTheorie==MODE_CALCUL_SABINE) - filePath=SabineFolder+"Global\\"; + filePath=SabineFolder+"Global/"; else - filePath=EyringFolder+"Global\\"; - st_mkdir(filePath.c_str()); + filePath=EyringFolder+"Global/"; + st_mkdir(filePath); ReportManager::SauveGlobalRecepteursSurfaciques(filePath+*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_PATH),recepteurSLin[idTheorie],*sceneTetraMesh,*this->configurationTool->FastGetConfigValue(Core_Configuration::FPROP_TIME_STEP),false); ReportManager::SauveRecepteursSurfaciquesCoupe(filePath+*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_CUT_PATH),configurationTool->recepteur_scut_List,*this->configurationTool->FastGetConfigValue(Core_Configuration::FPROP_TIME_STEP),false); } - st_mkdir((directFolder+"Global\\").c_str()); - ReportManager::SauveGlobalRecepteursSurfaciques(directFolder+"Global\\"+*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_PATH),configurationTool->recepteur_s_List,*sceneTetraMesh,*this->configurationTool->FastGetConfigValue(Core_Configuration::FPROP_TIME_STEP),false); - ReportManager::SauveRecepteursSurfaciquesCoupe(directFolder+"Global\\"+*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_CUT_PATH),configurationTool->recepteur_scut_List,*this->configurationTool->FastGetConfigValue(Core_Configuration::FPROP_TIME_STEP),false); + st_mkdir((directFolder+"Global/")); + ReportManager::SauveGlobalRecepteursSurfaciques(directFolder+"Global/"+*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_PATH),configurationTool->recepteur_s_List,*sceneTetraMesh,*this->configurationTool->FastGetConfigValue(Core_Configuration::FPROP_TIME_STEP),false); + ReportManager::SauveRecepteursSurfaciquesCoupe(directFolder+"Global/"+*this->configurationTool->FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_CUT_PATH),configurationTool->recepteur_scut_List,*this->configurationTool->FastGetConfigValue(Core_Configuration::FPROP_TIME_STEP),false); } /////////////////////////////////////////// - // Libération de l'espace mémoire + // Lib�ration de l'espace m�moire for(int idTheorie=0;idTheorie& rece for(std::size_t idFace=0;idFacenbFaces;idFace++) { r_Surf_Face* currentFace=&recepteurS[idRs]->faces[idFace]; - //Calcul du point G centre de gravité des sommets du triangle du récepteur surfacique + //Calcul du point G centre de gravit� des sommets du triangle du r�cepteur surfacique vec3 G=GetGTriangle(currentFace->sommets[0],currentFace->sommets[1],currentFace->sommets[2]); //Calcul de la normale de la face vec3 v_faceNormal=FaceNormal(currentFace->sommets[0],currentFace->sommets[1],currentFace->sommets[2]); - //Translation du Point G d'une distance d'EPSILON le long de la normal de la face afin de ne pas être occulté par la face elle même lors du test de collision. + //Translation du Point G d'une distance d'EPSILON le long de la normal de la face afin de ne pas �tre occult� par la face elle m�me lors du test de collision. G+=v_faceNormal*BARELY_EPSILON; currentFace->energieRecu[idFreq][0]=Get_Champ_Direct_Lin(idFreq,G,*this->configurationTool->FastGetConfigValue(Core_Configuration::IPROP_DO_SURFACE_ANGULAR_WEIGHTING),v_faceNormal); } @@ -515,7 +515,7 @@ bool CalculationCore::IsCollisionWithScene(vec3 from,vec3 to) { uentier cface=(*it); t_cFace& facetest=sceneMesh->pfaces[cface]; - if(!isTransparent(facetest)) //les encombrements sont ignorés + if(!isTransparent(facetest)) //les encombrements sont ignor�s { float t,u,v; diff --git a/src/theorie_classique/main_tc.cpp b/src/theorie_classique/main_tc.cpp index 84666008..80380f02 100644 --- a/src/theorie_classique/main_tc.cpp +++ b/src/theorie_classique/main_tc.cpp @@ -138,7 +138,7 @@ int MainProcess(int argc, char* argv[]) if(calcCore.recepteurPList.size()>0) { rpsFolder+=_("Punctual receivers\\"); - st_mkdir(rpsFolder.c_str()); + st_mkdir(rpsFolder); ReportManager::SauveTCRecepteursPonctuels(rpsFolder,reportFreqLbl,colsLbl,&calcCore.recepteurPList); } ReportManager::SauveTCGlobalsValues(fileGlobalName,reportFreqLbl,globalColsLbl,calcCore.mainData); @@ -146,7 +146,7 @@ int MainProcess(int argc, char* argv[]) //Sauvegarde des données pour les autres code de calculs CoreString exportcoredir=*configManager.FastGetConfigValue(Core_Configuration::SPROP_CORE_WORKING_DIRECTORY); exportcoredir+=*configManager.FastGetConfigValue(Core_Configuration::SPROP_OTHER_CORE_OUTPUT_PATH)+"\\"; - st_mkdir(exportcoredir.c_str()); + st_mkdir(exportcoredir); //Export du fichier des récepteurs ponctuels ReportManager::SauveFusionTCRecepteursPonctuels(exportcoredir,calcCore.recepteurPList); //Export des fichiers des récepteurs surfaciques From f123d3b29a87687b816efb3a5b7150b70dfe0360 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Tue, 6 Sep 2016 16:51:49 +0200 Subject: [PATCH 04/13] update for vc compatibility --- src/lib_interface/input_output/baseReportManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib_interface/input_output/baseReportManager.cpp b/src/lib_interface/input_output/baseReportManager.cpp index 66862249..f98b39c8 100644 --- a/src/lib_interface/input_output/baseReportManager.cpp +++ b/src/lib_interface/input_output/baseReportManager.cpp @@ -197,16 +197,16 @@ void BaseReportManager::SauveRecepteursPonctuels(stringClass rootFolder,const st //Create a new file for each receiver for(std::size_t idrp=0;idrpsize();idrp++) { t_Recepteur_P *currentRecP = (*tabRecepteurP)[idrp]; - stringClass recpFolder; + boost::filesystem::path recpFolder; uentier counter = 0; recpFolder = (rootFolder + currentRecP->lblRp); // Rename path if receivers have the same names - while (boost::filesystem::exists(recpFolder) && counter < 20) { + while (boost::filesystem::exists(recpFolder) && counter < 20) { recpFolder = (rootFolder + currentRecP->lblRp + stringClass::FromInt(counter++)); } - currentRecP->pathRp=recpFolder+"/"; - recpFolder=recpFolder+"/"+fileName; - SauveRecepteurPonctuel(recpFolder, freqLst, timeStepLst, currentRecP); + currentRecP->pathRp=recpFolder.string() + "/"; + recpFolder=recpFolder.string() + "/"+fileName; + SauveRecepteurPonctuel(recpFolder.string(), freqLst, timeStepLst, currentRecP); } } From 939f95272d9efbaaeaa4a367749a41a94d69f587 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Mon, 19 Sep 2016 13:09:27 +0200 Subject: [PATCH 05/13] Fix spps issue in folder creation --- CMakeLists.txt | 2 +- src/lib_interface/std_tools.cpp | 6 ++++++ src/lib_interface/std_tools.hpp | 1 + src/spps/sppsNantes.cpp | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f90f9e3..7f831103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0) # Maps to a solution file (isimpa.sln). The solution will # have all targets (exe, lib, dll) as projects (.vcproj) -project (isimpa VERSION 1.3.1) +project (isimpa VERSION 1.3.2) if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/bin" CACHE PATH "default install path" FORCE ) diff --git a/src/lib_interface/std_tools.cpp b/src/lib_interface/std_tools.cpp index 6e1b6996..25ff5449 100644 --- a/src/lib_interface/std_tools.cpp +++ b/src/lib_interface/std_tools.cpp @@ -46,6 +46,12 @@ bool st_mkdir(const std::string& pathname) return boost::filesystem::create_directory(pathname); } +std::string st_path_separator() { + boost::filesystem::path path(""); + path += boost::filesystem::path::preferred_separator; + return path.string(); +} + bool st_isfinite(const float& value) { diff --git a/src/lib_interface/std_tools.hpp b/src/lib_interface/std_tools.hpp index 4b642273..99d873b1 100644 --- a/src/lib_interface/std_tools.hpp +++ b/src/lib_interface/std_tools.hpp @@ -41,5 +41,6 @@ bool st_mkdir(const std::string& path); bool st_isfinite(const float& value); +std::string st_path_separator(); #endif diff --git a/src/spps/sppsNantes.cpp b/src/spps/sppsNantes.cpp index 708af8a9..33543d36 100644 --- a/src/spps/sppsNantes.cpp +++ b/src/spps/sppsNantes.cpp @@ -397,7 +397,8 @@ int MainProcess(int argc, char* argv[]) if (verbose_mode) { cout << "Saving sound level for each Ponctual Receiver per source..." << endl; } ReportManager::SaveSoundLevelBySource("Sound level per source.recp",threadsData,reportParameter); if (verbose_mode) { cout << "End of save sound level for each Ponctual Receiver per source." << endl; } - stringClass globalRecSurfPath=workingDir+*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH)+"Global/"; + st_mkdir(workingDir + *configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH)); + stringClass globalRecSurfPath=workingDir+*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FOLDER_PATH)+"Global"+ st_path_separator(); //Création du dossier Global st_mkdir(globalRecSurfPath); stringClass globalSurfCutPath=globalRecSurfPath+*configManager.FastGetConfigValue(Core_Configuration::SPROP_RECEPTEUR_SURFACIQUE_FILE_CUT_PATH); From eea29f100533b834b569c641174dcba30788e9ef Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Tue, 20 Sep 2016 09:06:44 +0200 Subject: [PATCH 06/13] Process tree event on another thread --- src/isimpa/IHM/uiTreeCtrl.cpp | 15 +++++++++++++-- src/isimpa/IHM/uiTreeCtrl.h | 5 ++++- src/isimpa/data_manager/projet.cpp | 13 ++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/isimpa/IHM/uiTreeCtrl.cpp b/src/isimpa/IHM/uiTreeCtrl.cpp index 0b18654e..279119dc 100644 --- a/src/isimpa/IHM/uiTreeCtrl.cpp +++ b/src/isimpa/IHM/uiTreeCtrl.cpp @@ -34,6 +34,8 @@ #include "data_manager/appconfig.h" #include "last_cpp_include.hpp" +wxDEFINE_EVENT(MENU_ITEM_SELECTED, wxCommandEvent); + BEGIN_EVENT_TABLE(uiTreeCtrl, wxTreeCtrl) EVT_TREE_BEGIN_DRAG(-1, uiTreeCtrl::BeginDrag) EVT_TREE_END_DRAG(-1, uiTreeCtrl::EndDrag) @@ -46,6 +48,7 @@ BEGIN_EVENT_TABLE(uiTreeCtrl, wxTreeCtrl) EVT_TREE_ITEM_EXPANDING(-1, uiTreeCtrl::OnExpanding) EVT_TREE_ITEM_COLLAPSED(-1, uiTreeCtrl::OnCollapsing) EVT_MENU(-1, uiTreeCtrl::OnElementEvent) + EVT_COMMAND(wxID_ANY, MENU_ITEM_SELECTED, uiTreeCtrl::OnMenuItemClosed) EVT_TIMER(100, uiTreeCtrl::OnTimer) EVT_MOTION(uiTreeCtrl::OnMouseMove) EVT_KEY_UP(uiTreeCtrl::OnKeyUp) @@ -399,6 +402,12 @@ uiTreeCtrl::uiTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, cons { InitTree(); } + +void uiTreeCtrl::OnMenuItemClosed(wxCommandEvent& commandEvent) { + if (this->pointeurElementEvent) + this->pointeurElementEvent(commandEvent); +} + uiTreeCtrl::uiTreeCtrl() :wxTreeCtrl(),alive(new bool(true)) { @@ -494,8 +503,10 @@ void uiTreeCtrl::OnCollapsing(wxTreeEvent& treeEvent) void uiTreeCtrl::OnElementEvent(wxCommandEvent& eventElement) { - if(this->pointeurElementEvent) - this->pointeurElementEvent(eventElement); + wxThreadEvent evt; + evt.SetId(eventElement.GetId()); + evt.SetEventType(MENU_ITEM_SELECTED); + QueueEvent(evt.Clone()); } void uiTreeCtrl::BindElementEvent(void (*fevent)(wxCommandEvent&)) diff --git a/src/isimpa/IHM/uiTreeCtrl.h b/src/isimpa/IHM/uiTreeCtrl.h index 0e380987..4d275719 100644 --- a/src/isimpa/IHM/uiTreeCtrl.h +++ b/src/isimpa/IHM/uiTreeCtrl.h @@ -29,7 +29,6 @@ * ----------------------------------------------------------------------*/ #include "first_header_include.hpp" - #include #include #include @@ -53,6 +52,8 @@ * * Surcharge de wxTreeCtrl afin d'intéragir avec les instances de la classe Element */ +wxDECLARE_EVENT(MENU_ITEM_SELECTED, wxCommandEvent); + class uiTreeCtrl : public wxTreeCtrl { private : @@ -73,6 +74,7 @@ class uiTreeCtrl : public wxTreeCtrl void InitTree(); smart_ptr alive; protected : + DECLARE_EVENT_TABLE() Element* rootItem; @@ -87,6 +89,7 @@ class uiTreeCtrl : public wxTreeCtrl void OnExpanding(wxTreeEvent& treeEvent); void OnCollapsing(wxTreeEvent& treeEvent); void OnKeyUp(wxKeyEvent&); + void OnMenuItemClosed(wxCommandEvent& commandEvent); public : /** * Constructeur de la fenêtre diff --git a/src/isimpa/data_manager/projet.cpp b/src/isimpa/data_manager/projet.cpp index 925e509b..7eb71b0a 100644 --- a/src/isimpa/data_manager/projet.cpp +++ b/src/isimpa/data_manager/projet.cpp @@ -839,8 +839,19 @@ void ProjectManager::RunCoreCalculation(Element* coreCalculation) /////////////////////////////////////////// wxLogInfo(_("Refreshing onglet 'Report'")); + bool resetHistoryBackup = false; + // Refresh of report folder is not a user action and should not trigger tree backup + if(rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->GetBoolConfig("keep_modification_history")) { + rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->UpdateBoolConfig("keep_modification_history", false); + resetHistoryBackup = true; + } + RefreshReportFolder(); + if(resetHistoryBackup) { + rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->UpdateBoolConfig("keep_modification_history", true); + } + wxLongLong durationOperation=wxDateTime::UNow().GetValue()-timeDebOperation.GetValue(); wxLogInfo(_("Total time calculation: %i ms"),durationOperation.GetValue()); @@ -1934,7 +1945,7 @@ void ProjectManager::Init( ) { if(this->rootCore==NULL || this->rootScene==NULL || this->rootResult==NULL) return; - + treeCore->Init(this->rootCore); treeScene->Init(this->rootScene); treeResult->Init(this->rootResult); From f6f1bff64c9b5d95d14f5e13c7b33ed8f4615e5b Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 21 Sep 2016 09:17:15 +0200 Subject: [PATCH 07/13] Use dynamic link instead of static linking --- CMakeLists.txt | 7 +++++++ src/isimpa/CMakeLists.txt | 11 ++++++++--- src/lib_interface/CMakeLists.txt | 12 ++++++++++-- src/python_bindings/CMakeLists.txt | 9 ++++++--- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f90f9e3..23bf9dbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0) # have all targets (exe, lib, dll) as projects (.vcproj) project (isimpa VERSION 1.3.1) + +macro(COPY_LIB LIBPATH DESTINATION) + get_filename_component(UT_SHARED_FILE ${LIBPATH} NAME) + configure_file(${LIBPATH} + ${DESTINATION}/${UT_SHARED_FILE} COPYONLY) +endmacro(COPY_LIB) + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/bin" CACHE PATH "default install path" FORCE ) message (STATUS "Default install path is set: " ${CMAKE_INSTALL_PREFIX}) diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index 80ba4443..78d91751 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -403,8 +403,8 @@ add_executable(isimpa # project (isimpa.vcproj) under it set_property(TARGET isimpa PROPERTY FOLDER "executables") -set(Boost_USE_STATIC_LIBS ON) -find_package(Boost REQUIRED COMPONENTS system python) +set(Boost_USE_STATIC_LIBS OFF) +find_package(Boost REQUIRED COMPONENTS system python filesystem) IF(CMAKE_BUILD_TYPE STREQUAL "Debug") SET(wxWidgets_USE_DEBUG ON) @@ -459,12 +459,17 @@ install (TARGETS isimpa set(ISIMPA_RESSOURCES ${PROJECT_SOURCE_DIR}/currentRelease) + +GET_FILENAME_COMPONENT(FILESYS ${Boost_FILESYSTEM_LIBRARY_RELEASE}) install (FILES ${ISIMPA_RESSOURCES}/appconst.xml ${ISIMPA_RESSOURCES}/isimpa.ico ${ISIMPA_RESSOURCES}/Licence.pdf ${ISIMPA_RESSOURCES}/Licence.rtf - DESTINATION .) +${Boost_FILESYSTEM_LIBRARY_RELEASE} +${Boost_SYSTEM_LIBRARY_RELEASE} +${Boost_PYTHON_LIBRARY_RELEASE} + DESTINATION .) install(DIRECTORY ${ISIMPA_RESSOURCES}/Bitmaps diff --git a/src/lib_interface/CMakeLists.txt b/src/lib_interface/CMakeLists.txt index 597b41fa..970bf6c4 100644 --- a/src/lib_interface/CMakeLists.txt +++ b/src/lib_interface/CMakeLists.txt @@ -112,8 +112,8 @@ source_group( "tools" FILES ${TOOLS_SOURCES} ) # DEPENDENCY & EXECUTABLE (OR LIB) #---------------------------------------# -set(Boost_USE_STATIC_LIBS ON) -find_package(Boost COMPONENTS system filesystem unit_test_framework regex REQUIRED) +set(Boost_USE_STATIC_LIBS OFF) +find_package(Boost COMPONENTS system filesystem regex REQUIRED) link_directories( ${Boost_LIBRARY_DIRS} ) include_directories( ${Boost_INCLUDE_DIRS} ) @@ -159,6 +159,14 @@ target_link_libraries (TEST_lib_interface set_property(TARGET TEST_lib_interface PROPERTY FOLDER "tests") +# Fetch unit test dependencies + +find_package(Boost COMPONENTS unit_test_framework timer chrono REQUIRED) + +COPY_LIB(${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE} ${CMAKE_CURRENT_BINARY_DIR}) +COPY_LIB(${Boost_TIMER_LIBRARY_RELEASE} ${CMAKE_CURRENT_BINARY_DIR}) +COPY_LIB(${Boost_CHRONO_LIBRARY_RELEASE} ${CMAKE_CURRENT_BINARY_DIR}) + # Add to test suite enable_testing() add_test( NAME lib_interface diff --git a/src/python_bindings/CMakeLists.txt b/src/python_bindings/CMakeLists.txt index 5bd0c8e8..e1f95365 100644 --- a/src/python_bindings/CMakeLists.txt +++ b/src/python_bindings/CMakeLists.txt @@ -22,7 +22,7 @@ SET(CMAKE_SWIG_FLAGS "") SET_SOURCE_FILES_PROPERTIES(libsimpa.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(libsimpa python libsimpa.i) -SWIG_LINK_LIBRARIES(libsimpa lib_interface ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) +SWIG_LINK_LIBRARIES(libsimpa lib_interface ${PYTHON_LIBRARIES}) # Creates a folder "libraries" and adds target project (lib_interface.vcproj) under it set_property(TARGET ${SWIG_MODULE_libsimpa_REAL_NAME} PROPERTY FOLDER "libraries") @@ -59,11 +59,14 @@ install (FILES enable_testing() # If you add tests, do not forget to add the name to set_property(TEST .. + +MESSAGE(STATUS "Run test in ${CMAKE_CURRENT_BINARY_DIR}") + add_test(NAME test_modelio COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/model_io.py ${PROJECT_BINARY_DIR}/Testing/Temporary/ - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bin/libsimpa) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_property(TEST test_modelio - PROPERTY ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/bin/libsimpa" + PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" ) \ No newline at end of file From 29e7ebf038f798a5fee50da34aabbf8763b94ce0 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 21 Sep 2016 10:54:36 +0200 Subject: [PATCH 08/13] fix cmake instr --- src/isimpa/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index 78d91751..60c16f75 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -459,8 +459,6 @@ install (TARGETS isimpa set(ISIMPA_RESSOURCES ${PROJECT_SOURCE_DIR}/currentRelease) - -GET_FILENAME_COMPONENT(FILESYS ${Boost_FILESYSTEM_LIBRARY_RELEASE}) install (FILES ${ISIMPA_RESSOURCES}/appconst.xml ${ISIMPA_RESSOURCES}/isimpa.ico From 611a804a2a8b35bbe07f7a3103d24b321b6212bd Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 21 Sep 2016 11:25:13 +0200 Subject: [PATCH 09/13] add boost dll only on windows --- src/isimpa/CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index 60c16f75..dbe7dd0a 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -459,14 +459,20 @@ install (TARGETS isimpa set(ISIMPA_RESSOURCES ${PROJECT_SOURCE_DIR}/currentRelease) +# Resolve symbolic link +#GET_FILENAME_COMPONENT(Boost_FILESYSTEM_LIBRARY_RELEASE_REAL ${Boost_FILESYSTEM_LIBRARY_RELEASE} REALPATH) +#GET_FILENAME_COMPONENT(Boost_SYSTEM_LIBRARY_RELEASE_REAL ${Boost_SYSTEM_LIBRARY_RELEASE} REALPATH) +#GET_FILENAME_COMPONENT(Boost_PYTHON_LIBRARY_RELEASE_REAL ${Boost_PYTHON_LIBRARY_RELEASE} REALPATH) + + install (FILES ${ISIMPA_RESSOURCES}/appconst.xml ${ISIMPA_RESSOURCES}/isimpa.ico ${ISIMPA_RESSOURCES}/Licence.pdf ${ISIMPA_RESSOURCES}/Licence.rtf -${Boost_FILESYSTEM_LIBRARY_RELEASE} -${Boost_SYSTEM_LIBRARY_RELEASE} -${Boost_PYTHON_LIBRARY_RELEASE} +#${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} +#${Boost_SYSTEM_LIBRARY_RELEASE_REAL} +#${Boost_PYTHON_LIBRARY_RELEASE_REAL} DESTINATION .) install(DIRECTORY @@ -496,7 +502,10 @@ if(WIN32) # Check if we are on Windows DESTINATION .) install (FILES - ${PYTHON_DLL} + ${PYTHON_DLL} + ${Boost_FILESYSTEM_LIBRARY_RELEASE} + ${Boost_SYSTEM_LIBRARY_RELEASE} + ${Boost_PYTHON_LIBRARY_RELEASE} DESTINATION .) endif() From b367cc31820273e0bfc4b3ef737d035da29356fd Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 21 Sep 2016 11:39:21 +0200 Subject: [PATCH 10/13] allow rpm and deb packaging --- src/isimpa/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index dbe7dd0a..1ce46e2e 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -542,4 +542,6 @@ ELSE(WIN32 AND NOT UNIX) SET(CPACK_SOURCE_STRIP_FILES "") ENDIF(WIN32 AND NOT UNIX) SET(CPACK_PACKAGE_EXECUTABLES "isimpa" "I-SIMPA") +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nicolas Fortin") + INCLUDE(CPack) \ No newline at end of file From 1523ae2375a7d7c854b7842ee36659bc7de70a42 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Thu, 22 Sep 2016 09:53:24 +0200 Subject: [PATCH 11/13] Fix dll for windows --- src/isimpa/CMakeLists.txt | 36 ++++++++++++++++++++---------- src/lib_interface/CMakeLists.txt | 2 +- src/preprocess/CMakeLists.txt | 3 +++ src/python_bindings/CMakeLists.txt | 5 +++++ 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index 1ce46e2e..7650d3a0 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -1,5 +1,17 @@ include_directories (./ "${PROJECT_SOURCE_DIR}/src/lib_interface") + +# convert path of a .lib file into a .dll file +# findboost does not store .dll locations +macro(LIB_TO_DLL LIBPATH DLL_PATH) + get_filename_component(DLL_FILENAME ${LIBPATH} NAME_WE) + get_filename_component(DLL_DIR ${LIBPATH} DIRECTORY) + set(${DLL_PATH} "${DLL_DIR}/${DLL_FILENAME}.dll") + if(NOT EXISTS "${DLL_DIR}/${DLL_FILENAME}.dll") + MESSAGE(ERROR " Dll file does not exists ${DLL_DIR}/${DLL_FILENAME}.dll") + endif() +endmacro(LIB_TO_DLL) + #--------------# # SOURCES #--------------# @@ -373,6 +385,10 @@ set_property(SOURCE data_manager/python_interface/py_ui_module/element_pywrap.cp configure_file(data_manager/appconfig_version.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/generated/appconfig_version.cpp ) +set(Boost_USE_STATIC_LIBS OFF) +find_package(Boost REQUIRED COMPONENTS system python filesystem regex) +link_directories( ${Boost_LIBRARY_DIRS} ) + # Set Properties->General->Configuration Type to Application # Creates isimpa with the listed sources # Adds sources to the Solution Explorer @@ -403,9 +419,6 @@ add_executable(isimpa # project (isimpa.vcproj) under it set_property(TARGET isimpa PROPERTY FOLDER "executables") -set(Boost_USE_STATIC_LIBS OFF) -find_package(Boost REQUIRED COMPONENTS system python filesystem) - IF(CMAKE_BUILD_TYPE STREQUAL "Debug") SET(wxWidgets_USE_DEBUG ON) SET(wxWidgets_USE_STATIC ON) @@ -459,12 +472,6 @@ install (TARGETS isimpa set(ISIMPA_RESSOURCES ${PROJECT_SOURCE_DIR}/currentRelease) -# Resolve symbolic link -#GET_FILENAME_COMPONENT(Boost_FILESYSTEM_LIBRARY_RELEASE_REAL ${Boost_FILESYSTEM_LIBRARY_RELEASE} REALPATH) -#GET_FILENAME_COMPONENT(Boost_SYSTEM_LIBRARY_RELEASE_REAL ${Boost_SYSTEM_LIBRARY_RELEASE} REALPATH) -#GET_FILENAME_COMPONENT(Boost_PYTHON_LIBRARY_RELEASE_REAL ${Boost_PYTHON_LIBRARY_RELEASE} REALPATH) - - install (FILES ${ISIMPA_RESSOURCES}/appconst.xml ${ISIMPA_RESSOURCES}/isimpa.ico @@ -500,12 +507,17 @@ if(WIN32) # Check if we are on Windows install(DIRECTORY ${PYTHON_ROOT_FOLDER}/Lib DESTINATION .) + + # Resolve symbolic link + LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL) + LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL) + LIB_TO_DLL(${Boost_PYTHON_LIBRARY_RELEASE} Boost_PYTHON_LIBRARY_RELEASE_REAL) install (FILES ${PYTHON_DLL} - ${Boost_FILESYSTEM_LIBRARY_RELEASE} - ${Boost_SYSTEM_LIBRARY_RELEASE} - ${Boost_PYTHON_LIBRARY_RELEASE} + ${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} + ${Boost_SYSTEM_LIBRARY_RELEASE_REAL} + ${Boost_PYTHON_LIBRARY_RELEASE_REAL} DESTINATION .) endif() diff --git a/src/lib_interface/CMakeLists.txt b/src/lib_interface/CMakeLists.txt index 970bf6c4..a74fa207 100644 --- a/src/lib_interface/CMakeLists.txt +++ b/src/lib_interface/CMakeLists.txt @@ -113,7 +113,7 @@ source_group( "tools" FILES ${TOOLS_SOURCES} ) #---------------------------------------# set(Boost_USE_STATIC_LIBS OFF) -find_package(Boost COMPONENTS system filesystem regex REQUIRED) +find_package(Boost COMPONENTS REQUIRED system filesystem regex) link_directories( ${Boost_LIBRARY_DIRS} ) include_directories( ${Boost_INCLUDE_DIRS} ) diff --git a/src/preprocess/CMakeLists.txt b/src/preprocess/CMakeLists.txt index bb4ccd99..af513279 100644 --- a/src/preprocess/CMakeLists.txt +++ b/src/preprocess/CMakeLists.txt @@ -14,6 +14,9 @@ set(PREPROCESS_SOURCE_FILES # DEPENDENCY & EXECUTABLE (OR LIB) #---------------------------------------# +find_package(Boost COMPONENTS system filesystem regex REQUIRED) +link_directories( ${Boost_LIBRARY_DIRS} ) + # Set Properties->General->Configuration Type to Application # Creates spps with the listed sources # Adds sources to the Solution Explorer diff --git a/src/python_bindings/CMakeLists.txt b/src/python_bindings/CMakeLists.txt index e1f95365..0958f696 100644 --- a/src/python_bindings/CMakeLists.txt +++ b/src/python_bindings/CMakeLists.txt @@ -21,6 +21,11 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(CMAKE_SWIG_FLAGS "") SET_SOURCE_FILES_PROPERTIES(libsimpa.i PROPERTIES CPLUSPLUS ON) + +set(Boost_USE_STATIC_LIBS OFF) +find_package(Boost COMPONENTS system filesystem regex REQUIRED) +link_directories( ${Boost_LIBRARY_DIRS} ) + SWIG_ADD_MODULE(libsimpa python libsimpa.i) SWIG_LINK_LIBRARIES(libsimpa lib_interface ${PYTHON_LIBRARIES}) From 86d7a7b749c09df46c4e27a26401be899a69f55b Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Thu, 22 Sep 2016 10:22:05 +0200 Subject: [PATCH 12/13] Fix directory creation receivers --- src/isimpa/CMakeLists.txt | 2 ++ src/lib_interface/input_output/baseReportManager.cpp | 5 +++-- src/lib_interface/std_tools.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index 7650d3a0..fea13780 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -512,12 +512,14 @@ if(WIN32) # Check if we are on Windows LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL) LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL) LIB_TO_DLL(${Boost_PYTHON_LIBRARY_RELEASE} Boost_PYTHON_LIBRARY_RELEASE_REAL) + LIB_TO_DLL(${Boost_REGEX_LIBRARY_RELEASE} Boost_REGEX_LIBRARY_RELEASE_REAL) install (FILES ${PYTHON_DLL} ${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} ${Boost_SYSTEM_LIBRARY_RELEASE_REAL} ${Boost_PYTHON_LIBRARY_RELEASE_REAL} + ${Boost_REGEX_LIBRARY_RELEASE_REAL} DESTINATION .) endif() diff --git a/src/lib_interface/input_output/baseReportManager.cpp b/src/lib_interface/input_output/baseReportManager.cpp index f98b39c8..b75e949f 100644 --- a/src/lib_interface/input_output/baseReportManager.cpp +++ b/src/lib_interface/input_output/baseReportManager.cpp @@ -204,8 +204,9 @@ void BaseReportManager::SauveRecepteursPonctuels(stringClass rootFolder,const st while (boost::filesystem::exists(recpFolder) && counter < 20) { recpFolder = (rootFolder + currentRecP->lblRp + stringClass::FromInt(counter++)); } - currentRecP->pathRp=recpFolder.string() + "/"; - recpFolder=recpFolder.string() + "/"+fileName; + currentRecP->pathRp=recpFolder.string() + st_path_separator(); + st_mkdir(recpFolder.string()); + recpFolder=recpFolder.string() + st_path_separator() + fileName; SauveRecepteurPonctuel(recpFolder.string(), freqLst, timeStepLst, currentRecP); } diff --git a/src/lib_interface/std_tools.cpp b/src/lib_interface/std_tools.cpp index 25ff5449..da436496 100644 --- a/src/lib_interface/std_tools.cpp +++ b/src/lib_interface/std_tools.cpp @@ -43,7 +43,7 @@ bool st_mkdir(const std::string& pathname) { - return boost::filesystem::create_directory(pathname); + return boost::filesystem::create_directories(pathname); } std::string st_path_separator() { From d540a527dbebfb3d14a721c9a54eb94ebe14945d Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Thu, 22 Sep 2016 10:37:44 +0200 Subject: [PATCH 13/13] fix more path and linking --- src/VolumetricMeshRepair/CMakeLists.txt | 3 +++ src/VolumetricMeshRepair/main_remesh.cpp | 4 +--- src/lib_interface/coreinitialisation.cpp | 2 +- src/spps/input_output/reportmanager.cpp | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/VolumetricMeshRepair/CMakeLists.txt b/src/VolumetricMeshRepair/CMakeLists.txt index 97ef86dd..770a523b 100644 --- a/src/VolumetricMeshRepair/CMakeLists.txt +++ b/src/VolumetricMeshRepair/CMakeLists.txt @@ -21,6 +21,9 @@ set(VMR_SOURCE_FILES # DEPENDENCY & EXECUTABLE (OR LIB) #---------------------------------------# +find_package(Boost COMPONENTS system filesystem regex REQUIRED) +link_directories( ${Boost_LIBRARY_DIRS} ) + # Set Properties->General->Configuration Type to Application # Creates spps with the listed sources # Adds sources to the Solution Explorer diff --git a/src/VolumetricMeshRepair/main_remesh.cpp b/src/VolumetricMeshRepair/main_remesh.cpp index d1fd7693..bdb74baa 100644 --- a/src/VolumetricMeshRepair/main_remesh.cpp +++ b/src/VolumetricMeshRepair/main_remesh.cpp @@ -304,9 +304,7 @@ int MainRemesh(int argc, char* argv[]) //if(FromTriangleRemesh.GetVolumeValue(i)>volumeSelectionInfo.minimalVol && (!(volumeSelectionInfo.selectionFilter==VolumeSelectionInfo_t::FILTER_SKIP_EXT) || i!=2) && (!(volumeSelectionInfo.selectionFilter==VolumeSelectionInfo_t::FILTER_EXT_ONLY) || i==2)) if(i>1 && i reportStepLbl; BaseReportManager::InitHeaderArrays(configManager, reportFreqLbl, reportStepLbl); CoreString rootRaw=workingDir; - CoreString rootRp=rootRaw+CoreString(*configManager.FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FOLDER_PATH)+"/"); + CoreString rootRp=rootRaw+CoreString(*configManager.FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FOLDER_PATH)+st_path_separator()); st_mkdir(rootRaw); st_mkdir(rootRp); BaseReportManager::SauveRecepteursPonctuels(rootRp,*configManager.FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FILE_PATH),reportFreqLbl,reportStepLbl,&configManager.recepteur_p_List); diff --git a/src/spps/input_output/reportmanager.cpp b/src/spps/input_output/reportmanager.cpp index d7ce54b4..50682301 100644 --- a/src/spps/input_output/reportmanager.cpp +++ b/src/spps/input_output/reportmanager.cpp @@ -95,7 +95,7 @@ void ReportManager::writeParticleFile() // Create particules folder st_mkdir(paramReport._particlePath); stringClass freqFolder; - freqFolder=paramReport._particlePath+stringClass::FromInt(paramReport.freqValue)+stringClass("/"); + freqFolder=paramReport._particlePath+stringClass::FromInt(paramReport.freqValue)+st_path_separator(); st_mkdir(freqFolder); stringClass fileNamePath=freqFolder+paramReport._particleFileName; @@ -616,7 +616,7 @@ void ReportManager::SaveSoundLevelBySource(const CoreString& filename,std::vecto //Pour chaque r�cepteur ponctuel for(uentier idrecp=0;idrecprecepteur_p_List.size();idrecp++) { - CoreString rootRp=workingDir+CoreString(*params.configManager->FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FOLDER_PATH)+"/"); + CoreString rootRp=workingDir+CoreString(*params.configManager->FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FOLDER_PATH)+st_path_separator()); t_Recepteur_P* currentRP=params.configManager->recepteur_p_List[idrecp]; t_Recepteur_P receiverData(nbfreqMax,params.nbTimeStep); // Create the content @@ -634,7 +634,7 @@ void ReportManager::SaveSoundLevelBySource(const CoreString& filename,std::vecto } receiverData.lblRp = currentRP->lblRp; receiverData.cdt_vol = currentRP->cdt_vol; - CoreString file = rootRp + receiverData.lblRp + "/" + params.configManager->srcList[idsource]->sourceName + "/"; + CoreString file = rootRp + receiverData.lblRp + "/" + params.configManager->srcList[idsource]->sourceName + st_path_separator(); st_mkdir(file); file += *params.configManager->FastGetConfigValue(Base_Core_Configuration::SPROP_PONCTUAL_RECEIVER_FILE_PATH); BaseReportManager::SauveRecepteurPonctuel(file, reportFreqLbl, reportStepLbl, &receiverData);