1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0026939: Configuration, NCollection_UBTreeFiller - do not use _REENTRANT in a header file

Use std::mt19937 random number generator instead of rand() in NCollection_UBTreeFiller.

boolean gdml_private ZI7 ZJ7 - TODO "bopcheck failed" is only for Linux now, checkshape faulty is unstable (issue #27052)
boolean volumemaker B6 - Added TODO (bopcheck and checkshape faulties)
boolean volumemaker C9 - Added TODO (checkprops and checkshape faulties)
boolean volumemaker D2 - Added TODO (checkshape faulty)
boolean volumemaker H4 - Added TODO (checkprops and checkshape faulties Linux only)
boolean volumemaker D5 - IMVPROVEMENT, TODOs were deleted (bopcheck and checkshape faulties)
bugs modalg_1 buc60462_2 - modified TODOs according to new behavior
boolean gdml_private ZI7 ZJ7 - unstable case, added check for surface area and TODO

samples/tcl/ANC101.tcl - amended due to changed order of edges in BOP result
This commit is contained in:
kgv 2016-01-22 15:55:55 +03:00 committed by abv
parent 9baa853415
commit 2674244cde
10 changed files with 36 additions and 47 deletions

View File

@ -264,11 +264,11 @@ bfuse _model _model t_s
explode _model e explode _model e
# Make a weld at joint edges of platform and wedge # Make a weld at joint edges of platform and wedge
blend _model _model 2 _model_26
blend _model _model 2 _model_27
blend _model _model 2 _model_28 blend _model _model 2 _model_28
blend _model _model 2 _model_29 blend _model _model 2 _model_29
blend _model _model 2 _model_30
blend _model _model 2 _model_31 blend _model _model 2 _model_31
blend _model _model 2 _model_33
# Cylinder on wedge # Cylinder on wedge
blend result _model 2 _model_161 blend result _model 2 _model_161

View File

@ -18,8 +18,8 @@
#include <NCollection_UBTree.hxx> #include <NCollection_UBTree.hxx>
#include <NCollection_Vector.hxx> #include <NCollection_Vector.hxx>
#include <stdlib.h>
#include <stdio.h> #include <random>
/** /**
* This class is used to fill an UBTree in a random order. * This class is used to fill an UBTree in a random order.
@ -69,15 +69,8 @@ template <class TheObjType, class TheBndType> class NCollection_UBTreeFiller
const Handle(NCollection_BaseAllocator)& theAlloc=0L, const Handle(NCollection_BaseAllocator)& theAlloc=0L,
const Standard_Boolean isFullRandom = Standard_True) const Standard_Boolean isFullRandom = Standard_True)
: myTree(theTree), mySeqPtr(1000, theAlloc), : myTree(theTree), mySeqPtr(1000, theAlloc),
mySeed(1), myIsFullRandom (isFullRandom) myRandGen (5489u /* == std::mt19937::default_seed, not defined in older environments, e.g, on Debian 6.0 with GCC 4.4.5 */),
{ myIsFullRandom (isFullRandom) {}
#ifndef _REENTRANT
// We use srand/rand for a single threaded application
// and rand_r for a multi threaded one.
// _REENTRANT must be defined for a multi threaded application.
srand (mySeed);
#endif
}
//! Adds a pair (theObj, theBnd) to my sequence //! Adds a pair (theObj, theBnd) to my sequence
void Add (const TheObjType& theObj, const TheBndType& theBnd) void Add (const TheObjType& theObj, const TheBndType& theBnd)
@ -137,22 +130,10 @@ template <class TheObjType, class TheBndType> class NCollection_UBTreeFiller
UBTree& myTree; UBTree& myTree;
NCollection_Vector<ObjBnd> mySeqPtr; NCollection_Vector<ObjBnd> mySeqPtr;
int mySeed; //!< seed for rand std::mt19937 myRandGen; //!< random number generator
Standard_Boolean myIsFullRandom; Standard_Boolean myIsFullRandom;
}; };
#ifdef _REENTRANT
inline int take_random (int * theSeed)
{
return rand_r ((unsigned *) theSeed);
}
#else
inline int take_random (int *)
{
return rand();
}
#endif
//======================================================================= //=======================================================================
//function : Fill //function : Fill
//purpose : //purpose :
@ -165,11 +146,7 @@ Standard_Integer NCollection_UBTreeFiller<TheObjType,TheBndType>::Fill ()
// Fisher-Yates randomization // Fisher-Yates randomization
if (myIsFullRandom) if (myIsFullRandom)
for (i = nbAdd; i > 0; i--) { for (i = nbAdd; i > 0; i--) {
unsigned int ind = take_random(&mySeed); unsigned int ind = myRandGen();
if (i > RAND_MAX) {
const unsigned int ind1 = take_random(&mySeed);
ind += (ind1 << 15);
}
ind = ind % i; ind = ind % i;
const ObjBnd& aObjBnd = mySeqPtr(ind); const ObjBnd& aObjBnd = mySeqPtr(ind);
myTree.Add (aObjBnd.myObj, aObjBnd.myBnd); myTree.Add (aObjBnd.myObj, aObjBnd.myBnd);
@ -177,7 +154,7 @@ Standard_Integer NCollection_UBTreeFiller<TheObjType,TheBndType>::Fill ()
} }
else else
for (i = nbAdd; i > 0; i--) { for (i = nbAdd; i > 0; i--) {
unsigned int ind = take_random(&mySeed); unsigned int ind = myRandGen();
ind = i - (ind % i) - 1; ind = i - (ind % i) - 1;
const ObjBnd& aObjBnd = mySeqPtr(ind); const ObjBnd& aObjBnd = mySeqPtr(ind);
myTree.Add (aObjBnd.myObj, aObjBnd.myBnd); myTree.Add (aObjBnd.myObj, aObjBnd.myBnd);

View File

@ -1,9 +1,12 @@
puts "TODO ?OCC27052 All: Faulty shapes in variables faulty_1 to" puts "TODO ?OCC27052 ALL: Faulty shapes in variables faulty_1 to"
puts "TODO OCC26018 ALL: bopcheck failed" puts "TODO OCC27052 Windows: Error : The command is not valid. The area is"
puts "TODO OCC27052 Windows: Error : The area of result shape is"
puts "TODO OCC26018 Linux: bopcheck failed"
source [locate_data_file mos2014-asm-scf-final.asm.1.gdml.tcl] source [locate_data_file mos2014-asm-scf-final.asm.1.gdml.tcl]
set bcheck [bopcheck result] set bcheck [bopcheck result]
puts $bcheck puts $bcheck
if {![regexp {This shape seems to be OK.} $bcheck]} { if {![regexp {This shape seems to be OK.} $bcheck]} {
puts "Error: bopcheck failed" puts "Error: bopcheck failed"
} }
checkprops result -s 618615

View File

@ -1,9 +1,12 @@
puts "TODO ?OCC27052 All: Faulty shapes in variables faulty_1 to" puts "TODO ?OCC27052 ALL: Faulty shapes in variables faulty_1 to"
puts "TODO OCC26018 ALL: bopcheck failed" puts "TODO OCC27052 Windows: Error : The command is not valid. The area is"
puts "TODO OCC27052 Windows: Error : The area of result shape is"
puts "TODO OCC26018 Linux: bopcheck failed"
source [locate_data_file mos2014-scf-final.prt.1.gdml.tcl] source [locate_data_file mos2014-scf-final.prt.1.gdml.tcl]
set bcheck [bopcheck result] set bcheck [bopcheck result]
puts $bcheck puts $bcheck
if {![regexp {This shape seems to be OK.} $bcheck]} { if {![regexp {This shape seems to be OK.} $bcheck]} {
puts "Error: bopcheck failed" puts "Error: bopcheck failed"
} }
checkprops result -s 618615

View File

@ -1,3 +1,6 @@
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC26020 ALL: Error: bopcheck failed"
# test script on make volume operation # test script on make volume operation
# plane # plane

View File

@ -1,3 +1,6 @@
puts "TODO OCC26020 ALL: Error : The area of result shape is"
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
# test script on make volume operation # test script on make volume operation
# cylinder plane unstable # cylinder plane unstable

View File

@ -1,3 +1,5 @@
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
# test script on make volume operation # test script on make volume operation
# cylinder plane unstable # cylinder plane unstable

View File

@ -1,9 +1,5 @@
# test script on make volume operation # test script on make volume operation
# cylinder plane # cylinder plane
puts "TODO OCC26020 Linux: Error: bopcheck failed"
puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to"
# planar face # planar face
plane pln_f1 0 -1450 -4.4408920985006262e-015 0 1 1.1102230246251565e-016 plane pln_f1 0 -1450 -4.4408920985006262e-015 0 1 1.1102230246251565e-016
erase pln_f1 erase pln_f1

View File

@ -1,3 +1,6 @@
puts "TODO OCC26020 Linux: Error : The area of result shape is"
puts "TODO OCC26020 Linux: Error: bopcheck failed"
# test script on make volume operation # test script on make volume operation
# cylinder plane # cylinder plane

View File

@ -1,6 +1,5 @@
#puts "TODO OCC27024 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO OCC27024 ALL: Error : operation bfuse is WRONG because number of SOLID entities in shape"
puts "TODO OCC27024 ALL: Tcl Exception: result is not a topological shape!!!" puts "TODO OCC27024 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC27024 All:TEST INCOMPLETE"
puts "==========" puts "=========="
puts "BUC60462" puts "BUC60462"