mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +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:
@@ -7,7 +7,6 @@ IntPolyh_ArrayOfTangentZones.hxx
|
||||
IntPolyh_ArrayOfTriangles.hxx
|
||||
IntPolyh_Couple.cxx
|
||||
IntPolyh_Couple.hxx
|
||||
IntPolyh_CoupleMapHasher.hxx
|
||||
IntPolyh_Edge.cxx
|
||||
IntPolyh_Edge.hxx
|
||||
IntPolyh_Intersection.cxx
|
||||
@@ -26,4 +25,4 @@ IntPolyh_StartPoint.hxx
|
||||
IntPolyh_Tools.cxx
|
||||
IntPolyh_Tools.hxx
|
||||
IntPolyh_Triangle.cxx
|
||||
IntPolyh_Triangle.hxx
|
||||
IntPolyh_Triangle.hxx
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_HashUtils.hxx>
|
||||
|
||||
//! The class represents the couple of indices with additional
|
||||
//! characteristics such as analyzed flag and an angle.<br>
|
||||
@@ -93,12 +94,10 @@ public:
|
||||
(myIndex1 == theOther.myIndex2 && myIndex2 == theOther.myIndex1);
|
||||
}
|
||||
|
||||
//! Computes a hash code for this couple, in the range [1, theUpperBound]
|
||||
//! @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]
|
||||
Standard_Integer HashCode (const Standard_Integer theUpperBound) const
|
||||
//! Returns true if the Couple is equal to <theOther>
|
||||
bool operator==(const IntPolyh_Couple& theOther) const
|
||||
{
|
||||
return ::HashCode (myIndex1 + myIndex2, theUpperBound);
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
||||
// Dump
|
||||
@@ -115,4 +114,22 @@ private:
|
||||
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<IntPolyh_Couple>
|
||||
{
|
||||
size_t operator()(const IntPolyh_Couple& theCouple) const noexcept
|
||||
{
|
||||
// Combine two int values into a single hash value.
|
||||
int aCombination[2]{ theCouple.FirstValue(), theCouple.SecondValue() };
|
||||
if (aCombination[0] > aCombination[1])
|
||||
{
|
||||
std::swap(aCombination[0], aCombination[1]);
|
||||
}
|
||||
return opencascade::hashBytes(aCombination, sizeof(aCombination));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _IntPolyh_Couple_HeaderFile
|
||||
|
@@ -1,48 +0,0 @@
|
||||
// Created by: Eugeny MALTCHIKOV
|
||||
// Copyright (c) 2017 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 _IntPolyh_CoupleMapHasher_HeaderFile
|
||||
#define _IntPolyh_CoupleMapHasher_HeaderFile
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <IntPolyh_Couple.hxx>
|
||||
|
||||
class IntPolyh_Couple;
|
||||
|
||||
class IntPolyh_CoupleMapHasher
|
||||
{
|
||||
public:
|
||||
|
||||
//! Computes a hash code for the given couple, in the range [1, theUpperBound]
|
||||
//! @param theCouple the couple 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 IntPolyh_Couple& theCouple, const Standard_Integer theUpperBound)
|
||||
{
|
||||
return theCouple.HashCode (theUpperBound);
|
||||
}
|
||||
|
||||
static Standard_Boolean IsEqual(const IntPolyh_Couple& theCouple1,
|
||||
const IntPolyh_Couple& theCouple2)
|
||||
{
|
||||
return theCouple1.IsEqual(theCouple2);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // _IntPolyh_CoupleMapHasher_HeaderFile
|
@@ -20,7 +20,6 @@
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
|
||||
#include <IntPolyh_Couple.hxx>
|
||||
#include <IntPolyh_CoupleMapHasher.hxx>
|
||||
#include <IntPolyh_MaillageAffinage.hxx>
|
||||
#include <IntPolyh_SectionLine.hxx>
|
||||
#include <IntPolyh_StartPoint.hxx>
|
||||
@@ -419,7 +418,7 @@ void IntPolyh_Intersection::MergeCouples(IntPolyh_ListOfCouples &anArrayFF,
|
||||
IntPolyh_ListOfCouples &anArrayRR) const
|
||||
{
|
||||
// Fence map to remove from the lists the duplicating elements.
|
||||
NCollection_Map<IntPolyh_Couple, IntPolyh_CoupleMapHasher> aFenceMap;
|
||||
NCollection_Map<IntPolyh_Couple> aFenceMap;
|
||||
//
|
||||
IntPolyh_ListOfCouples* pLists[4] = {&anArrayFF, &anArrayFR, &anArrayRF, &anArrayRR};
|
||||
for (Standard_Integer i = 0; i < 4; ++i) {
|
||||
|
@@ -47,8 +47,7 @@
|
||||
typedef NCollection_Array1<Standard_Integer> IntPolyh_ArrayOfInteger;
|
||||
typedef NCollection_IndexedDataMap
|
||||
<Standard_Integer,
|
||||
TColStd_ListOfInteger,
|
||||
TColStd_MapIntegerHasher> IntPolyh_IndexedDataMapOfIntegerListOfInteger;
|
||||
TColStd_ListOfInteger> IntPolyh_IndexedDataMapOfIntegerListOfInteger;
|
||||
|
||||
|
||||
static Standard_Real MyTolerance=10.0e-7;
|
||||
|
@@ -36,6 +36,11 @@ public:
|
||||
Standard_EXPORT IntPolyh_SectionLine();
|
||||
|
||||
Standard_EXPORT IntPolyh_SectionLine(const Standard_Integer nn);
|
||||
|
||||
IntPolyh_SectionLine(const IntPolyh_SectionLine& theOther)
|
||||
{
|
||||
Copy(theOther);
|
||||
}
|
||||
|
||||
Standard_EXPORT void Init (const Standard_Integer nn);
|
||||
|
||||
|
Reference in New Issue
Block a user