port to smesh 8.3

using #ifdef EXTERNAL_SMESH for the diff
This commit is contained in:
looooo
2018-04-17 21:22:26 +02:00
committed by wmayer
parent 5941a32f71
commit 21cdc9ea4a
15 changed files with 84 additions and 10 deletions

View File

@@ -734,8 +734,13 @@ endif()
endif()
find_package(MEDFile REQUIRED)
set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
else()
find_package(SMESH)
else(NOT FREECAD_USE_EXTERNAL_SMESH)
find_package(SMESH CONFIG REQUIRED)
include_directories(${SMESH_INCLUDE_DIR})
link_directories(${SMESH_LIB_PATH})
SET(EXTERNAL_SMESH_LIBS ${SMESH_LIBRARIES})
add_definitions(-DHAVE_NETGEN)
add_definitions(-DEXTERNAL_SMESH)
if(NOT SMESH_FOUND)
message(ERROR "================\n"
"SMESH not found.\n"

View File

@@ -119,7 +119,9 @@ PyMOD_INIT_FUNC(Fem)
Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule);
Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule);
Fem::StdMeshers_StartEndLengthPy ::init_type(femModule);
#ifndef EXTERNAL_SMESH
Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule);
#endif
Fem::StdMeshers_Hexa_3DPy ::init_type(femModule);
// Add Types to module

View File

@@ -50,7 +50,9 @@
#include <StdMeshers_LocalLength.hxx>
#include <StdMeshers_NumberOfSegments.hxx>
#include <StdMeshers_AutomaticLength.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#ifndef EXTERNAL_SMESH
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_MEFISTO_2D.hxx>
#include <StdMeshers_Deflection1D.hxx>
#include <StdMeshers_MaxElementArea.hxx>

View File

@@ -181,7 +181,7 @@ SET(Fem_SRCS
add_library(Fem SHARED ${Fem_SRCS})
target_link_libraries(Fem ${Fem_LIBS} ${VTK_LIBRARIES})
target_link_libraries(Fem ${Fem_LIBS} ${VTK_LIBRARIES} ${EXTERNAL_SMESH_LIBS})
SET_BIN_DIR(Fem Fem /Mod/Fem)

View File

@@ -61,6 +61,7 @@
#include <SMDS_MeshGroup.hxx>
#include <SMESHDS_GroupBase.hxx>
#include <SMESHDS_Group.hxx>
#include <SMESHDS_Mesh.hxx>
#include <SMDS_PolyhedralVolumeOfNodes.hxx>
#include <SMDS_VolumeTool.hxx>
#include <StdMeshers_MaxLength.hxx>
@@ -89,6 +90,9 @@ using namespace Base;
using namespace boost;
static int StatCount = 0;
#ifdef EXTERNAL_SMESH
SMESH_Gen* FemMesh::_mesh_gen = 0;
#endif
TYPESYSTEM_SOURCE(Fem::FemMesh , Base::Persistence);
@@ -489,7 +493,13 @@ SMESH_Mesh* FemMesh::getSMesh()
SMESH_Gen * FemMesh::getGenerator()
{
#ifndef EXTERNAL_SMESH
return SMESH_Gen::get();
#else
if (! FemMesh::_mesh_gen)
FemMesh::_mesh_gen = new SMESH_Gen();
return FemMesh::_mesh_gen;
#endif
}
void FemMesh::addHypothesis(const TopoDS_Shape & aSubShape, SMESH_HypothesisPtr hyp)
@@ -1155,11 +1165,13 @@ void FemMesh::read(const char *FileName)
// read brep-file
myMesh->STLToMesh(File.filePath().c_str());
}
#ifndef EXTERNAL_SMESH
else if (File.hasExtension("dat") ) {
// read brep-file
// vejmarie disable
myMesh->DATToMesh(File.filePath().c_str());
}
#endif
else if (File.hasExtension("bdf") ) {
// read Nastran-file
readNastran(File.filePath());

View File

@@ -160,6 +160,9 @@ private:
SMESH_Mesh *myMesh;
std::list<SMESH_HypothesisPtr> hypoth;
#ifdef EXTERNAL_SMESH
static SMESH_Gen *_mesh_gen;
#endif
};
} //namespace Part

View File

@@ -37,6 +37,9 @@
#include <SMDSAbs_ElementType.hxx>
#include <SMDS_MeshElement.hxx>
#include <SMDS_VolumeTool.hxx>
#ifdef EXTERNAL_SMESH
#include <SMESHDS_Mesh.hxx>
#endif
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>

View File

@@ -34,6 +34,9 @@
#include <Base/Console.h>
#include <SMESH_Gen.hxx>
#ifdef EXTERNAL_SMESH
#include <SMESHDS_Mesh.hxx>
#endif
#include <SMESH_Mesh.hxx>
#include <SMDS_PolyhedralVolumeOfNodes.hxx>

View File

@@ -61,7 +61,9 @@
#include <StdMeshers_QuadraticMesh.hxx>
#include <StdMeshers_RadialPrism_3D.hxx>
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#ifndef EXTERNAL_SMESH
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_ProjectionSource1D.hxx>
#include <StdMeshers_ProjectionSource2D.hxx>
#include <StdMeshers_ProjectionSource3D.hxx>

View File

@@ -53,6 +53,9 @@
#include <SMESH_Mesh.hxx>
#include <SMDS_PolyhedralVolumeOfNodes.hxx>
#include <SMDS_VolumeTool.hxx>
#ifdef EXTERNAL_SMESH
#include <SMESHDS_Mesh.hxx>
#endif
# include <TopoDS_Face.hxx>
# include <TopoDS_Solid.hxx>

View File

@@ -53,7 +53,9 @@
#include <StdMeshers_QuadraticMesh.hxx>
#include <StdMeshers_RadialPrism_3D.hxx>
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#ifndef EXTERNAL_SMESH
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_ProjectionSource1D.hxx>
#include <StdMeshers_ProjectionSource2D.hxx>
#include <StdMeshers_ProjectionSource3D.hxx>
@@ -87,11 +89,13 @@ void SMESH_HypothesisPy<T>::init_type(PyObject* module)
SMESH_HypothesisPy::add_varargs_method("setLibName", &SMESH_HypothesisPy<T>::setLibName, "setLibName(String)");
SMESH_HypothesisPy::add_varargs_method("getLibName", &SMESH_HypothesisPy<T>::getLibName, "String getLibName()");
#ifndef EXTERNAL_SMESH
SMESH_HypothesisPy::add_varargs_method("setParameters", &SMESH_HypothesisPy<T>::setParameters, "setParameters(String)");
SMESH_HypothesisPy::add_varargs_method("getParameters", &SMESH_HypothesisPy<T>::getParameters, "String getParameters()");
SMESH_HypothesisPy::add_varargs_method("setLastParameters", &SMESH_HypothesisPy<T>::setLastParameters, "setLastParameters(String)");
SMESH_HypothesisPy::add_varargs_method("getLastParameters", &SMESH_HypothesisPy<T>::getLastParameters, "String getLastParameters()");
SMESH_HypothesisPy::add_varargs_method("clearParameters", &SMESH_HypothesisPy<T>::clearParameters, "clearParameters()");
#endif
SMESH_HypothesisPy::add_varargs_method("isAuxiliary", &SMESH_HypothesisPy<T>::isAuxiliary, "Bool isAuxiliary()");
SMESH_HypothesisPy::add_varargs_method("setParametersByMesh", &SMESH_HypothesisPy<T>::setParametersByMesh, "setParametersByMesh(Mesh,Shape)");
Base::Interpreter().addType(SMESH_HypothesisPy<T>::behaviors().type_object(),
@@ -140,6 +144,8 @@ Py::Object SMESH_HypothesisPy<T>::getLibName(const Py::Tuple& args)
return Py::String(hypothesis<SMESH_Hypothesis>()->GetLibName());
}
#ifndef EXTERNAL_SMESH //////////////////////////////////////////////////////////
template<class T>
Py::Object SMESH_HypothesisPy<T>::setParameters(const Py::Tuple& args)
{
@@ -182,6 +188,7 @@ Py::Object SMESH_HypothesisPy<T>::clearParameters(const Py::Tuple& args)
hypothesis<SMESH_Hypothesis>()->ClearParameters();
return Py::None();
}
#endif //////////////////////////////////////////////////////////////////////////
template<class T>
Py::Object SMESH_HypothesisPy<T>::setParametersByMesh(const Py::Tuple& args)
@@ -646,6 +653,7 @@ StdMeshers_Hexa_3DPy::~StdMeshers_Hexa_3DPy()
// ----------------------------------------------------------------------------
#ifndef EXTERNAL_SMESH ///////////////////////////////////////////////////////////
void StdMeshers_TrianglePreferencePy::init_type(PyObject* module)
{
behaviors().name("StdMeshers_TrianglePreference");
@@ -661,6 +669,7 @@ StdMeshers_TrianglePreferencePy::StdMeshers_TrianglePreferencePy(int hypId, int
StdMeshers_TrianglePreferencePy::~StdMeshers_TrianglePreferencePy()
{
}
#endif ///////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------

View File

@@ -60,11 +60,13 @@ public:
Py::Object repr();
Py::Object getLibName(const Py::Tuple& args);
Py::Object setLibName(const Py::Tuple& args);
#ifndef EXTERNAL_SMESH
Py::Object setParameters(const Py::Tuple& args);
Py::Object getParameters(const Py::Tuple& args);
Py::Object setLastParameters(const Py::Tuple& args);
Py::Object getLastParameters(const Py::Tuple& args);
Py::Object clearParameters(const Py::Tuple& args);
#endif
Py::Object isAuxiliary(const Py::Tuple& args);
Py::Object setParametersByMesh(const Py::Tuple& args);
@@ -219,7 +221,7 @@ public:
StdMeshers_Hexa_3DPy(int hypId, int studyId, SMESH_Gen* gen);
~StdMeshers_Hexa_3DPy();
};
#ifndef EXTERNAL_SMESH ///////////////////////////////////////////////////////////////////////////////
class StdMeshers_TrianglePreferencePy : public SMESH_HypothesisPy<StdMeshers_TrianglePreferencePy>
{
public:
@@ -227,6 +229,7 @@ public:
StdMeshers_TrianglePreferencePy(int hypId, int studyId, SMESH_Gen* gen);
~StdMeshers_TrianglePreferencePy();
};
#endif ///////////////////////////////////////////////////////////////////////////////////////////////
class StdMeshers_StartEndLengthPy : public SMESH_HypothesisPy<StdMeshers_StartEndLengthPy>
{

View File

@@ -67,7 +67,7 @@ SET(MeshPart_SRCS
)
add_library(MeshPart SHARED ${MeshPart_SRCS})
target_link_libraries(MeshPart ${MeshPart_LIBS})
target_link_libraries(MeshPart ${MeshPart_LIBS} ${EXTERNAL_SMESH_LIBS})
fc_target_copy_resource(MeshPart

View File

@@ -42,10 +42,17 @@
#endif
#include <SMESH_Gen.hxx>
#include <StdMeshers_MaxLength.hxx>
#ifdef EXTERNAL_SMESH
#include <SMESH_Mesh.hxx>
#include <SMESHDS_Mesh.hxx>
#else
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_LocalLength.hxx>
#include <StdMeshers_NumberOfSegments.hxx>
#include <StdMeshers_AutomaticLength.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#include <StdMeshers_MEFISTO_2D.hxx>
#include <StdMeshers_Deflection1D.hxx>
#include <StdMeshers_Arithmetic1D.hxx>
@@ -68,6 +75,11 @@
using namespace MeshPart;
#ifdef EXTERNAL_SMESH
SMESH_Gen* Mesher::_mesh_gen = 0;
#endif
MeshingOutput::MeshingOutput()
{
buffer.reserve(80);
@@ -311,8 +323,17 @@ Mesh::MeshObject* Mesher::createMesh() const
#else
std::list<SMESH_Hypothesis*> hypoth;
#ifndef EXTERNAL_SMESH
SMESH_Gen* meshgen = SMESH_Gen::get();
#else
if (! Mesher::_mesh_gen)
Mesher::_mesh_gen = new SMESH_Gen();
SMESH_Gen* meshgen = Mesher::_mesh_gen;
#endif
SMESH_Mesh* mesh = meshgen->CreateMesh(0, true);
int hyp=0;
switch (method) {
@@ -385,9 +406,10 @@ Mesh::MeshObject* Mesher::createMesh() const
StdMeshers_Regular_1D* hyp1d = new StdMeshers_Regular_1D(hyp++,0,meshgen);
hypoth.push_back(hyp1d);
}
#ifndef EXTERNAL_SMESH
StdMeshers_TrianglePreference* hyp2d_1 = new StdMeshers_TrianglePreference(hyp++,0,meshgen);
hypoth.push_back(hyp2d_1);
#endif
StdMeshers_MEFISTO_2D* alg2d = new StdMeshers_MEFISTO_2D(hyp++,0,meshgen);
hypoth.push_back(alg2d);
} break;

View File

@@ -27,6 +27,7 @@
#include <Base/Stream.h>
class TopoDS_Shape;
class SMESH_Gen;
namespace Mesh { class MeshObject; }
namespace MeshPart {
@@ -152,6 +153,10 @@ private:
#endif
std::vector<uint32_t> colors;
struct Vertex;
#ifdef EXTERNAL_SMESH
static SMESH_Gen *_mesh_gen;
#endif
};
class MeshingOutput : public std::streambuf