Adding First files

This commit is contained in:
Yoann Audouin 2022-11-14 15:40:36 +01:00
parent 059ed6d046
commit 38ce511dfe
6 changed files with 192 additions and 16 deletions

View File

@ -77,6 +77,8 @@ SET(_link_LIBRARIES
SET(SMESHimpl_HEADERS
SMESH_Gen.hxx
SMESH_Mesh.hxx
SMESH_SequentialMesh.hxx
SMESH_ParallelMesh.hxx
SMESH_subMesh.hxx
SMESH_subMeshEventListener.hxx
SMESH_Hypothesis.hxx
@ -102,6 +104,8 @@ SET(SMESHimpl_SOURCES
memoire.h
SMESH_Gen.cxx
SMESH_Mesh.cxx
SMESH_SequentialMesh.cxx
SMESH_ParallelMesh.cxx
SMESH_subMesh.cxx
SMESH_Hypothesis.cxx
SMESH_Algo.cxx

View File

@ -391,32 +391,33 @@ class SMESH_EXPORT SMESH_Mesh
// Parallel computation functions
#ifdef WIN32
void Lock() {};
void Unlock() {};
virtual void Lock() {};
virtual void Unlock() {};
int GetNbThreads(){return _NbThreads;};
void SetNbThreads(long nbThreads){std::cout << "Warning Parallel Meshing is disabled on Windows it will behave as a slower normal compute" << std::endl;_NbThreads=nbThreads;};
virtual int GetNbThreads(){return _NbThreads;};
virtual void SetNbThreads(long nbThreads){std::cout << "Warning Parallel Meshing is disabled on Windows it will behave as a slower normal compute" << std::endl;_NbThreads=nbThreads;};
void InitPoolThreads(){};
void DeletePoolThreads(){};
void wait(){}
virtual void InitPoolThreads(){};
virtual void DeletePoolThreads(){};
virtual void wait(){}
bool IsParallel(){return _NbThreads > 0;}
virtual bool IsParallel(){return _NbThreads > 0;}
#else
void Lock() {_my_lock.lock();};
void Unlock() {_my_lock.unlock();};
virtual void Lock() {_my_lock.lock();};
virtual void Unlock() {_my_lock.unlock();};
int GetNbThreads(){return _NbThreads;};
void SetNbThreads(long nbThreads){_NbThreads=nbThreads;};
virtual int GetNbThreads(){return _NbThreads;};
virtual void SetNbThreads(long nbThreads){_NbThreads=nbThreads;};
void InitPoolThreads(){_pool = new boost::asio::thread_pool(_NbThreads);};
void DeletePoolThreads(){delete _pool;};
virtual void InitPoolThreads(){_pool = new boost::asio::thread_pool(_NbThreads);};
virtual void DeletePoolThreads(){delete _pool;};
void wait(){_pool->join(); DeletePoolThreads(); InitPoolThreads(); }
virtual void wait(){_pool->join(); DeletePoolThreads(); InitPoolThreads(); }
bool IsParallel(){return _NbThreads > 0;}
virtual bool IsParallel(){return _NbThreads > 0;}
#endif
//TODO: to remove only used by ParallelMesh
void CreateTmpFolder();
void DeleteTmpFolder();

View File

@ -0,0 +1,28 @@
// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_ParallelMesh.cxx
// Author : Yoann AUDOUIN, EDF
// Module : SMESH
//
#include "SMESH_ParallelMesh.hxx"

View File

@ -0,0 +1,62 @@
// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_ParallelMesh.hxx
// Author : Yoann AUDOUIN, EDF
// Module : SMESH
//
#ifndef _SMESH_PARALLELMESH_HXX_
#define _SMESH_PARALLELMESH_HXX_
#include "SMESH_Mesh.hxx"
class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
{
public:
SMESH_ParallelMesh(int theLocalId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument);
virtual ~SMESH_ParallelMesh();
void Lock() override {_my_lock.lock();};
void Unlock() override {_my_lock.unlock();};
int GetNbThreads() override{return _NbThreads;};
void SetNbThreads(long nbThreads) override{_NbThreads=nbThreads;};
void InitPoolThreads() override{_pool = new boost::asio::thread_pool(_NbThreads);};
void DeletePoolThreads() override{delete _pool;};
void wait() override{_pool->join(); DeletePoolThreads(); InitPoolThreads(); };
bool IsParallel() override{return _NbThreads > 0;};
void CreateTmpFolder();
void DeleteTmpFolder();
private:
boost::filesystem::path tmp_folder;
boost::asio::thread_pool * _pool = nullptr; //thread pool for computation
};
#endif

View File

@ -0,0 +1,27 @@
// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_SequentialMesh.cxx
// Author : Yoann AUDOUIN, EDF
// Module : SMESH
//
#include "SMESH_SequentialMesh.hxx"

View File

@ -0,0 +1,54 @@
// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_SequentialMesh.hxx
// Author : Yoann AUDOUIN, EDF
// Module : SMESH
//
#ifndef _SMESH_SEQUENTIALMESH_HXX_
#define _SMESH_SEQUENTIALMESH_HXX_
#include "SMESH_Mesh.hxx"
class SMESH_EXPORT SMESH_SequentialMesh: public SMESH_Mesh
{
public:
SMESH_SequentialMesh(int theLocalId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument);
virtual ~SMESH_SequentialMesh();
void Lock() override {};
void Unlock() override {};
int GetNbThreads() override {return 0;};
void SetNbThreads(long nbThreads) {};
void InitPoolThreads() override {};
void DeletePoolThreads() override {};
void wait() override {};
bool IsParallel() override {return false;};
};
#endif