Add support for OCCT 7.8.0 (#11909)

This commit is contained in:
bgbsww
2024-01-09 20:47:25 -05:00
committed by GitHub
parent b1ee268d98
commit bd1fc0fc03
29 changed files with 161 additions and 35 deletions

View File

@@ -29,13 +29,26 @@
#include <TopoDS_Shape.hxx>
#include <Standard_Version.hxx>
/*
* This method needed for instance NCollection_DataMap with TopoDS_Shape as key
*/
#if OCC_VERSION_HEX >= 0x070800
struct SMESHDS_Hasher
{
size_t operator()(const TopoDS_Shape& S) const noexcept {
return std::hash<TopoDS_Shape>{}(S);
}
size_t operator()(const TopoDS_Shape& S1, const TopoDS_Shape& S2) const noexcept {
return S1.IsSame(S2);
}
};
#else
struct SMESHDS_Hasher
{
static inline Standard_Boolean IsEqual(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
const TopoDS_Shape& S2)
{
return S1.IsSame(S2);
}
@@ -45,6 +58,6 @@ struct SMESHDS_Hasher
return ::HashCode( S, Upper);
}
};
#endif
#endif

View File

@@ -57,9 +57,6 @@
#ifndef _MeshVS_EntityType_HeaderFile
#include <MeshVS_EntityType.hxx>
#endif
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
#ifndef _TColStd_HArray1OfInteger_HeaderFile
#include <TColStd_HArray1OfInteger.hxx>
#endif

View File

@@ -37,4 +37,5 @@
#define SMESH_EXPORT
#endif
#include <Standard_Version.hxx>
#endif

View File

@@ -28,10 +28,11 @@
#include "SMESH_SMESH.hxx"
#include <NCollection_DefineSequence.hxx>
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Sequence.hxx>
#else
#include <NCollection_DefineSequence.hxx>
#endif
typedef const SMDS_MeshNode* SMDS_MeshNodePtr;

View File

@@ -185,11 +185,18 @@ typedef std::vector< UVPtStruct > UVPtStructVec;
// --------------------------------------------------------------------------------
// class SMESH_SequenceOfElemPtr
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX >= 0x060703
#include <NCollection_Sequence.hxx>
#else
#include <NCollection_DefineSequence.hxx>
#endif
class SMDS_MeshElement;
typedef const SMDS_MeshElement* SMDS_MeshElementPtr;
#define DEFINE_SEQUENCE(_ClassName_, _BaseCollection_, TheItemType) \
typedef NCollection_Sequence<TheItemType > _ClassName_;
DEFINE_SEQUENCE (SMESH_SequenceOfElemPtr, SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr)

View File

@@ -33,10 +33,33 @@
#include "SMDS_MeshNode.hxx"
#include "SMESH_File.hxx"
#include <Standard_Version.hxx>
namespace
{
struct Hasher
{
#if OCC_VERSION_HEX >= 0x070800
size_t operator()(const gp_Pnt& point) const noexcept
{
union
{
Standard_Real R[3];
Standard_Integer I[6];
} U;
point.Coord( U.R[0], U.R[1], U.R[2] );
return std::hash<Standard_Integer>{}(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7);
}
size_t operator()(const gp_Pnt& point1, const gp_Pnt& point2) const noexcept
{
static Standard_Real tab1[3], tab2[3];
point1.Coord(tab1[0],tab1[1],tab1[2]);
point2.Coord(tab2[0],tab2[1],tab2[2]);
return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
}
#else
//=======================================================================
//function : HashCode
//purpose :
@@ -51,9 +74,9 @@ namespace
} U;
point.Coord( U.R[0], U.R[1], U.R[2] );
return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
return std::hash<Standard_Integer>{}(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7);
}
//=======================================================================
//function : IsEqual
//purpose :
@@ -66,7 +89,9 @@ namespace
point2.Coord(tab2[0],tab2[1],tab2[2]);
return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
}
#endif
};
typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*,Hasher> TDataMapOfPntNodePtr;
const int HEADER_SIZE = 84;

View File

@@ -48,7 +48,6 @@
#include <Bnd_Box.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Geom_Surface.hxx>
#include <NCollection_DefineArray2.hxx>
#include <Precision.hxx>
#include <Standard_Real.hxx>
#include <TColStd_SequenceOfInteger.hxx>