mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0025309: Modeling Algorithms - Check of shape validity for BOP takes too long
Simplified condition to allow sampling for curve/surface data with depth == 0 Changed sorting method in MergeSolutions() method
This commit is contained in:
parent
9b9aac4a7b
commit
fbf9efb8d5
@ -52,6 +52,7 @@
|
|||||||
#include <TColStd_ListOfInteger.hxx>
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS_Face.hxx>
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <NCollection_IndexedMap.hxx>
|
||||||
|
|
||||||
static Standard_Boolean SetEmptyResultRange(const Standard_Real theParameter,
|
static Standard_Boolean SetEmptyResultRange(const Standard_Real theParameter,
|
||||||
IntTools_MarkedRangeSet& theMarkedRange);
|
IntTools_MarkedRangeSet& theMarkedRange);
|
||||||
@ -2331,27 +2332,44 @@ void BuildBox(const Handle(Geom_BSplineSurface) &theSurf,
|
|||||||
static void MergeSolutions(const IntTools_ListOfCurveRangeSample& theListCurveRange,
|
static void MergeSolutions(const IntTools_ListOfCurveRangeSample& theListCurveRange,
|
||||||
const IntTools_ListOfSurfaceRangeSample& theListSurfaceRange,
|
const IntTools_ListOfSurfaceRangeSample& theListSurfaceRange,
|
||||||
IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
|
IntTools_ListOfCurveRangeSample& theListCurveRangeSort,
|
||||||
IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort) {
|
IntTools_ListOfSurfaceRangeSample& theListSurfaceRangeSort)
|
||||||
|
{
|
||||||
|
NCollection_IndexedMap<IntTools_SurfaceRangeSample, IntTools_SurfaceRangeSampleMapHasher> aMapToAvoid;
|
||||||
|
|
||||||
IntTools_ListIteratorOfListOfCurveRangeSample anItC2;
|
NCollection_DataMap<Standard_Integer, TColStd_ListOfInteger> aCurveIdMap;
|
||||||
IntTools_ListIteratorOfListOfSurfaceRangeSample anItS1(theListSurfaceRange), anItS2;
|
std::vector<IntTools_CurveRangeSample> aCurveRangeVector;
|
||||||
IntTools_MapOfSurfaceSample aMapToAvoid;
|
aCurveRangeVector.reserve(theListCurveRange.Size());
|
||||||
|
|
||||||
for(; anItS1.More(); anItS1.Next()) {
|
IntTools_ListIteratorOfListOfCurveRangeSample anItC(theListCurveRange);
|
||||||
const IntTools_SurfaceRangeSample& aRangeS = anItS1.Value();
|
IntTools_ListIteratorOfListOfSurfaceRangeSample anItS(theListSurfaceRange);
|
||||||
|
|
||||||
if(aMapToAvoid.Contains(aRangeS))
|
Standard_Integer aCurveRangeId = 0;
|
||||||
continue;
|
Standard_Integer aSurfRangeSize = 0;
|
||||||
aMapToAvoid.Add(aRangeS);
|
for (; anItS.More() && anItC.More(); anItS.Next(), anItC.Next(), ++aCurveRangeId)
|
||||||
|
{
|
||||||
anItC2.Initialize(theListCurveRange);
|
aCurveRangeVector.push_back(anItC.Value());
|
||||||
anItS2.Initialize(theListSurfaceRange);
|
Standard_Integer aSurfIndex = aMapToAvoid.Add(anItS.Value());
|
||||||
|
if (aSurfIndex > aSurfRangeSize)
|
||||||
for(; anItS2.More() && anItC2.More(); anItS2.Next(), anItC2.Next()) {
|
{
|
||||||
if(aRangeS.IsEqual(anItS2.Value())) {
|
aCurveIdMap.Bound(aSurfIndex, TColStd_ListOfInteger())->Append(aCurveRangeId);
|
||||||
theListCurveRangeSort.Append(anItC2.Value());
|
++aSurfRangeSize;
|
||||||
theListSurfaceRangeSort.Append(anItS2.Value());
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aCurveIdMap.ChangeFind(aSurfIndex).Append(aCurveRangeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Standard_Integer i = 1; i <= aMapToAvoid.Size(); i++)
|
||||||
|
{
|
||||||
|
const IntTools_SurfaceRangeSample& aSurfRange = aMapToAvoid(i);
|
||||||
|
const TColStd_ListOfInteger& aCurveRangeList = aCurveIdMap(i);
|
||||||
|
for (TColStd_ListOfInteger::Iterator anIter(aCurveRangeList); anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
const IntTools_CurveRangeSample& aCurveRange = aCurveRangeVector[anIter.Value()];
|
||||||
|
|
||||||
|
theListSurfaceRangeSort.Append(aSurfRange);
|
||||||
|
theListCurveRangeSort.Append(aCurveRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2376,20 +2394,25 @@ static void CheckSampling(const IntTools_CurveRangeSample& theCurveRange,
|
|||||||
bAllowSamplingU = Standard_True;
|
bAllowSamplingU = Standard_True;
|
||||||
bAllowSamplingV = Standard_True;
|
bAllowSamplingV = Standard_True;
|
||||||
|
|
||||||
|
Standard_Integer aSamplesNb = theCurveRange.GetDepth() == 0 ? 1 : theCurveData.GetNbSample();
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if((pow((Standard_Real)theCurveData.GetNbSample(), (Standard_Real )(theCurveRange.GetDepth() + 1)) > dLimit) ||
|
if((pow((Standard_Real)theCurveData.GetNbSample(), (Standard_Real )(theCurveRange.GetDepth() + 1)) > dLimit) ||
|
||||||
((DiffC / theCurveData.GetNbSample()) < theCurveData.GetMinRange())) {
|
((DiffC / (Standard_Real)aSamplesNb) < theCurveData.GetMinRange())) {
|
||||||
bAllowSamplingC = Standard_False;
|
bAllowSamplingC = Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aSamplesNb = theSurfaceRange.GetDepthU() == 0 ? 1 : theSurfaceData.GetNbSampleU();
|
||||||
|
|
||||||
if((pow((Standard_Real )theSurfaceData.GetNbSampleU(), (Standard_Real )(theSurfaceRange.GetDepthU() + 1)) > dLimit) ||
|
if((pow((Standard_Real )theSurfaceData.GetNbSampleU(), (Standard_Real )(theSurfaceRange.GetDepthU() + 1)) > dLimit) ||
|
||||||
((DiffU / theSurfaceData.GetNbSampleU()) < theSurfaceData.GetMinRangeU())) {
|
((DiffU / (Standard_Real)aSamplesNb) < theSurfaceData.GetMinRangeU())) {
|
||||||
bAllowSamplingU = Standard_False;
|
bAllowSamplingU = Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aSamplesNb = theSurfaceRange.GetDepthV() == 0 ? 1 : theSurfaceData.GetNbSampleV();
|
||||||
|
|
||||||
if((pow((Standard_Real )theSurfaceData.GetNbSampleV(), (Standard_Real )(theSurfaceRange.GetDepthV() + 1)) > dLimit) ||
|
if((pow((Standard_Real )theSurfaceData.GetNbSampleV(), (Standard_Real )(theSurfaceRange.GetDepthV() + 1)) > dLimit) ||
|
||||||
((DiffV / theSurfaceData.GetNbSampleV()) < theSurfaceData.GetMinRangeV())) {
|
((DiffV / (Standard_Real)aSamplesNb) < theSurfaceData.GetMinRangeV())) {
|
||||||
bAllowSamplingV = Standard_False;
|
bAllowSamplingV = Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
tests/bugs/modalg_7/bug25309
Normal file
10
tests/bugs/modalg_7/bug25309
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "0025309: Modeling Algorithms - Check of shape validity for BOP takes too long"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
cpulimit 60
|
||||||
|
|
||||||
|
restore [locate_data_file bug25309.brep] a
|
||||||
|
|
||||||
|
bopargcheck a
|
Loading…
x
Reference in New Issue
Block a user