Skip to content

Commit

Permalink
FEM: Make SMESH7 compile with occ6
Browse files Browse the repository at this point in the history
  • Loading branch information
ickby authored and wwmayer committed Jun 15, 2016
1 parent 666a3e5 commit 61f503a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -647,6 +647,9 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Salome SMESH sources are under src/3rdParty now
IF(OCC_FOUND)
if(NOT FREECAD_USE_EXTERNAL_SMESH)
find_package(VTK REQUIRED)
find_package(HDF5 REQUIRED)
find_package(MEDFile REQUIRED)
set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
else()
find_package(SMESH)
Expand Down
6 changes: 0 additions & 6 deletions src/3rdParty/salomesmesh/CMakeLists.txt
Expand Up @@ -16,12 +16,6 @@ if(CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-self-assign -Wno-reorder -Wno-switch-enum -Wno-unknown-pragmas -Wno-logical-op-parentheses -Wno-unused-variable -Wno-unused-function -Wno-overloaded-virtual")
endif()

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
find_package(VTK REQUIRED)
find_package(HDF5 REQUIRED)
find_package(OPENCASCADE)
find_package(MEDFile REQUIRED)
find_package(Boost COMPONENTS filesystem program_options regex signals system thread REQUIRED)
include(${VTK_USE_FILE})
include_directories(
src/SMDS
Expand Down
1 change: 1 addition & 0 deletions src/3rdParty/salomesmesh/inc/SMESH_MAT2d.hxx
Expand Up @@ -30,6 +30,7 @@

#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <gp.hxx> //added for occ6

#include <vector>
#include <map>
Expand Down
6 changes: 6 additions & 0 deletions src/3rdParty/salomesmesh/inc/SMESH_MeshVSLink.hxx
Expand Up @@ -27,6 +27,12 @@
#ifndef _SMESH_MeshVSLink_HeaderFile
#define _SMESH_MeshVSLink_HeaderFile

#if OCC_VERSION_HEX < 0x070000
#ifndef _Handle_SMESH_MeshVSLink_HeaderFile
#include <Handle_SMESH_MeshVSLink.hxx>
#endif
#endif

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
Expand Down
47 changes: 39 additions & 8 deletions src/3rdParty/salomesmesh/inc/SMESH_MeshVSLink.ixx
Expand Up @@ -24,20 +24,51 @@
// Author : Sioutis Fotios
// Module : SMESH

// #include <SMESH_MeshVSLink.jxx>
#if OCC_VERSION_HEX < 0x070000

// #ifndef _Standard_TypeMismatch_HeaderFile
// #include <Standard_TypeMismatch.hxx>
// #endif
#include <SMESH_MeshVSLink.jxx>

#ifndef _Standard_Version_HeaderFile
#include <Standard_Version.hxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif

#if OCC_VERSION_HEX < 0x070000
Standard_EXPORT Handle_Standard_Type& SMESH_MeshVSLink_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(MeshVS_DataSource3D);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MeshVS_DataSource);
static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);


static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SMESH_MeshVSLink",
sizeof(SMESH_MeshVSLink),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);

return _aType;
}


// DownCast method
// allow safe downcasting
//
const Handle(SMESH_MeshVSLink) Handle(SMESH_MeshVSLink)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(SMESH_MeshVSLink) _anOtherObject;

if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(SMESH_MeshVSLink))) {
_anOtherObject = Handle(SMESH_MeshVSLink)((Handle(SMESH_MeshVSLink)&)AnObject);
}
}

return _anOtherObject ;
}

const Handle(Standard_Type)& SMESH_MeshVSLink::DynamicType() const
{
return STANDARD_TYPE(SMESH_MeshVSLink) ;
}

#endif
3 changes: 1 addition & 2 deletions src/3rdParty/salomesmesh/inc/StdMeshers_ProjectionUtils.hxx
Expand Up @@ -34,12 +34,12 @@

#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp_GTrsf.hxx>
#include <gp_GTrsf2d.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>

#include <list>
#include <map>
Expand All @@ -49,7 +49,6 @@ class SMESH_Algo;
class SMESH_Hypothesis;
class SMESH_Mesh;
class SMESH_subMesh;
class TopTools_IndexedMapOfShape;
class TopoDS_Shape;

/*!
Expand Down
2 changes: 2 additions & 0 deletions src/3rdParty/salomesmesh/src/SMESH/GEOMUtils.cpp
Expand Up @@ -1134,9 +1134,11 @@ bool GEOMUtils::FixShapeCurves( TopoDS_Shape& shape )
for (; aExpE.More(); aExpE.Next()) {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExpE.Current();
try {
#if OCC_VERSION_HEX >= 0x060800
if (!BOPTools_AlgoTools::ComputeTolerance(aF, aE, aDMax, aT)) {
continue;
}
#endif
}
catch(...) {
continue;
Expand Down
10 changes: 6 additions & 4 deletions src/3rdParty/salomesmesh/src/StdMeshers/SMESH_MAT2d.cpp
Expand Up @@ -663,10 +663,12 @@ namespace
// make scale to have coordinates precise enough when converted to int

gp_XY uvMin = uvBox.CornerMin(), uvMax = uvBox.CornerMax();
uvMin.ChangeCoord(1) = uvMin.X() * scale[0];
uvMin.ChangeCoord(2) = uvMin.Y() * scale[1];
uvMax.ChangeCoord(1) = uvMax.X() * scale[0];
uvMax.ChangeCoord(2) = uvMax.Y() * scale[1];

uvMin.SetX(uvMin.X() * scale[0]);
uvMin.SetY(uvMin.Y() * scale[1]);
uvMax.SetX(uvMax.X() * scale[0]);
uvMax.SetY(uvMax.Y() * scale[1]);

double vMax[2] = { Max( Abs( uvMin.X() ), Abs( uvMax.X() )),
Max( Abs( uvMin.Y() ), Abs( uvMax.Y() )) };
int iMax = ( vMax[0] > vMax[1] ) ? 0 : 1;
Expand Down

0 comments on commit 61f503a

Please sign in to comment.