0026106: BRepMesh - revision of data model Removed tight connections between data structures, auxiliary tools and algorithms in order to create extensible solution, easy for maintenance and improvements; Code is separated on several functional units responsible for specific operation for the sake of simplification of debugging and readability; Introduced new data structures enabling possibility to manipulate discrete model of particular entity (edge, wire, face) in order to perform computations locally instead of processing an entire model. The workflow of updated component can be divided on six parts: * Creation of model data structure: source TopoDS_Shape passed to algorithm is analyzed and exploded on faces and edges. For each topological entity corresponding reflection is created in data model. Note that underlying algorithms use data model as input and access it via common interface which allows user to create custom data model with necessary dependencies between particular entities; * Discretize edges 3D & 2D curves: 3D curve as well as associated set of 2D curves of each model edge is discretized in order to create coherent skeleton used as a base in faces meshing process. In case if some edge of source shape already contains polygonal data which suites specified parameters, it is extracted from shape and stored to the model as is. Each edge is processed separately, adjacency is not taken into account; * Heal discrete model: source TopoDS_Shape can contain problems, such as open-wire or self-intersections, introduced during design, exchange or modification of model. In addition, some problems like self-intersections can be introduced by roughly discretized edges. This stage is responsible for analysis of discrete model in order to detect and repair faced problems or refuse model’s part for further processing in case if problem cannot be solved; * Preprocess discrete model: defines actions specific for implemented approach to be performed before meshing of faces. By default, iterates over model faces and checks consistency of existing triangulations. Cleans topological faces and its adjacent edges from polygonal data in case of inconsistency or marks face of discrete model as not required for computation; * Discretize faces: represents core part performing mesh generation for particular face based on 2D discrete data related to processing face. Caches polygonal data associated with face’s edges in data model for further processing and stores generated mesh to TopoDS_Face; * Postprocess discrete model: defines actions specific for implemented approach to be performed after meshing of faces. By default, stores polygonal data obtained on previous stage to TopoDS_Edge objects of source model. Component is now spread over IMeshData, IMeshTools, BRepMeshData and BRepMesh units. <!break> 1. Extend "tricheck" DRAW-command in order to find degenerated triangles. 2. Class BRepMesh_FastDiscret::Parameters has been declared as deprecated. 3. NURBS range splitter: do not split intervals without necessity. Intervals are split only in case if it is impossible to compute normals directly on intervals. 4. Default value of IMeshTools_Parameters::MinSize has been changed. New value is equal to 0.1*Deflection. 5. Correction of test scripts: 1) perf mesh bug27119: requested deflection is increased from 1e-6 to 1e-5 to keep reasonable performance (but still reproducing original issue) 2) bugs mesh bug26692_1, 2: make snapshot of triangulation instead of wireframe (irrelevant) Correction in upgrade guide.
0027362: Meshing performance 1) BRepMesh_FastDiscretFace.cxx: - exclude planes from procedure of inserting internal points. - localize declaration of the container aNewVertices in each method where it is needed. - correct the logic of the method insertInternalVerticesOther, so that to separate the processes of removing extra points and addition of new points in different cycles, thus making the code more clear and in addition stable. - insert useful output of intermediate mesh to a file in control() method for debug purposes (with definition DEBUG_MESH). 2) Add global functions MeshTest_DrawTriangles and MeshTest_DrawLinks to draw mesh data in debug session. 3) BRepMesh_FastDiscret: - in the method Add calculations of deflections have been simplified for non-relative mode. - replace the attribute MinDist with Deflection in EdgeAttributes structure. Correct its computation so that later to store this value as deflection of the polygon. 4) Make protection against exception in the method BRepMesh_Delaun::addTriangle() when an added triangle creates a third connection of a mesh edge. 5) BRepMesh_EdgeTessellator.cxx, BRepMesh_EdgeTessellationExtractor.cxx: use Geom2dAdaptor_Curve in order to use b-spline cache while computing value on a curve. 6) In BndLib_Box2dCurve::PerformBSpline, avoid creating new b-spline in case of requested parameter range differ from natural bounds insignificantly. 7) In GeomAdaptor classes, postpone building of cache till the time of its actual usage. So, creation of an adapter to compute intervals of continuity does not lead to creation of internal cache. 8) In the methods BRepAdaptor_Curve::Bezier and BSpline do not call Transformed() if transformation is identity. 9) In the classes Geom_BSplineCurve, Geom_BSplineSurface, Geom_BezierCurve, Geom_BezierSurface, Geom2d_BSplineCurve, Geom2d_BezierCurve change the method Pole() to return the point by const reference. 10) In CPnts_AbscissaPoint.cxx, compute derivative by D1 instead of DN to make use of b-spline cache. 11) Change test cases to actual state: - Number of triangles/nodes can grow due to more accurate work with deflection of edges. Now the edge is tessellated using its own tolerance instead of maximal tolerance of all shapes in the face. - Accept new numbers of mesh errors (free links, free nodes) for really bad shapes. - Correct the test "bugs/mesh/bug25612" to produce stable result. - Disable redundant checks in test cases bug25378* (lower limit for computation time). - Speed up iso-lines computation for offset of bspline surfaces. For that use adaptor instead of original surface in evaluator of approximation. - Add output of polylines for debug of insertInternalVerticesOther(). Reference data in test case bugs\moddata_2\bug453_3 have been changed to be close to expected theoretical values. This makes the test give stable result on different platforms.
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.
0027384: BRepMesh_IncrementalMesh does not take angular deflection into account for spun/elementary surfaces Check deviation of normals at vertices of triangles for complex surface types different from Bezier and BSpline. Modified test cased according to changes in BRepMesh. Do not remove more intermediate parameters than N - 3 in order to have at least one parameter related to surface internals. Check angle for angular deflection before removement of intermediate parameters. Unify computation of internal vertices for complex surfaces. Discretization points of edges are taken into account during computation of step of mesh grid. Remove parameters only if they fit the constrains along the whole surface. Do not add random internal parameters in case if their number is just 2. Force freezing parameters both for U and V in case of significant control point. Modified test cases Warnings elimination in vc14.
0024750: Replace instantiations of TCollection generic classes by NCollection templates -- manual changes Forward declaration of TCollection instances as classes are replaced by inclusion of corresponding header. Cyclic dependencies between declaration of collection class and its item are resolved by forward declaring a class in collection header.
0025378: Building of triangulation for distored surfaces can take very long using BRepMesh_IncrementalMesh New parameter MinSize has been introduced to BRepMesh and GCPnts_TangentialDeflection; Check length of remaining part of curve for min size parameter instead of distance between two points to avoid large gaps in case highly distorted BSpline surfaces; Produce fine mesh for sphere and fix other surface; Test cases for issue CR25378 Correction of test cases for issue CR25378
0025364: BRepMesh is not able to triangulate the shape with fine deflection Don't create data structures for whole set of faces. Necessary structures are created directly in BRepMesh_FastDiscret. Don't copy nodes data during scaling, single structure is used. Remove lines used for debug Fix sphere: resolve problem came from merging. Keep code clean - remove unnecessary logic, expected to be used for complicated restoration process. Test cases for issue CR25364
0023106: BRepMesh_IncrementalMesh returns wrong status Fix compilation errors on Linux platform Squeeze compilation warnings on Linux Fix regressions Back RemoveFaceAttribute for further reasons Fix retrieving of polygon by index Fix applying of location Test case for issue CR23106 Fix memory leak regression 'test bugs vis bug79' occurred due to incorrect memory cleaning of inherited objects by MMgtRaw::Free through BRepMesh_IEdgeTool; Replace BRepMesh_PDiscretRoot by pure pointer to BRepMesh_DiscretRoot; Fix IVtkOCC_ShapeMesher.
0025039: Improvement of code structure of general and supporting tools implemented in BRepMesh Removed CDL declarations; Data collections are replaced by NCollections; Small code refactoring. Remove definition of BRepMesh class. Code refactoring of BRepMesh_IncrementalMesh. Function BRepMesh_Write storing BRepMesh_DataStructureOfDelaun to BRep file is added for debug needs. Static method BRepMesh_GeomTool::IntLinLin has been added to eliminate code duplications in BRepMesh_Dealun and BRepMesh_CircleTool. BRepMesh_CircleTool simplified method to find circumcircle. Fix merging conflicts Remove redundant function Fix compilation warning on MacOS Revert changes occurred during rebase Resolved merging conflicts Use parallel flag with BRepMesh_FastDiscret Test cases for issue CR25039_2