mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0033370: Foundation Classes - Moving into STL and Boost functionality
NCollection containers update: - NCollection_Array1 - updated functionality - NCollection_Array2 - NCollection_Array1 as a wrapper for 2array - NCollection_Vector -> NCollection_DynamicArray was renamed and reworked. TCollection: - Use static empty string to avoid allocations on empty string NCollection allocators update: - NCollection_Allocator - allocator that used Standard::Allocate - NCollection_OccAllocator - allocator-wrapper that used OCC BaseAllocator objects - NCollection_IncAllocator - rework to increase performance Standard: - Rework functionality to use different allocation libs - Implement basic of new way to wrap allocations tools - Define 4 ways to allocation (defines in configure stage) Additional changes: - Hash function uses std::hash functionality - size_t as a hash value - New HashUtils with Murmur and FVN hash algo for x32 and x64 - Deprecated _0.cxx and .gxx DE classes reorganized - Create own utility for std memory - Update Standard_Transient to be more platform-independent Math TK changes: - math_Vector -> match_BaseVector<> - Buffer decreased to cash 32 elements instead of 512
This commit is contained in:
@@ -17,8 +17,6 @@ IntTools_CurveRangeLocalizeData.cxx
|
||||
IntTools_CurveRangeLocalizeData.hxx
|
||||
IntTools_CurveRangeSample.cxx
|
||||
IntTools_CurveRangeSample.hxx
|
||||
IntTools_CurveRangeSampleMapHasher.hxx
|
||||
IntTools_DataMapIteratorOfDataMapOfCurveSampleBox.hxx
|
||||
IntTools_DataMapIteratorOfDataMapOfSurfaceSampleBox.hxx
|
||||
IntTools_DataMapOfCurveSampleBox.hxx
|
||||
IntTools_DataMapOfSurfaceSampleBox.hxx
|
||||
@@ -64,7 +62,6 @@ IntTools_SurfaceRangeLocalizeData.lxx
|
||||
IntTools_SurfaceRangeSample.cxx
|
||||
IntTools_SurfaceRangeSample.hxx
|
||||
IntTools_SurfaceRangeSample.lxx
|
||||
IntTools_SurfaceRangeSampleMapHasher.hxx
|
||||
IntTools_Tools.cxx
|
||||
IntTools_Tools.hxx
|
||||
IntTools_TopolTool.cxx
|
||||
|
@@ -2334,7 +2334,7 @@ static void MergeSolutions(const IntTools_ListOfCurveRangeSample& theListCurveRa
|
||||
IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
|
||||
IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort)
|
||||
{
|
||||
NCollection_IndexedMap<IntTools_SurfaceRangeSample, IntTools_SurfaceRangeSampleMapHasher> aMapToAvoid;
|
||||
NCollection_IndexedMap<IntTools_SurfaceRangeSample> aMapToAvoid;
|
||||
|
||||
NCollection_DataMap<Standard_Integer, TColStd_ListOfInteger> aCurveIdMap;
|
||||
std::vector<IntTools_CurveRangeSample> aCurveRangeVector;
|
||||
|
@@ -125,7 +125,7 @@ IntTools_Context::~IntTools_Context()
|
||||
}
|
||||
mySClassMap.Clear();
|
||||
|
||||
for (NCollection_DataMap<Handle(Geom_Curve), GeomAPI_ProjectPointOnCurve*, TColStd_MapTransientHasher>::Iterator anIt (myProjPTMap);
|
||||
for (NCollection_DataMap<Handle(Geom_Curve), GeomAPI_ProjectPointOnCurve*>::Iterator anIt (myProjPTMap);
|
||||
anIt.More(); anIt.Next())
|
||||
{
|
||||
GeomAPI_ProjectPointOnCurve* pProjPT = anIt.Value();
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TopAbs_State.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
class IntTools_FClass2d;
|
||||
class TopoDS_Face;
|
||||
class GeomAPI_ProjectPointOnSurf;
|
||||
@@ -247,7 +246,7 @@ protected:
|
||||
NCollection_DataMap<TopoDS_Shape, GeomAPI_ProjectPointOnSurf*, TopTools_ShapeMapHasher> myProjPSMap;
|
||||
NCollection_DataMap<TopoDS_Shape, GeomAPI_ProjectPointOnCurve*, TopTools_ShapeMapHasher> myProjPCMap;
|
||||
NCollection_DataMap<TopoDS_Shape, BRepClass3d_SolidClassifier*, TopTools_ShapeMapHasher> mySClassMap;
|
||||
NCollection_DataMap<Handle(Geom_Curve), GeomAPI_ProjectPointOnCurve*, TColStd_MapTransientHasher> myProjPTMap;
|
||||
NCollection_DataMap<Handle(Geom_Curve), GeomAPI_ProjectPointOnCurve*> myProjPTMap;
|
||||
NCollection_DataMap<TopoDS_Shape, Geom2dHatch_Hatcher*, TopTools_ShapeMapHasher> myHatcherMap;
|
||||
NCollection_DataMap<TopoDS_Shape, IntTools_SurfaceRangeLocalizeData*, TopTools_ShapeMapHasher> myProjSDataMap;
|
||||
NCollection_DataMap<TopoDS_Shape, Bnd_Box*, TopTools_ShapeMapHasher> myBndBoxDataMap;
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <IntTools_BaseRangeSample.hxx>
|
||||
#include <Standard_HashUtils.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
@@ -47,6 +48,11 @@ public:
|
||||
return ((myIndex == Other.myIndex) && (GetDepth() == Other.GetDepth()));
|
||||
}
|
||||
|
||||
bool operator==(const IntTools_CurveRangeSample& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
||||
Standard_EXPORT IntTools_Range GetRange (const Standard_Real theFirst, const Standard_Real theLast, const Standard_Integer theNbSample) const;
|
||||
|
||||
Standard_Integer GetRangeIndexDeeper (const Standard_Integer theNbSample) const
|
||||
@@ -60,4 +66,18 @@ private:
|
||||
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<IntTools_CurveRangeSample>
|
||||
{
|
||||
size_t operator()(const IntTools_CurveRangeSample& theCurveRangeSample) const noexcept
|
||||
{
|
||||
// Combine two int values into a single hash value.
|
||||
int aCombination[2]{ theCurveRangeSample.GetDepth(), theCurveRangeSample.GetRangeIndex() };
|
||||
return opencascade::hashBytes(aCombination, sizeof(aCombination));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _IntTools_CurveRangeSample_HeaderFile
|
||||
|
@@ -1,50 +0,0 @@
|
||||
// Created on: 2005-10-14
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _IntTools_CurveRangeSampleMapHasher_HeaderFile
|
||||
#define _IntTools_CurveRangeSampleMapHasher_HeaderFile
|
||||
|
||||
#include <IntTools_CurveRangeSample.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
//! class for range index management of curve
|
||||
class IntTools_CurveRangeSampleMapHasher
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Computes a hash code for the given key, in the range [1, theUpperBound]
|
||||
//! @param theKey the key which hash code is to be computed
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
static Standard_Integer HashCode (const IntTools_CurveRangeSample& theKey, const Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode(theKey.GetDepth(), theUpperBound);
|
||||
}
|
||||
|
||||
//! Returns True when the two keys are the same. Two
|
||||
//! same keys must have the same hashcode, the
|
||||
//! contrary is not necessary.
|
||||
static Standard_Boolean IsEqual (const IntTools_CurveRangeSample& S1, const IntTools_CurveRangeSample& S2)
|
||||
{
|
||||
return S1.IsEqual(S2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // _IntTools_CurveRangeSampleMapHasher_HeaderFile
|
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef IntTools_DataMapIteratorOfDataMapOfCurveSampleBox_HeaderFile
|
||||
#define IntTools_DataMapIteratorOfDataMapOfCurveSampleBox_HeaderFile
|
||||
|
||||
#include <IntTools_DataMapOfCurveSampleBox.hxx>
|
||||
|
||||
#endif
|
@@ -18,11 +18,10 @@
|
||||
|
||||
#include <IntTools_CurveRangeSample.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <IntTools_CurveRangeSampleMapHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<IntTools_CurveRangeSample,Bnd_Box,IntTools_CurveRangeSampleMapHasher> IntTools_DataMapOfCurveSampleBox;
|
||||
typedef NCollection_DataMap<IntTools_CurveRangeSample,Bnd_Box,IntTools_CurveRangeSampleMapHasher>::Iterator IntTools_DataMapIteratorOfDataMapOfCurveSampleBox;
|
||||
typedef NCollection_DataMap<IntTools_CurveRangeSample,Bnd_Box> IntTools_DataMapOfCurveSampleBox;
|
||||
typedef NCollection_DataMap<IntTools_CurveRangeSample,Bnd_Box>::Iterator IntTools_DataMapIteratorOfDataMapOfCurveSampleBox;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -18,11 +18,10 @@
|
||||
|
||||
#include <IntTools_SurfaceRangeSample.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <IntTools_SurfaceRangeSampleMapHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<IntTools_SurfaceRangeSample,Bnd_Box,IntTools_SurfaceRangeSampleMapHasher> IntTools_DataMapOfSurfaceSampleBox;
|
||||
typedef NCollection_DataMap<IntTools_SurfaceRangeSample,Bnd_Box,IntTools_SurfaceRangeSampleMapHasher>::Iterator IntTools_DataMapIteratorOfDataMapOfSurfaceSampleBox;
|
||||
typedef NCollection_DataMap<IntTools_SurfaceRangeSample,Bnd_Box> IntTools_DataMapOfSurfaceSampleBox;
|
||||
typedef NCollection_DataMap<IntTools_SurfaceRangeSample,Bnd_Box>::Iterator IntTools_DataMapIteratorOfDataMapOfSurfaceSampleBox;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -391,7 +391,7 @@ void IntTools_FaceFace::Perform (const TopoDS_Face& aF1,
|
||||
aItP2S.Initialize(myListOfPnts);
|
||||
for (; aItP2S.More(); aItP2S.Next())
|
||||
{
|
||||
IntSurf_PntOn2S& aP2S=aItP2S.Value();
|
||||
IntSurf_PntOn2S& aP2S=aItP2S.ChangeValue();
|
||||
aP2S.Parameters(aU1,aV1,aU2,aV2);
|
||||
aP2S.SetValue(aU2,aV2,aU1,aV1);
|
||||
}
|
||||
|
@@ -17,11 +17,10 @@
|
||||
#define IntTools_MapOfCurveSample_HeaderFile
|
||||
|
||||
#include <IntTools_CurveRangeSample.hxx>
|
||||
#include <IntTools_CurveRangeSampleMapHasher.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
typedef NCollection_Map<IntTools_CurveRangeSample,IntTools_CurveRangeSampleMapHasher> IntTools_MapOfCurveSample;
|
||||
typedef NCollection_Map<IntTools_CurveRangeSample,IntTools_CurveRangeSampleMapHasher>::Iterator IntTools_MapIteratorOfMapOfCurveSample;
|
||||
typedef NCollection_Map<IntTools_CurveRangeSample> IntTools_MapOfCurveSample;
|
||||
typedef NCollection_Map<IntTools_CurveRangeSample>::Iterator IntTools_MapIteratorOfMapOfCurveSample;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -17,11 +17,10 @@
|
||||
#define IntTools_MapOfSurfaceSample_HeaderFile
|
||||
|
||||
#include <IntTools_SurfaceRangeSample.hxx>
|
||||
#include <IntTools_SurfaceRangeSampleMapHasher.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
typedef NCollection_Map<IntTools_SurfaceRangeSample,IntTools_SurfaceRangeSampleMapHasher> IntTools_MapOfSurfaceSample;
|
||||
typedef NCollection_Map<IntTools_SurfaceRangeSample,IntTools_SurfaceRangeSampleMapHasher>::Iterator IntTools_MapIteratorOfMapOfSurfaceSample;
|
||||
typedef NCollection_Map<IntTools_SurfaceRangeSample> IntTools_MapOfSurfaceSample;
|
||||
typedef NCollection_Map<IntTools_SurfaceRangeSample>::Iterator IntTools_MapIteratorOfMapOfSurfaceSample;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -90,6 +90,10 @@ IntTools_SurfaceRangeSample& operator = (const IntTools_SurfaceRangeSample& Othe
|
||||
|
||||
Standard_Integer GetRangeIndexVDeeper (const Standard_Integer theNbSampleV) const;
|
||||
|
||||
bool operator==(const IntTools_SurfaceRangeSample& theOther) const
|
||||
{
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -13,6 +13,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Standard_HashUtils.hxx>
|
||||
|
||||
inline void IntTools_SurfaceRangeSample::SetRanges(const IntTools_CurveRangeSample& theRangeU,
|
||||
const IntTools_CurveRangeSample& theRangeV)
|
||||
{
|
||||
@@ -138,3 +140,18 @@ inline Standard_Integer IntTools_SurfaceRangeSample::GetRangeIndexVDeeper(const
|
||||
{
|
||||
return myRangeV.GetRangeIndexDeeper(theNbSampleV);
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<IntTools_SurfaceRangeSample>
|
||||
{
|
||||
size_t operator()(const IntTools_SurfaceRangeSample& theSurfaceRangeSample) const noexcept
|
||||
{
|
||||
// Combine two int values into a single hash value.
|
||||
size_t aCombination[2]{ std::hash<IntTools_CurveRangeSample>{}(theSurfaceRangeSample.GetSampleRangeU()),
|
||||
std::hash<IntTools_CurveRangeSample>{}(theSurfaceRangeSample.GetSampleRangeV()) };
|
||||
return opencascade::hashBytes(aCombination, sizeof(aCombination));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -1,49 +0,0 @@
|
||||
// Created on: 2005-10-14
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _IntTools_SurfaceRangeSampleMapHasher_HeaderFile
|
||||
#define _IntTools_SurfaceRangeSampleMapHasher_HeaderFile
|
||||
|
||||
#include <IntTools_SurfaceRangeSample.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
class IntTools_SurfaceRangeSampleMapHasher
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Computes a hash code for the given key, in the range [1, theUpperBound]
|
||||
//! @param theKey the key which hash code is to be computed
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
static Standard_Integer HashCode (const IntTools_SurfaceRangeSample& theKey, Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode (theKey.GetIndexU() * theKey.GetIndexV(), theUpperBound);
|
||||
}
|
||||
|
||||
//! Returns True when the two keys are the same. Two
|
||||
//! same keys must have the same hashcode, the
|
||||
//! contrary is not necessary.
|
||||
static Standard_Boolean IsEqual (const IntTools_SurfaceRangeSample& S1, const IntTools_SurfaceRangeSample& S2)
|
||||
{
|
||||
return S1.IsEqual(S2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // _IntTools_SurfaceRangeSampleMapHasher_HeaderFile
|
Reference in New Issue
Block a user