mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027490: BRepMesh: Reduce number of memory allocations
1) Reduce the number of calls to malloc by grouping requests to larger blocks. To achieve this goal, the following ways are used: - Containers of types sequence, list and map are initialized with an instance of NCollection_IncAllocator, at this taking care of the time of life of allocated objects, so that not to occupy huge amount of memory. - Allocation of several arrays having the same and short life time is changed so that to allocate a buffer array of necessary size and to place arrays in this buffer. 2) In BRepMesh_FastDiscretFace, optimize the function filterParameters so that to avoid excess memory allocations. 3) In NCollection_CellFilter, change declaration of the method Reset to accept array by reference rather than by value. 4) Add Allocator() method in map, sequence and vector collection classes by analogy with list collection. 5) Correct the size of block for IncAllocator for x64 platform. In order free-ed block to be returned to the system its size should be at least 1024K on x64 and 512K on x86. This allows to retain free virtual space almost to the state before algorithm run. 6) Decrease amount of memory zeroed by calloc. For that, reduce theIncrement parameter of the embedded vectors of the classes NCollection_UBTreeFiller and BRepMesh_VertexInspector to default value 256. 7) Avoid computing bounding box when not necessary (if no relative deflection is used) 8) Cycles by wires of face using TopExp_Explorer are converted to use TopoDS_Iterator instead. 9) BRepMesh_FastDiscret::Add optimized to avoid storing sequences of faces and edges 10) The tests "mesh standard_* W7" are corrected to accept the new behavior. Earlier the following error took place: Not connected mesh inside face 9 {12 13} Now this error was replaced with another one: free nodes (in pairs: face / node): {9 12} Actually it is not a regression, rather improvement, if we look at the snapshot. 11) Change other test cases to their actual state.
This commit is contained in:
parent
f02e43eb35
commit
e1c1b6b9f4
@ -846,16 +846,19 @@ Standard_Integer Adaptor3d_CurveOnSurface::NbIntervals (const GeomAbs_Shape S) c
|
|||||||
Standard_Integer nu,nv,nc;
|
Standard_Integer nu,nv,nc;
|
||||||
nu=mySurface->NbUIntervals(S);
|
nu=mySurface->NbUIntervals(S);
|
||||||
nv=mySurface->NbVIntervals(S);
|
nv=mySurface->NbVIntervals(S);
|
||||||
|
nc=myCurve->NbIntervals(S);
|
||||||
|
|
||||||
|
// Allocate the memory for arrays TabU, TabV, TabC only once using the buffer TabBuf.
|
||||||
|
TColStd_Array1OfReal TabBuf(1, nu + nv + nc + 3);
|
||||||
|
TColStd_Array1OfReal TabU(TabBuf(1), 1, nu+1);
|
||||||
|
TColStd_Array1OfReal TabV(TabBuf(nu + 2), 1, nv+1);
|
||||||
|
TColStd_Array1OfReal TabC(TabBuf(nu + nv + 3), 1, nc+1);
|
||||||
|
|
||||||
TColStd_Array1OfReal TabU(1,nu+1);
|
|
||||||
TColStd_Array1OfReal TabV(1,nv+1);
|
|
||||||
Standard_Integer NbSample = 20;
|
Standard_Integer NbSample = 20;
|
||||||
Standard_Real U,V,Tdeb,Tfin;
|
Standard_Real U,V,Tdeb,Tfin;
|
||||||
Tdeb=myCurve->FirstParameter();
|
Tdeb=myCurve->FirstParameter();
|
||||||
Tfin=myCurve->LastParameter();
|
Tfin=myCurve->LastParameter();
|
||||||
|
|
||||||
nc=myCurve->NbIntervals(S);
|
|
||||||
TColStd_Array1OfReal TabC(1,nc+1);
|
|
||||||
myCurve->Intervals(TabC,S);
|
myCurve->Intervals(TabC,S);
|
||||||
|
|
||||||
Standard_Real Tol= Precision::PConfusion()/10;
|
Standard_Real Tol= Precision::PConfusion()/10;
|
||||||
|
@ -2006,18 +2006,17 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
|
|||||||
TopTools_ListOfShape& LF)
|
TopTools_ListOfShape& LF)
|
||||||
{
|
{
|
||||||
LF.Clear();
|
LF.Clear();
|
||||||
TopTools_ListOfShape LTri,LPlan,LCyl,LCon,LSphere,LTor,LOther;
|
// Use the allocator of the result LF for intermediate results
|
||||||
|
TopTools_ListOfShape LTri(LF.Allocator()), LPlan(LF.Allocator()),
|
||||||
|
LCyl(LF.Allocator()), LCon(LF.Allocator()), LSphere(LF.Allocator()),
|
||||||
|
LTor(LF.Allocator()), LOther(LF.Allocator());
|
||||||
TopExp_Explorer exp(Sh,TopAbs_FACE);
|
TopExp_Explorer exp(Sh,TopAbs_FACE);
|
||||||
TopLoc_Location l;
|
TopLoc_Location l;
|
||||||
Handle(Geom_Surface) S;
|
|
||||||
|
|
||||||
for (; exp.More(); exp.Next()) {
|
for (; exp.More(); exp.Next()) {
|
||||||
const TopoDS_Face& F = TopoDS::Face(exp.Current());
|
const TopoDS_Face& F = TopoDS::Face(exp.Current());
|
||||||
S = BRep_Tool::Surface(F, l);
|
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F, l);
|
||||||
if (!S.IsNull()) {
|
if (!S.IsNull()) {
|
||||||
if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
|
||||||
S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
|
|
||||||
}
|
|
||||||
GeomAdaptor_Surface AS(S);
|
GeomAdaptor_Surface AS(S);
|
||||||
switch (AS.GetType()) {
|
switch (AS.GetType()) {
|
||||||
case GeomAbs_Plane:
|
case GeomAbs_Plane:
|
||||||
|
@ -56,8 +56,16 @@ class BRepMesh_VertexTool;
|
|||||||
|
|
||||||
namespace BRepMesh
|
namespace BRepMesh
|
||||||
{
|
{
|
||||||
//! Default size for memory block allocated by IncAllocator.
|
//! Default size for memory block allocated by IncAllocator.
|
||||||
|
/**
|
||||||
|
* The idea here is that blocks of the given size are returned to the system
|
||||||
|
* rather than retained in the malloc heap, at least on WIN32 and WIN64 platforms.
|
||||||
|
*/
|
||||||
|
#ifdef _WIN64
|
||||||
|
const size_t MEMORY_BLOCK_SIZE_HUGE = 1024 * 1024;
|
||||||
|
#else
|
||||||
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
|
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
|
||||||
|
#endif
|
||||||
|
|
||||||
//! Structure keeping parameters of segment.
|
//! Structure keeping parameters of segment.
|
||||||
struct Segment
|
struct Segment
|
||||||
|
@ -35,7 +35,8 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(
|
|||||||
const Handle(NCollection_IncAllocator)& theAllocator,
|
const Handle(NCollection_IncAllocator)& theAllocator,
|
||||||
const Standard_Integer theReservedNodeSize)
|
const Standard_Integer theReservedNodeSize)
|
||||||
: myAllocator (theAllocator),
|
: myAllocator (theAllocator),
|
||||||
myNodes (new BRepMesh_VertexTool(theReservedNodeSize, myAllocator)),
|
myNodes (new BRepMesh_VertexTool(myAllocator)),
|
||||||
|
myNodeLinks (theReservedNodeSize * 3, myAllocator),
|
||||||
myLinks (theReservedNodeSize * 3, myAllocator),
|
myLinks (theReservedNodeSize * 3, myAllocator),
|
||||||
myDelLinks (myAllocator),
|
myDelLinks (myAllocator),
|
||||||
myElements (theReservedNodeSize * 2, myAllocator),
|
myElements (theReservedNodeSize * 2, myAllocator),
|
||||||
|
@ -429,8 +429,6 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
|||||||
Handle(NCollection_IncAllocator) aAllocator =
|
Handle(NCollection_IncAllocator) aAllocator =
|
||||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||||
|
|
||||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
|
||||||
|
|
||||||
Standard_Real aTolU, aTolV;
|
Standard_Real aTolU, aTolV;
|
||||||
myMeshData->Data()->GetTolerance(aTolU, aTolV);
|
myMeshData->Data()->GetTolerance(aTolU, aTolV);
|
||||||
const Standard_Real aSqTol = aTolU * aTolU + aTolV * aTolV;
|
const Standard_Real aSqTol = aTolU * aTolU + aTolV * aTolV;
|
||||||
@ -442,8 +440,8 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
|||||||
Standard_Integer anUpper = theVertexIndexes.Upper();
|
Standard_Integer anUpper = theVertexIndexes.Upper();
|
||||||
for( ; anIndex <= anUpper; ++anIndex )
|
for( ; anIndex <= anUpper; ++anIndex )
|
||||||
{
|
{
|
||||||
aLoopEdges.Clear();
|
|
||||||
aAllocator->Reset(Standard_False);
|
aAllocator->Reset(Standard_False);
|
||||||
|
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||||
|
|
||||||
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
|
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
|
||||||
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
|
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
|
||||||
@ -598,6 +596,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
|||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
aAllocator->Reset(Standard_False);
|
||||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||||
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
|
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
|
||||||
|
|
||||||
@ -679,7 +678,6 @@ void BRepMesh_Delaun::cleanupMesh()
|
|||||||
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
|
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
|
||||||
}
|
}
|
||||||
|
|
||||||
aAllocator->Reset(Standard_False);
|
|
||||||
if ( aDeletedTrianglesNb == 0 )
|
if ( aDeletedTrianglesNb == 0 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2173,7 +2171,8 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
|
|||||||
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
|
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
|
||||||
const BRepMesh_DegreeOfFreedom theEdgeType ) const
|
const BRepMesh_DegreeOfFreedom theEdgeType ) const
|
||||||
{
|
{
|
||||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger;
|
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||||
|
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
|
||||||
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
|
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
|
||||||
|
|
||||||
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
|
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -141,14 +140,12 @@ void BRepMesh_FaceAttribute::init()
|
|||||||
// between vertices
|
// between vertices
|
||||||
|
|
||||||
myMinStep = RealLast();
|
myMinStep = RealLast();
|
||||||
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
|
for (TopoDS_Iterator aFaceIt(myFace); aFaceIt.More(); aFaceIt.Next())
|
||||||
{
|
{
|
||||||
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
|
for (TopoDS_Iterator aWireIt(aFaceIt.Value()); aWireIt.More(); aWireIt.Next())
|
||||||
|
|
||||||
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
|
|
||||||
{
|
{
|
||||||
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
|
const TopoDS_Edge& anEdge = TopoDS::Edge(aWireIt.Value());
|
||||||
if (BRep_Tool::IsClosed(anEdge))
|
if (anEdge.IsNull() || BRep_Tool::IsClosed(anEdge))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Get end points on 2d curve
|
// Get end points on 2d curve
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <Extrema_LocateExtPC.hxx>
|
#include <Extrema_LocateExtPC.hxx>
|
||||||
|
|
||||||
#include <TColStd_Array1OfInteger.hxx>
|
#include <TColStd_Array1OfInteger.hxx>
|
||||||
|
#include <TColStd_Array1OfCharacter.hxx>
|
||||||
#include <TColStd_HArray1OfReal.hxx>
|
#include <TColStd_HArray1OfReal.hxx>
|
||||||
#include <TColgp_Array1OfPnt2d.hxx>
|
#include <TColgp_Array1OfPnt2d.hxx>
|
||||||
#include <TColGeom2d_SequenceOfCurve.hxx>
|
#include <TColGeom2d_SequenceOfCurve.hxx>
|
||||||
@ -82,6 +83,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret,Standard_Transient)
|
|||||||
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
|
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
|
||||||
const BRepMesh_FastDiscret::Parameters& theParams)
|
const BRepMesh_FastDiscret::Parameters& theParams)
|
||||||
:
|
:
|
||||||
|
myMapdefle(1000, new NCollection_IncAllocator()),
|
||||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||||
myParameters(theParams),
|
myParameters(theParams),
|
||||||
@ -195,7 +197,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
|
|
||||||
resetDataStructure();
|
resetDataStructure();
|
||||||
|
|
||||||
Standard_Real defedge;
|
Standard_Real defedge = myParameters.Deflection;
|
||||||
Standard_Integer nbEdge = 0;
|
Standard_Integer nbEdge = 0;
|
||||||
Standard_Real savangle = myParameters.Angle;
|
Standard_Real savangle = myParameters.Angle;
|
||||||
Standard_Real cdef;
|
Standard_Real cdef;
|
||||||
@ -205,18 +207,14 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
if (!myParameters.Relative)
|
if (!myParameters.Relative)
|
||||||
defface = Max(myParameters.Deflection, maxdef);
|
defface = Max(myParameters.Deflection, maxdef);
|
||||||
|
|
||||||
NCollection_Sequence<EdgePCurve> aPCurves;
|
|
||||||
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
|
|
||||||
|
|
||||||
const TopoDS_Face& aFace = myAttribute->Face();
|
const TopoDS_Face& aFace = myAttribute->Face();
|
||||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||||
TopExp_Explorer aWireIt(aFace, TopAbs_WIRE);
|
|
||||||
for (; aWireIt.More(); aWireIt.Next())
|
|
||||||
{
|
{
|
||||||
TopExp_Explorer aEdgeIt(aWireIt.Current(), TopAbs_EDGE);
|
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||||
for (; aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
|
||||||
{
|
{
|
||||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||||
|
if (aEdge.IsNull())
|
||||||
|
continue;
|
||||||
if (!myMapdefle.IsBound(aEdge))
|
if (!myMapdefle.IsBound(aEdge))
|
||||||
{
|
{
|
||||||
if (myParameters.Relative)
|
if (myParameters.Relative)
|
||||||
@ -265,8 +263,6 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
||||||
aPCurves.Append(aPCurve);
|
|
||||||
aFaceEdges.Append(aEdge);
|
|
||||||
|
|
||||||
add(aEdge, aPCurve, defedge);
|
add(aEdge, aPCurve, defedge);
|
||||||
myParameters.Angle = savangle;
|
myParameters.Angle = savangle;
|
||||||
@ -293,6 +289,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
|
|
||||||
TopLoc_Location aLoc;
|
TopLoc_Location aLoc;
|
||||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
|
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
|
||||||
|
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||||
|
|
||||||
if ( aTriangulation.IsNull() )
|
if ( aTriangulation.IsNull() )
|
||||||
{
|
{
|
||||||
@ -401,16 +398,29 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
++nbmaill;
|
++nbmaill;
|
||||||
|
|
||||||
resetDataStructure();
|
resetDataStructure();
|
||||||
for (Standard_Integer j = 1; j <= aFaceEdges.Length(); ++j)
|
|
||||||
|
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||||
{
|
{
|
||||||
const TopoDS_Edge& anEdge = aFaceEdges(j);
|
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||||
if (myEdges.IsBound(anEdge))
|
{
|
||||||
myEdges.UnBind(anEdge);
|
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||||
|
if (anEdge.IsNull())
|
||||||
|
continue;
|
||||||
|
if (myEdges.IsBound(anEdge))
|
||||||
|
myEdges.UnBind(anEdge);
|
||||||
|
|
||||||
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
|
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
|
||||||
myMapdefle.Bind(anEdge, defedge);
|
myMapdefle.Bind(anEdge, defedge);
|
||||||
|
|
||||||
add(anEdge, aPCurves(j), defedge);
|
Standard_Real aFirstParam, aLastParam;
|
||||||
|
Handle(Geom2d_Curve) aCurve2d =
|
||||||
|
BRep_Tool::CurveOnSurface(anEdge, aFace, aFirstParam, aLastParam);
|
||||||
|
if (aCurve2d.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
||||||
|
add(anEdge, aPCurve, defedge);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aDFaceChecker.ReCompute(aClassifier);
|
aDFaceChecker.ReCompute(aClassifier);
|
||||||
@ -806,18 +816,13 @@ void BRepMesh_FastDiscret::update(
|
|||||||
Handle(Poly_PolygonOnTriangulation) P1, P2;
|
Handle(Poly_PolygonOnTriangulation) P1, P2;
|
||||||
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
|
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
|
||||||
{
|
{
|
||||||
const Standard_Integer aNodesNb = 2;
|
// two nodes
|
||||||
TColStd_Array1OfInteger aNewNodes (1, aNodesNb);
|
Standard_Integer aNewNodesArr[] = {isvf, isvl};
|
||||||
TColStd_Array1OfInteger aNewNodInStruct(1, aNodesNb);
|
Standard_Integer aNewNodInStructArr[] = {ipf, ipl};
|
||||||
TColStd_Array1OfReal aNewParams (1, aNodesNb);
|
Standard_Real aNewParamsArr[] = {aEAttr.FirstParam, aEAttr.LastParam};
|
||||||
|
TColStd_Array1OfInteger aNewNodes (aNewNodesArr[0], 1, 2);
|
||||||
aNewNodInStruct(1) = ipf;
|
TColStd_Array1OfInteger aNewNodInStruct(aNewNodInStructArr[0], 1, 2);
|
||||||
aNewNodes (1) = isvf;
|
TColStd_Array1OfReal aNewParams (aNewParamsArr[0], 1, 2);
|
||||||
aNewParams (1) = aEAttr.FirstParam;
|
|
||||||
|
|
||||||
aNewNodInStruct(aNodesNb) = ipl;
|
|
||||||
aNewNodes (aNodesNb) = isvl;
|
|
||||||
aNewParams (aNodesNb) = aEAttr.LastParam;
|
|
||||||
|
|
||||||
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
|
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
|
||||||
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
|
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
|
||||||
@ -825,9 +830,15 @@ void BRepMesh_FastDiscret::update(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
|
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
|
||||||
TColStd_Array1OfInteger aNewNodesVec (1, aNodesNb);
|
// Allocate the memory for arrays aNewNodesVec, aNewNodesInStructVec, aNewParamsVec
|
||||||
TColStd_Array1OfInteger aNewNodesInStructVec(1, aNodesNb);
|
// only once using the buffer aBuf.
|
||||||
TColStd_Array1OfReal aNewParamsVec (1, aNodesNb);
|
TColStd_Array1OfCharacter aBuf(1, aNodesNb * (2*sizeof(Standard_Integer) + sizeof(Standard_Real)));
|
||||||
|
TColStd_Array1OfInteger aNewNodesVec(*reinterpret_cast<const Standard_Integer*>
|
||||||
|
(&aBuf(1)), 1, aNodesNb);
|
||||||
|
TColStd_Array1OfInteger aNewNodesInStructVec(*reinterpret_cast<const Standard_Integer*>
|
||||||
|
(&aBuf(1 + aNodesNb*sizeof(Standard_Integer))), 1, aNodesNb);
|
||||||
|
TColStd_Array1OfReal aNewParamsVec(*reinterpret_cast<const Standard_Real*>
|
||||||
|
(&aBuf(1 + aNodesNb*2*sizeof(Standard_Integer))), 1, aNodesNb);
|
||||||
|
|
||||||
Standard_Integer aNodesCount = 1;
|
Standard_Integer aNodesCount = 1;
|
||||||
aNewNodesInStructVec(aNodesCount) = ipf;
|
aNewNodesInStructVec(aNodesCount) = ipf;
|
||||||
|
@ -207,8 +207,8 @@ void BRepMesh_FastDiscretFace::initDataStructure()
|
|||||||
myStructure->Data()->SetTolerance( aTolU / deltaX, aTolV / deltaY);
|
myStructure->Data()->SetTolerance( aTolU / deltaX, aTolV / deltaY);
|
||||||
|
|
||||||
myAttribute->ChangeStructure() = myStructure;
|
myAttribute->ChangeStructure() = myStructure;
|
||||||
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt;
|
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt(1, aAllocator);
|
||||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger;
|
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger(1, aAllocator);
|
||||||
|
|
||||||
// Check the necessity to fill the map of parameters
|
// Check the necessity to fill the map of parameters
|
||||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||||
@ -217,8 +217,8 @@ void BRepMesh_FastDiscretFace::initDataStructure()
|
|||||||
thetype == GeomAbs_BSplineSurface);
|
thetype == GeomAbs_BSplineSurface);
|
||||||
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
|
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
|
||||||
|
|
||||||
myUParam.Clear();
|
myUParam.Clear(aAllocator);
|
||||||
myVParam.Clear();
|
myVParam.Clear(aAllocator);
|
||||||
|
|
||||||
// essai de determination de la longueur vraie:
|
// essai de determination de la longueur vraie:
|
||||||
// akm (bug OCC16) : We must calculate these measures in non-singular
|
// akm (bug OCC16) : We must calculate these measures in non-singular
|
||||||
@ -393,7 +393,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
|
|||||||
Standard_Real aDef = -1;
|
Standard_Real aDef = -1;
|
||||||
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
|
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
|
||||||
{
|
{
|
||||||
BRepMesh::ListOfVertex aNewVertices;
|
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||||
|
BRepMesh::ListOfVertex aNewVertices(anAlloc);
|
||||||
if (!rajout)
|
if (!rajout)
|
||||||
{
|
{
|
||||||
aDef = control(aNewVertices, trigu, Standard_True);
|
aDef = control(aNewVertices, trigu, Standard_True);
|
||||||
@ -463,8 +464,6 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
|||||||
BRepMesh::SequenceOfReal& theResult)
|
BRepMesh::SequenceOfReal& theResult)
|
||||||
{
|
{
|
||||||
// Sort sequence of parameters
|
// Sort sequence of parameters
|
||||||
BRepMesh::SequenceOfReal aParamTmp;
|
|
||||||
Standard_Integer aParamLength = 1;
|
|
||||||
const Standard_Integer anInitLen = theParams.Extent();
|
const Standard_Integer anInitLen = theParams.Extent();
|
||||||
|
|
||||||
TColStd_Array1OfReal aParamArray(1, anInitLen);
|
TColStd_Array1OfReal aParamArray(1, anInitLen);
|
||||||
@ -475,37 +474,26 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
|||||||
std::sort (aParamArray.begin(), aParamArray.end());
|
std::sort (aParamArray.begin(), aParamArray.end());
|
||||||
|
|
||||||
// mandatory pre-filtering using the first (minimal) filter value
|
// mandatory pre-filtering using the first (minimal) filter value
|
||||||
Standard_Real aP1, aP2;
|
Standard_Integer aParamLength = 1;
|
||||||
aP1 = aParamArray(1);
|
|
||||||
aParamTmp.Append(aP1);
|
|
||||||
for (j = 2; j <= anInitLen; j++)
|
for (j = 2; j <= anInitLen; j++)
|
||||||
{
|
{
|
||||||
aP2 = aParamArray(j);
|
if ((aParamArray(j)-aParamArray(aParamLength)) > theMinDist)
|
||||||
if ((aP2-aP1) > theMinDist)
|
|
||||||
{
|
{
|
||||||
aParamTmp.Append(aP2);
|
if (++aParamLength < j)
|
||||||
aP1 = aP2;
|
aParamArray(aParamLength) = aParamArray(j);
|
||||||
aParamLength++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//add last point if required
|
|
||||||
if(aParamArray(anInitLen)-theParams(aParamLength) > theMinDist)
|
|
||||||
{
|
|
||||||
aParamTmp.Append(aParamArray(anInitLen));
|
|
||||||
aParamLength++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//perform filtering on series
|
//perform filtering on series
|
||||||
Standard_Real aLastAdded, aLastCandidate;
|
Standard_Real aLastAdded, aLastCandidate;
|
||||||
Standard_Boolean isCandidateDefined = Standard_False;
|
Standard_Boolean isCandidateDefined = Standard_False;
|
||||||
aLastAdded = aParamTmp.First();
|
aLastAdded = aParamArray(1);
|
||||||
aLastCandidate = aLastAdded;
|
aLastCandidate = aLastAdded;
|
||||||
theResult.Append(aParamTmp.First());
|
theResult.Append(aLastAdded);
|
||||||
|
|
||||||
for(j=2;j<aParamTmp.Length();j++)
|
for(j=2; j < aParamLength; j++)
|
||||||
{
|
{
|
||||||
Standard_Real aVal = aParamTmp.Value(j);
|
Standard_Real aVal = aParamArray(j);
|
||||||
if(aVal-aLastAdded > theFilterDist)
|
if(aVal-aLastAdded > theFilterDist)
|
||||||
{
|
{
|
||||||
//adds the parameter
|
//adds the parameter
|
||||||
@ -525,7 +513,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
|||||||
aLastCandidate = aVal;
|
aLastCandidate = aVal;
|
||||||
isCandidateDefined = Standard_True;
|
isCandidateDefined = Standard_True;
|
||||||
}
|
}
|
||||||
theResult.Append(aParamTmp.Last());
|
theResult.Append(aParamArray(aParamLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BRepMesh_FastDiscretFace::insertInternalVertices(
|
void BRepMesh_FastDiscretFace::insertInternalVertices(
|
||||||
@ -842,7 +830,9 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
|||||||
const Standard_Real aDefFace = myAttribute->GetDefFace();
|
const Standard_Real aDefFace = myAttribute->GetDefFace();
|
||||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||||
|
|
||||||
BRepMesh::SequenceOfReal aParams[2];
|
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||||
|
BRepMesh::SequenceOfReal aParams[2] = { BRepMesh::SequenceOfReal(anAlloc),
|
||||||
|
BRepMesh::SequenceOfReal(anAlloc) };
|
||||||
for (Standard_Integer i = 0; i < 2; ++i)
|
for (Standard_Integer i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
Standard_Boolean isU = (i == 0);
|
Standard_Boolean isU = (i == 0);
|
||||||
@ -868,8 +858,10 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
|||||||
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
|
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
|
||||||
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
||||||
|
|
||||||
BRepMesh::MapOfReal aParamsToRemove[2];
|
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||||
BRepMesh::MapOfReal aParamsForbiddenToRemove[2];
|
BRepMesh::MapOfReal(1, anAlloc) };
|
||||||
|
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||||
|
BRepMesh::MapOfReal(1, anAlloc) };
|
||||||
|
|
||||||
// precision for compare square distances
|
// precision for compare square distances
|
||||||
const Standard_Real aPrecision = Precision::Confusion();
|
const Standard_Real aPrecision = Precision::Confusion();
|
||||||
@ -1043,7 +1035,8 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
|||||||
const Standard_Real theFaceDeflection,
|
const Standard_Real theFaceDeflection,
|
||||||
const BRepMesh_CircleTool& theCircleTool,
|
const BRepMesh_CircleTool& theCircleTool,
|
||||||
BRepMesh::ListOfVertex& theVertices,
|
BRepMesh::ListOfVertex& theVertices,
|
||||||
Standard_Real& theMaxTriangleDeflection)
|
Standard_Real& theMaxTriangleDeflection,
|
||||||
|
const Handle(NCollection_IncAllocator)& theTempAlloc)
|
||||||
{
|
{
|
||||||
if (theTriangleDeflection > theMaxTriangleDeflection)
|
if (theTriangleDeflection > theMaxTriangleDeflection)
|
||||||
theMaxTriangleDeflection = theTriangleDeflection;
|
theMaxTriangleDeflection = theTriangleDeflection;
|
||||||
@ -1058,9 +1051,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
|||||||
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
|
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
|
||||||
myAttribute->Scale(theUV, Standard_True));
|
myAttribute->Scale(theUV, Standard_True));
|
||||||
|
|
||||||
Handle(NCollection_IncAllocator) aAllocator =
|
BRepMesh::MapOfInteger aUsedNodes(10, theTempAlloc);
|
||||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
|
||||||
BRepMesh::MapOfInteger aUsedNodes(10, aAllocator);
|
|
||||||
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
|
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
|
||||||
for (; aCircleIt.More(); aCircleIt.Next())
|
for (; aCircleIt.More(); aCircleIt.Next())
|
||||||
{
|
{
|
||||||
@ -1118,9 +1109,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
|||||||
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
|
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
|
||||||
aBSpline = gFace->ChangeSurface ().Surface().Surface();
|
aBSpline = gFace->ChangeSurface ().Surface().Surface();
|
||||||
|
|
||||||
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
|
Handle(NCollection_IncAllocator) anAlloc =
|
||||||
BRepMesh::MapOfIntegerInteger aStatMap;
|
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||||
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb);
|
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap(1, anAlloc);
|
||||||
|
BRepMesh::MapOfIntegerInteger aStatMap(1, anAlloc);
|
||||||
|
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb, anAlloc);
|
||||||
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
|
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
|
||||||
|
|
||||||
// Perform refinement passes
|
// Perform refinement passes
|
||||||
@ -1131,8 +1124,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
|||||||
Standard_Real aMaxSqDef = -1.;
|
Standard_Real aMaxSqDef = -1.;
|
||||||
Standard_Integer aPass = 1, aInsertedNb = 1;
|
Standard_Integer aPass = 1, aInsertedNb = 1;
|
||||||
Standard_Boolean isAllDegenerated = Standard_False;
|
Standard_Boolean isAllDegenerated = Standard_False;
|
||||||
|
Handle(NCollection_IncAllocator) aTempAlloc =
|
||||||
|
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||||
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
|
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
|
||||||
{
|
{
|
||||||
|
aTempAlloc->Reset(Standard_False);
|
||||||
theNewVertices.Clear();
|
theNewVertices.Clear();
|
||||||
|
|
||||||
// Reset stop condition
|
// Reset stop condition
|
||||||
@ -1208,7 +1204,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
|||||||
aSqDef *= aSqDef;
|
aSqDef *= aSqDef;
|
||||||
|
|
||||||
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
|
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
|
||||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||||
|
|
||||||
if (isSkipped)
|
if (isSkipped)
|
||||||
break;
|
break;
|
||||||
@ -1242,7 +1238,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
|||||||
aSqDef = aLin.SquareDistance(pDef);
|
aSqDef = aLin.SquareDistance(pDef);
|
||||||
|
|
||||||
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
|
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
|
||||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1409,6 +1405,8 @@ void BRepMesh_FastDiscretFace::commitSurfaceTriangulation()
|
|||||||
BRepMesh_ShapeTool::AddInFace(aFace, aNewTriangulation);
|
BRepMesh_ShapeTool::AddInFace(aFace, aNewTriangulation);
|
||||||
|
|
||||||
// Delete unused data
|
// Delete unused data
|
||||||
|
myUParam.Clear(0L);
|
||||||
|
myVParam.Clear(0L);
|
||||||
myAttribute->ChangeStructure().Nullify();
|
myAttribute->ChangeStructure().Nullify();
|
||||||
myAttribute->ChangeSurfacePoints().Nullify();
|
myAttribute->ChangeSurfacePoints().Nullify();
|
||||||
myAttribute->ChangeSurfaceVertices().Nullify();
|
myAttribute->ChangeSurfaceVertices().Nullify();
|
||||||
|
@ -174,7 +174,8 @@ private:
|
|||||||
const Standard_Real theFaceDeflection,
|
const Standard_Real theFaceDeflection,
|
||||||
const BRepMesh_CircleTool& theCircleTool,
|
const BRepMesh_CircleTool& theCircleTool,
|
||||||
BRepMesh::ListOfVertex& theVertices,
|
BRepMesh::ListOfVertex& theVertices,
|
||||||
Standard_Real& theMaxTriangleDeflection);
|
Standard_Real& theMaxTriangleDeflection,
|
||||||
|
const Handle(NCollection_IncAllocator)& theTempAlloc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include <TColgp_Array1OfPnt.hxx>
|
#include <TColgp_Array1OfPnt.hxx>
|
||||||
#include <TColgp_Array1OfPnt2d.hxx>
|
#include <TColgp_Array1OfPnt2d.hxx>
|
||||||
#include <TColStd_Array1OfReal.hxx>
|
#include <TColStd_Array1OfReal.hxx>
|
||||||
|
#include <TColStd_MapOfTransient.hxx>
|
||||||
#include <TopTools_HArray1OfShape.hxx>
|
#include <TopTools_HArray1OfShape.hxx>
|
||||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||||
|
|
||||||
@ -125,8 +126,11 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepMesh_IncrementalMesh::clear()
|
void BRepMesh_IncrementalMesh::clear()
|
||||||
{
|
{
|
||||||
myEdges.Clear();
|
// the allocator will be alive while the structures are alive
|
||||||
myEdgeDeflection.Clear();
|
Handle(NCollection_IncAllocator) anAlloc =
|
||||||
|
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||||
|
myEdges.Clear(anAlloc);
|
||||||
|
myEdgeDeflection.Clear(anAlloc);
|
||||||
myFaces.Clear();
|
myFaces.Clear();
|
||||||
myMesh.Nullify();
|
myMesh.Nullify();
|
||||||
}
|
}
|
||||||
@ -146,15 +150,18 @@ void BRepMesh_IncrementalMesh::init()
|
|||||||
collectFaces();
|
collectFaces();
|
||||||
|
|
||||||
Bnd_Box aBox;
|
Bnd_Box aBox;
|
||||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
if ( myParameters.Relative )
|
||||||
|
|
||||||
if (aBox.IsVoid())
|
|
||||||
{
|
{
|
||||||
// Nothing to mesh.
|
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
if (aBox.IsVoid())
|
||||||
|
{
|
||||||
|
// Nothing to mesh.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||||
|
}
|
||||||
|
|
||||||
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
|
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
|
||||||
|
|
||||||
@ -167,22 +174,21 @@ void BRepMesh_IncrementalMesh::init()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepMesh_IncrementalMesh::collectFaces()
|
void BRepMesh_IncrementalMesh::collectFaces()
|
||||||
{
|
{
|
||||||
TopTools_ListOfShape aFaceList;
|
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||||
|
TopTools_ListOfShape aFaceList(anAlloc);
|
||||||
BRepLib::ReverseSortFaces(myShape, aFaceList);
|
BRepLib::ReverseSortFaces(myShape, aFaceList);
|
||||||
TopTools_MapOfShape aFaceMap;
|
TColStd_MapOfTransient aTFaceMap(1, anAlloc);
|
||||||
|
|
||||||
// make array of faces suitable for processing (excluding faces without surface)
|
// make array of faces suitable for processing (excluding faces without surface)
|
||||||
TopLoc_Location aDummyLoc;
|
TopLoc_Location aDummyLoc;
|
||||||
const TopLoc_Location aEmptyLoc;
|
|
||||||
TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
|
TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
|
||||||
for (; aFaceIter.More(); aFaceIter.Next())
|
for (; aFaceIter.More(); aFaceIter.Next())
|
||||||
{
|
{
|
||||||
TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
|
const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
|
||||||
aFaceNoLoc.Location(aEmptyLoc);
|
const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
|
||||||
if (!aFaceMap.Add (aFaceNoLoc))
|
if (!aTFaceMap.Add (aTFace))
|
||||||
continue; // already processed
|
continue; // already processed
|
||||||
|
|
||||||
TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
|
|
||||||
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
|
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
|
||||||
if (aSurf.IsNull())
|
if (aSurf.IsNull())
|
||||||
continue;
|
continue;
|
||||||
@ -282,8 +288,9 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
|
|||||||
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
||||||
const TopoDS_Edge& theEdge)
|
const TopoDS_Edge& theEdge)
|
||||||
{
|
{
|
||||||
if (myEdgeDeflection.IsBound(theEdge))
|
const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
|
||||||
return myEdgeDeflection(theEdge);
|
if (pDef)
|
||||||
|
return *pDef;
|
||||||
|
|
||||||
Standard_Real aEdgeDeflection;
|
Standard_Real aEdgeDeflection;
|
||||||
if ( myParameters.Relative )
|
if ( myParameters.Relative )
|
||||||
@ -329,7 +336,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
|||||||
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
|
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
|
||||||
{
|
{
|
||||||
if (!myEdges.IsBound(theEdge))
|
if (!myEdges.IsBound(theEdge))
|
||||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool());
|
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
|
||||||
|
|
||||||
Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
|
Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
|
||||||
// Check that triangulation relies to face of the given shape.
|
// Check that triangulation relies to face of the given shape.
|
||||||
|
@ -30,13 +30,11 @@ public:
|
|||||||
typedef Standard_Integer Target;
|
typedef Standard_Integer Target;
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
//! @param theReservedSize size to be reserved for vector of vertices.
|
|
||||||
//! @param theAllocator memory allocator to be used by internal collections.
|
//! @param theAllocator memory allocator to be used by internal collections.
|
||||||
Standard_EXPORT BRepMesh_VertexInspector (
|
Standard_EXPORT BRepMesh_VertexInspector (
|
||||||
const Standard_Integer theReservedSize,
|
|
||||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||||
: myResIndices(theAllocator),
|
: myResIndices(theAllocator),
|
||||||
myVertices (new BRepMesh::VectorOfVertex(theReservedSize)),
|
myVertices (new BRepMesh::VectorOfVertex),
|
||||||
myDelNodes (theAllocator)
|
myDelNodes (theAllocator)
|
||||||
{
|
{
|
||||||
SetTolerance( Precision::Confusion() );
|
SetTolerance( Precision::Confusion() );
|
||||||
|
@ -56,11 +56,10 @@ NCollection_CellFilter_Action BRepMesh_VertexInspector::Inspect(
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BRepMesh_VertexTool::BRepMesh_VertexTool(
|
BRepMesh_VertexTool::BRepMesh_VertexTool(
|
||||||
const Standard_Integer theReservedSize,
|
|
||||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||||
: myAllocator (theAllocator),
|
: myAllocator (theAllocator),
|
||||||
myCellFilter(0., myAllocator),
|
myCellFilter(0., myAllocator),
|
||||||
mySelector (Max(theReservedSize, 64),myAllocator)
|
mySelector (myAllocator)
|
||||||
{
|
{
|
||||||
const Standard_Real aTol = Precision::Confusion();
|
const Standard_Real aTol = Precision::Confusion();
|
||||||
SetCellSize ( aTol + 0.05 * aTol );
|
SetCellSize ( aTol + 0.05 * aTol );
|
||||||
|
@ -36,10 +36,8 @@ public:
|
|||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
//! @param theReservedSize size to be reserved for vector of vertices.
|
|
||||||
//! @param theAllocator memory allocator to be used by internal collections.
|
//! @param theAllocator memory allocator to be used by internal collections.
|
||||||
Standard_EXPORT BRepMesh_VertexTool(
|
Standard_EXPORT BRepMesh_VertexTool(
|
||||||
const Standard_Integer theReservedSize,
|
|
||||||
const Handle(NCollection_IncAllocator)& theAllocator);
|
const Handle(NCollection_IncAllocator)& theAllocator);
|
||||||
|
|
||||||
//! Sets new size of cell for cellfilter equal in both directions.
|
//! Sets new size of cell for cellfilter equal in both directions.
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
#include <BRepTools_WireExplorer.hxx>
|
#include <BRepTools_WireExplorer.hxx>
|
||||||
#include <TopAbs_Orientation.hxx>
|
#include <TopAbs_Orientation.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
#include <Poly_PolygonOnTriangulation.hxx>
|
#include <Poly_PolygonOnTriangulation.hxx>
|
||||||
#include <BRepMesh_PairOfPolygon.hxx>
|
#include <BRepMesh_PairOfPolygon.hxx>
|
||||||
#include <TColStd_SequenceOfInteger.hxx>
|
#include <TColStd_SequenceOfInteger.hxx>
|
||||||
@ -147,10 +148,11 @@ BRepMesh_WireChecker::BRepMesh_WireChecker(
|
|||||||
TopoDS_Face aFace = theFace;
|
TopoDS_Face aFace = theFace;
|
||||||
aFace.Orientation(TopAbs_FORWARD);
|
aFace.Orientation(TopAbs_FORWARD);
|
||||||
|
|
||||||
TopExp_Explorer aFaceExplorer(aFace, TopAbs_WIRE);
|
for (TopoDS_Iterator aFaceIt(aFace); aFaceIt.More(); aFaceIt.Next())
|
||||||
for (; aFaceExplorer.More(); aFaceExplorer.Next())
|
|
||||||
{
|
{
|
||||||
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceExplorer.Current());
|
if (aFaceIt.Value().IsNull() || aFaceIt.Value().ShapeType() != TopAbs_WIRE) // may be inner vertex
|
||||||
|
continue;
|
||||||
|
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceIt.Value());
|
||||||
|
|
||||||
myWiresEdges.Append(ListOfEdges());
|
myWiresEdges.Append(ListOfEdges());
|
||||||
ListOfEdges& aEdges = myWiresEdges.ChangeLast();
|
ListOfEdges& aEdges = myWiresEdges.ChangeLast();
|
||||||
|
@ -81,10 +81,8 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
|
|||||||
Standard_Integer Index1 = 0;
|
Standard_Integer Index1 = 0;
|
||||||
Standard_Integer Index2 = 0;
|
Standard_Integer Index2 = 0;
|
||||||
Standard_Real newFirst, newLast;
|
Standard_Real newFirst, newLast;
|
||||||
TColStd_Array1OfReal TK(1,Nb);
|
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||||
TColStd_Array1OfInteger TM(1,Nb);
|
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||||
myBSplineCurve->Knots(TK);
|
|
||||||
myBSplineCurve->Multiplicities(TM);
|
|
||||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U1,myBSplineCurve->IsPeriodic(),
|
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U1,myBSplineCurve->IsPeriodic(),
|
||||||
1,Nb,Index1,newFirst);
|
1,Nb,Index1,newFirst);
|
||||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U2,myBSplineCurve->IsPeriodic(),
|
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U2,myBSplineCurve->IsPeriodic(),
|
||||||
@ -293,10 +291,8 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
|||||||
Standard_Integer Index1 = 0;
|
Standard_Integer Index1 = 0;
|
||||||
Standard_Integer Index2 = 0;
|
Standard_Integer Index2 = 0;
|
||||||
Standard_Real newFirst, newLast;
|
Standard_Real newFirst, newLast;
|
||||||
TColStd_Array1OfReal TK(1,Nb);
|
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||||
TColStd_Array1OfInteger TM(1,Nb);
|
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||||
myBSplineCurve->Knots(TK);
|
|
||||||
myBSplineCurve->Multiplicities(TM);
|
|
||||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||||
myBSplineCurve->IsPeriodic(),
|
myBSplineCurve->IsPeriodic(),
|
||||||
1,Nb,Index1,newFirst);
|
1,Nb,Index1,newFirst);
|
||||||
@ -418,10 +414,8 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
|||||||
Standard_Integer Index1 = 0;
|
Standard_Integer Index1 = 0;
|
||||||
Standard_Integer Index2 = 0;
|
Standard_Integer Index2 = 0;
|
||||||
Standard_Real newFirst, newLast;
|
Standard_Real newFirst, newLast;
|
||||||
TColStd_Array1OfReal TK(1,Nb);
|
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||||
TColStd_Array1OfInteger TM(1,Nb);
|
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||||
myBSplineCurve->Knots(TK);
|
|
||||||
myBSplineCurve->Multiplicities(TM);
|
|
||||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||||
myBSplineCurve->IsPeriodic(),
|
myBSplineCurve->IsPeriodic(),
|
||||||
1,Nb,Index1,newFirst);
|
1,Nb,Index1,newFirst);
|
||||||
|
@ -149,6 +149,10 @@ public:
|
|||||||
//! Statistics
|
//! Statistics
|
||||||
Standard_EXPORT void Statistics(Standard_OStream& S) const;
|
Standard_EXPORT void Statistics(Standard_OStream& S) const;
|
||||||
|
|
||||||
|
//! Returns attached allocator
|
||||||
|
const Handle(NCollection_BaseAllocator)& Allocator() const
|
||||||
|
{ return myAllocator; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// -------- PROTECTED METHODS -----------
|
// -------- PROTECTED METHODS -----------
|
||||||
|
|
||||||
|
@ -102,6 +102,10 @@ public:
|
|||||||
Standard_Boolean IsEmpty () const {return (mySize == 0);}
|
Standard_Boolean IsEmpty () const {return (mySize == 0);}
|
||||||
Standard_Integer Length () const {return mySize;}
|
Standard_Integer Length () const {return mySize;}
|
||||||
|
|
||||||
|
//! Returns attached allocator
|
||||||
|
const Handle(NCollection_BaseAllocator)& Allocator() const
|
||||||
|
{ return myAllocator; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Methods PROTECTED
|
// Methods PROTECTED
|
||||||
//
|
//
|
||||||
|
@ -212,6 +212,12 @@ public: //! @name public API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Returns attached allocator
|
||||||
|
const Handle(NCollection_BaseAllocator)& Allocator() const
|
||||||
|
{
|
||||||
|
return myAllocator;
|
||||||
|
}
|
||||||
|
|
||||||
protected: //! @name Protected fields
|
protected: //! @name Protected fields
|
||||||
|
|
||||||
Handle(NCollection_BaseAllocator) myAllocator;
|
Handle(NCollection_BaseAllocator) myAllocator;
|
||||||
|
@ -158,7 +158,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Clear the data structures and set new cell sizes and allocator
|
//! Clear the data structures and set new cell sizes and allocator
|
||||||
void Reset (NCollection_Array1<Standard_Real> theCellSize,
|
void Reset (NCollection_Array1<Standard_Real>& theCellSize,
|
||||||
const Handle(NCollection_IncAllocator)& theAlloc=0)
|
const Handle(NCollection_IncAllocator)& theAlloc=0)
|
||||||
{
|
{
|
||||||
myCellSize = theCellSize;
|
myCellSize = theCellSize;
|
||||||
|
@ -68,7 +68,7 @@ template <class TheObjType, class TheBndType> class NCollection_UBTreeFiller
|
|||||||
NCollection_UBTreeFiller (UBTree& theTree,
|
NCollection_UBTreeFiller (UBTree& theTree,
|
||||||
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(256, theAlloc),
|
||||||
myRandGen (5489u /* == std::mt19937::default_seed, not defined in older environments, e.g, on Debian 6.0 with GCC 4.4.5 */),
|
myRandGen (5489u /* == std::mt19937::default_seed, not defined in older environments, e.g, on Debian 6.0 with GCC 4.4.5 */),
|
||||||
myIsFullRandom (isFullRandom) {}
|
myIsFullRandom (isFullRandom) {}
|
||||||
|
|
||||||
|
@ -13,6 +13,6 @@ vdisplay result
|
|||||||
vsetdispmode result 1
|
vsetdispmode result 1
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
checktrinfo result -tri 444 -nod 435
|
checktrinfo result -tri 430 -nod 428
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||||
|
@ -14,6 +14,6 @@ vdisplay result
|
|||||||
vsetdispmode result 1
|
vsetdispmode result 1
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
checktrinfo result -tri 5497 -nod 3987
|
checktrinfo result -tri 5457 -nod 3967
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||||
|
@ -20,7 +20,7 @@ vsetdispmode result 1
|
|||||||
vdisplay result
|
vdisplay result
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
checktrinfo result -tri 8142 -nod 7015
|
checktrinfo result -tri 9198 -nod 7543
|
||||||
|
|
||||||
checkmaxtol result -ref 0.92213088179312575
|
checkmaxtol result -ref 0.92213088179312575
|
||||||
checknbshapes result -shell 1
|
checknbshapes result -shell 1
|
||||||
|
@ -19,7 +19,7 @@ vdisplay result
|
|||||||
vfit
|
vfit
|
||||||
vsetdispmode result 1
|
vsetdispmode result 1
|
||||||
|
|
||||||
checktrinfo result -tri 17548 -nod 9208
|
checktrinfo result -tri 8970 -nod 4919
|
||||||
checkprops result -s 24861.2
|
checkprops result -s 24861.2
|
||||||
checkshape result
|
checkshape result
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||||
|
@ -13,5 +13,5 @@ isos result 0
|
|||||||
triangles result
|
triangles result
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
checktrinfo result -tri 7988 -nod 8350
|
checktrinfo result -tri 7980 -nod 8346
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
set TheFileName shading_wrongshape_027.brep
|
set TheFileName shading_wrongshape_027.brep
|
||||||
set bug_freenodes "OCC22687"
|
set bug_freenodes "OCC22687"
|
||||||
#set nbfreenodes(All) 2
|
set nbfreenodes(All) 1
|
||||||
set max_rel_tol_diff 1
|
set max_rel_tol_diff 1
|
||||||
if { [string compare $command "shading"] != 0 } {
|
if { [string compare $command "shading"] != 0 } {
|
||||||
#set bug_area "OCC22687"
|
#set bug_area "OCC22687"
|
||||||
set rel_tol 2.13
|
set rel_tol 1.2
|
||||||
} else {
|
} else {
|
||||||
set nbfreenodes(All) 2
|
set nbfreenodes(All) 2
|
||||||
set rel_tol 0.48
|
set rel_tol 0.48
|
||||||
|
Loading…
x
Reference in New Issue
Block a user