Commit Graph

53 Commits

Author SHA1 Message Date
Pasukhin Dmitry
90f5d7b214 Coding - Deprecate NCollection_Vector (#1230)
- Updated multiple files to replace instances of NCollection_Vector with NCollection_DynamicArray
2026-04-24 21:47:27 +01:00
Pasukhin Dmitry
7eb211cc2e Modeling - Refactor BRepGraph for uint32_t ids (#1229)
- Migrated node/ref/rep ID types and many count-returning APIs from `int` to `uint32_t`/`size_t` (history indices), updating iterators and bounds checks accordingly.
- Reworked numerous loops from raw integer indexing to typed-id iteration (`Start()`, `IsValid()`, range-for) across core code and tests.
- Expanded compaction test coverage (incl. bounding-box preservation assertion), plus clearer assertions/messages.
2026-04-23 22:09:31 +01:00
Pasukhin Dmitry
0755b6f31d Foundation, Modeling - NCollection modernization and BRepGraph overhaul (#1212)
- Migrate NCollection map/sequence/array size APIs from int to size_t; Size() returns size_t, Length() remains the int accessor; int overloads delegate through NbBucketsFromInt() with a negative-input guard.
- Add NCollection_LinearVector: contiguous flat-buffer dynamic array with Standard::Reallocate-based growth for trivial types and move-construction for non-trivial types.
- Rewrite NCollection_DynamicArray on top of LinearVector<T*>; switch to power-of-two block sizing with precomputed shift/mask.
- Rework NCollection_BaseMap iterator with a forward findFirst() helper (no negative-bucket arithmetic); unify ReSize/BeginResize/EndResize on size_t.
- Enable thread-safe fast path in NCollection_IncAllocator via std::shared_mutex + CAS bump allocation on atomic AvailableSize; exclusive lock is taken only for new-block allocation and list reordering.
- Remove NCollection_BasePointerVector (superseded by NCollection_LinearVector).
- Remove NCollection_BaseMap::Statistics (unused).
- Add <cstddef> include in NCollection_Primes.hxx so size_t resolves on clean builds.
- Document iterator invalidation contract on NCollection_LinearVector.
- Unify BRepGraph programmatic mutation behind EditorView: delete BuilderView (2648+552 lines); EditorView (3186+930 lines) and EditorView_Mut.cxx own both structural creation (Add*/Remove*) and field-level RAII-scoped mutation (Mut*()) with automatic OwnGen and SubtreeGen propagation.
- Add BRepGraph_MeshCache and BRepGraph_MeshView: two-tier mesh storage separating algorithm-derived caches from persistent (definition) triangulations; freshness is keyed on FaceDef.OwnGen; cache writes do not mutate the model.
- Document the MeshCache invalidation contract in BRepGraph_MeshCache.hxx (which mutations bump Face.OwnGen and how markRepModified closes the loop for Surface/Triangulation reps).
- Add BRepGraph_RefsIterator (generic flat ref scan with RefTraits dispatch) and BRepGraph_ReverseIterator (typed parent-traversal wrappers over reverse-index vectors).
- Rework RefId entity model: replace inline refs with typed RefId vectors; add OccurrenceRef and Kind::Occurrence=7; BRepGraphInc_WireExplorer now requires a VertexRefLookup.
- Rename layers for consistency: BRepGraph_ParamLayer to BRepGraph_LayerParam, BRepGraph_RegularityLayer to BRepGraph_LayerRegularity; rename BRepGraphInc_Usage to BRepGraphInc_Instance.
- Replace RootNodeIds() with RootProductIds() returning product roots only.
- Update BRepGraph and BRepGraphInc READMEs; fix stale RootNodeIds reference.
- Sweep Size() to Length() renames across ~200 callers in TKG2d, TKG3d, TKMath, TKMesh, TKBO, TKOffset, TKShHealing, TKTopAlgo, TKBRep, TKService, TKV3d, TKOpenGl, TKMeshVS, TKDE*, TKXCAF, TKXSBase, TKLCAF, TKStd, and Draw harness.
- Add GTest coverage for new containers and the BRepGraph overhaul: NCollection_DynamicArray_Test, NCollection_LinearVector_Test, BRepGraph_Fuzz_Test, BRepGraph_Iterator_Test, BRepGraph_LayerIterator_Test, BRepGraph_MeshCache_Test, BRepGraph_MutGuard_Test, BRepGraph_ReplaceVertex_Test, BRepGraph_ReverseIterator_Test, BRepGraph_ScenarioMatrix_Test, BRepGraph_TypedIdDispatch_Test, BRepGraph_WireExplorer_Test.
2026-04-19 18:47:54 +01:00
Pasukhin Dmitry
cf0c71b982 Modeling Data - Fixed possible issue with Explorer (#1195)
Add tests for TopExp_Explorer nested iteration and reinitialization
2026-04-07 18:14:35 +01:00
Pasukhin Dmitry
0af2ccac59 Modeling Data - BRepGraph iterators, ref caching, mutation APIs, and layer events (#1190)
- Add RelatedIterator, CacheKindIterator, LayerIterator, RefTransientCache
- Add Builder::AppendFull, BuilderView::RemoveRef with orphan pruning
- Add SetCoEdgePCurve, ClearFaceMesh, ClearEdgePolygon3D, ValidateMutationBoundary
- Rename CoEdgeDef::Sense to Orientation, FreeChildRefIds to AuxChildRefIds
- Propagate ref-modification events through LayerRegistry (deferred/immediate)
- Extend DefsIterator/RefsIterator with filtered-kind iteration
- Add CreateAutoProduct option to BRepGraphInc_Populate::Options
- Update BRepGraph and BRepGraphInc READMEs
2026-04-05 17:12:48 +01:00
Pasukhin Dmitry
c765cb4bd2 Modeling - New BRrep Graph representation (#1166)
Implement new representation of topology and BRep into OCCT.
New foundation represent 2 levels:
  BRepGraph - public interfaces which making the topology graph representation
  BRepGraphInc - internal structure which represent topology as an incident tables.
The foundation provides basic logic for conversion from TopoDS_Shape to BRepGraph and back.
The foundation provides the iteration and exploring interfaces to travel in both directions on any level of topology.
The internal id type of inc tables is 'int', which is not for long term and can be updated, better to use typed id aliases, even for the iterations, they provide all necessary operators.
The access to the BRepGraph is done using multiple View classes available by methods from main class.
The extensions on graphs is possible with 'Layer' and 'Cache', where first is persistent, second - temporary,
Some basic operations on graph also provided for compact, analyze and copy.
2026-04-03 00:51:20 +01:00
Pasukhin Dmitry
ba824c84ef Modeling - Refactor TopExp_Explorer to use NCollection_LocalArray for stack management (#1181)
- Replaced `TopExp_Explorer`’s `NCollection_Vector`-based stack with `NCollection_LocalArray` + explicit stack-top index management.
- Extended `NCollection_LocalArray` to support non-trivial element types using placement-new, move semantics, and explicit destruction.
- Added GTests for `NCollection_LocalArray` covering non-trivial element lifetime and realloc/move scenarios.
2026-04-01 18:09:23 +01:00
Pasukhin Dmitry
4ec89df6f5 Modeling - Refactor BRepClass and FaceClassifier Implementation (#1167)
- Migrated `TopClass_FaceClassifier` / `TopClass_Classifier2d` implementations to `.pxx` and updated BRepClass/Geom2dHatch wrappers to use them (removing `_0.cxx` generator glue).
- Updated BRep class helper headers to use header inlines instead of separate `.lxx` files, and added/rewired passive/face classifier implementations.
- Extended `NCollection_DynamicArray` / `NCollection_KDTree` APIs (insert helpers, callback-based range query) and added GTests for the new vector insert operations.
2026-03-23 18:15:04 +00:00
Pasukhin Dmitry
4cdb5a89e5 Coding, Warnings - Refactor parameter naming in curve and surface evaluation methods (#1165)
- Standardize `EvalD0/EvalD1/EvalD2/EvalD3/EvalDN` parameter names to `theU` / `theV` (and `theN`, `theNu`, `theNv`) across multiple curve/surface adaptor classes.
- Update method signatures to use `const double` / `const int` (top-level const) and add local aliases where needed to preserve existing internal variable naming.
- Fix MSVC-warning-prone types/usages in `VrmlData_Scene::readLine()` (use `std::streamsize`, `std::ios::iostate`).
2026-03-23 14:22:27 +00:00
Pasukhin Dmitry
6f6660d0d6 Modeling Data - Unify LProp packages into template classes in TKGeomBase (#1156)
Consolidate duplicated local property computation classes
(GeomLProp_CLProps, Geom2dLProp_CLProps2d, LProp3d_CLProps,
BRepLProp_CLProps, HLRBRep_CLProps and their SLProps counterparts)
into unified C++ template classes GeomLProp_CLPropsBase and
GeomLProp_SLProps with policy-based access (DirectAccess/ToolAccess).

Move LProp, GeomLProp, and GProp packages from TKG2d/TKG3d to
TKGeomBase. Remove Geom2dLProp and LProp3d packages entirely.
Merge Geom2dLProp_CurAndInf2d into GeomLProp_CurAndInf2d.
Preserve backward-compatible type aliases (using declarations)
for all previously existing class names.

Shared algorithm logic extracted into LProp_CurveUtils and
LProp_SurfaceUtils namespaces. 2D curve analysis helpers
(FuncCurExt2d, FuncCurNul2d, NumericCurInf2d) converted to
header-only .pxx implementations under GeomLProp.

Update all dependent code (LocalAnalysis, BRepFill, ChFi3d,
Geom2dHatch, GeomPlate, ProjLib, HLRBRep, DrawTrSurf, etc.)
to use new template instantiations. Migrate GTests from
TKG2d to TKGeomBase with updated class names.
2026-03-10 16:49:55 +00:00
Pasukhin Dmitry
fe9a0de8d0 Modeling Data - Modernize LProp .gxx templates into .pxx utilities (#1155)
Replace legacy .gxx generic class templates (LProp_CLProps.gxx,
LProp_SLProps.gxx) with modern C++ .pxx template utilities
(LProp_CurveUtils.pxx, LProp_SurfaceUtils.pxx) using namespaced
template functions and access policies.

Remove obsolete CurveTool/SurfaceTool intermediary classes
(GeomLProp_CurveTool, GeomLProp_SurfaceTool, LProp3d_CurveTool,
LProp3d_SurfaceTool, BRepLProp_CurveTool) that are no longer needed
with the new direct/tool access policy design.

Replace per-instantiation _0.cxx files with standalone .cxx
implementations that delegate to the shared .pxx utilities.

Fix myCN field type from double to int in all CLProps headers
to match SLProps convention and actual usage (values 0 or 4).
Add default member initializers for uninitialized fields
(myCurvature, mySignificantFirstDerivativeOrder, myMinCurv,
myMaxCurv, myMeanCurv, myGausCurv) across all CLProps/SLProps classes.
Fix theSigOrder pass-by-value bug in Tangent/Curvature wrappers.
Fix typos: anUinfium/anVinfium -> anUinfimum/anVinfimum.
2026-03-09 23:29:52 +00:00
Pasukhin Dmitry
c4715e0e72 Modeling - Remove GeomProp modules (#1154)
- Deleted GeomProp_Surface, GeomProp_SurfaceAnalysisTools, GeomProp_SurfaceOfExtrusion, GeomProp_SurfaceOfRevolution, and GeomProp_Torus classes along with their implementation files.
- Removed references to the GeomProp module from the CMake package configuration.
2026-03-09 21:03:18 +00:00
Pasukhin Dmitry
7341688668 Coding - Update method guards for consistency (#1151)
Used regex:
^//[\s\n\r\t]*[-=~]{3,}[\n\r]*//[\s\n\r\t]*[-~a-z0-9_ =\s\t./><']+[\s\n\r\t]*:[\s\n\r\t]*[-~a-z0-9_:\t\s./><=']*[\s\n\r\t]*//[\s\n\r\t]*[a-z]+[\s\n\r\t]*:[\s\n\r\t]*[-~a-z0-9_\s\t./><=']{0,30}//[\s\n\r\t]*[-=~]{3,}\n*
2026-03-08 08:45:29 +00:00
Pasukhin Dmitry
763931a9f8 Modeling - Cache transformed surfaces and update fillet/grid evaluators (#1147)
Refactor transformed-surface handling to avoid repeated transformations, remove mutable surface access patterns, and align dependent code paths.

- Add cached transformed data in GeomAdaptor_TransformedSurface and rebuild it on ctor/Load/SetTrsf.
- Add explicit original/transformed surface accessors and deprecate legacy GeomSurface() usage.
- Preserve transformed cache state in BRepAdaptor_Surface shallow copy/initialization.
- Expose GeomAdaptor_Surface::ToleranceU()/ToleranceV() and use them in bounded-surface reload.
- Rework ChFi3d bounded surface helper to support both GeomAdaptor_Surface and BRepAdaptor_Surface.
- Replace ChangeSurface()-based usages in fillet code with const surface access.
- Add and register GeomAdaptor_TransformedSurface GTests.
2026-03-07 12:44:06 +00:00
Pasukhin Dmitry
d07798d521 Modeling Data - Fix continuity order mapping in BRepProp_Curve to match GeomProp_Curve (#1141)
The condition == 2 only matched GeomAbs_C1 curves for D1 evaluation, while >= 2 (as used in GeomProp_Curve::Continuity())
  correctly includes GeomAbs_G2 and higher, since G2 implies G1 which guarantees D1 exists.
2026-03-06 08:09:40 +00:00
Pasukhin Dmitry
51ab458dbd Modeling Data - Introduce GeomAdaptor_TransformedCurve and unify Eval-based evaluation API (#1139)
Add GeomAdaptor_TransformedCurve as a new base class for BRepAdaptor_Curve that wraps a GeomAdaptor_Curve (or Adaptor3d_CurveOnSurface) with an applied gp_Trsf transformation. This mirrors the existing GeomAdaptor_TransformedSurface pattern for curves.

Refactor the adaptor evaluation API across Adaptor3d_Curve and Adaptor3d_Surface hierarchies so that EvalD0/D1/D2/D3/DN are the primary virtual evaluation methods:

- Adaptor3d_Curve: Value, D0-DN become non-virtual inline wrappers delegating to EvalD*. Base EvalD* implementations now throw Standard_NotImplemented instead of calling D*.
- Adaptor3d_Surface: same pattern applied symmetrically.
- Adaptor3d_CurveOnSurface: removes Value/D0-DN overrides (inherited from base); adds EvalD0/D1/D2/D3/DN marked final with the full dispatch logic.
- Adaptor3d_IsoCurve: removes Value/D0-DN overrides; adds EvalD* final with iso-curve projection logic (IsoU selects D1V/D2V/D3V, IsoV selects D1U/D2U/D3U).
- GeomAdaptor_Curve: removes Value/D0-DN overrides (now inherited inline); EvalD* remain final with BSpline cache and analytical dispatch logic.
- GeomAdaptor_Surface: removes Value/D0-DN overrides (now inherited inline); EvalD* remain final with BSpline cache and analytical dispatch logic.
- GeomAdaptor_TransformedCurve: overrides EvalD* with transform-and-dispatch logic; no need to override Value/D0-DN (inherited from Adaptor3d_Curve).
- GeomAdaptor_TransformedSurface: removes Value/D0-DN overrides (now inherited inline).
- BRepAdaptor_Curve: refactored to inherit GeomAdaptor_TransformedCurve, removing all duplicated evaluation and geometry-extraction method implementations.
- BRepAdaptor_CompCurve: removes Value/D0-DN overrides; adds EvalD* final with compound-curve parameter mapping and derivative scaling logic.
- ProjLib_ProjectOnPlane: removes Value/D0-DN overrides; adds EvalD* final delegating to the projected result adaptor or the OnPlane_* free functions.
- GeomFill_SnglrFunc: removes Value/D0-DN overrides; adds EvalD* final implementing the C'(t) x C''(t) singular function with ratio scaling.
- ChFiDS_ElSpine: removes Value/D0-D3 overrides; adds EvalD0-D3 final delegating to the internal GeomAdaptor_Curve member.
- BiTgte_CurveOnEdge: removes Value/D0-DN overrides; adds EvalD* final.
- BiTgte_CurveOnVertex: removes Value/D0-DN overrides; adds EvalD* final (D1-DN throw Standard_NotImplemented as the curve represents a degenerate point).
- HelixGeom_HelixCurve: removes Value/D0-D2/DN overrides; adds EvalD0/D1/D2/DN final with trigonometric helix evaluation.

Add GTest coverage for GeomAdaptor_TransformedCurve: point/derivative evaluation with transformation, curve-on-surface path, GeomGridEval_Curve batch evaluation.
2026-03-05 10:35:15 +00:00
Pasukhin Dmitry
2ce7b26ddb Coding - Standardize comment separators, translate French comments (#1126)
Normalize method separator lines across the codebase to exactly
100 characters (// followed by 98 = signs) matching the project
coding standard.

Translate remaining French comments to English in ModelingData
packages (TKBRep, TKG2d, TKG3d, TKGeomBase) and FoundationClasses.

Add [[nodiscard]] attribute to Copy() methods on Geom_Geometry,
Geom2d_Geometry, Geom_Transformation, and Geom2d_Transformation
to prevent accidental discard of returned handles.

Fix typo in AppDef_Variational::Dump() debug output: "Nombre of
3d par multipoint" -> "Number of 3d per multipoint".

Update .github/copilot-instructions.md separator examples to match
the corrected convention.
2026-02-27 12:34:21 +00:00
Pasukhin Dmitry
c9ecf72850 Modeling Data - Extend Prop packages with per-type GTests and shared tools (#1125)
Extract duplicated curve analysis logic (tangent, curvature, normal,
centre of curvature, inflection/extrema finding) from per-type evaluators
(BezierCurve, BSplineCurve, OffsetCurve, OtherCurve) into shared
CurveAnalysisTools.pxx for both GeomProp (3D) and Geom2dProp (2D).

Add GeomProp::ComputeTangent overload with sign correction using
finite-difference points, and use it in BRepProp_Curve::Tangent to
properly handle degenerate D1 cases instead of falling back to
unsigned higher-order derivatives.

Add GeomProp_Curve::Continuity static methods for computing junction
continuity (C0/G1/C1/C2) between two Geom_Curve handles, with BSpline
knot-multiplicity analysis and optional orientation reversal flags.

Add 29 per-geometry-type GTest files (9 3D curves, 9 2D curves,
11 3D surfaces) covering:
- Analytical property verification against known formulas
- VsCLProps/VsCLProps2d/VsSLProps comparison with legacy LProp APIs
  at both uniform samples and critical points (vertices, poles, knots,
  seams, endpoints, near-degenerate regions)
- FindCurvatureExtrema/FindInflections validation where applicable

Update existing VsCLProps, VsCLProps2d, VsSLProps, and VsBRepLProp
comparison tests with improved structure and broader coverage.
2026-02-26 22:33:27 +00:00
Pasukhin Dmitry
12b54504ee Modeling Data - Enforce construction-time initialization for Prop and GridEval classes (#1118)
Replace two-step initialization (default constructor + Initialize) with
direct construction for 8 non-copyable/non-movable property and grid
evaluator classes. Objects are now always in a valid state after construction.

Refactored classes:
- GeomProp_Curve, GeomProp_Surface (TKG3d)
- Geom2dProp_Curve (TKG2d)
- BRepProp_Curve, BRepProp_Surface (TKBRep)
- GeomGridEval_Curve, GeomGridEval_Surface (TKG3d)
- Geom2dGridEval_Curve (TKG2d)

Changes per class:
- Remove default constructor and IsInitialized() method.
- Add constructors matching each former Initialize overload.
- Rename Initialize to protected initialization method for internal
  and derived class use.

All callers updated across production code (Extrema, BndLib,
IntCurveSurface, IntPatch, HLRBRep, GeomGridEval derived classes)
and test files to use constructor-based initialization.
2026-02-25 15:06:57 +00:00
Pasukhin Dmitry
33ef11ca53 Modeling Data - Add BRepProp package for modern BRep differential properties (#1116)
Add new BRepProp package to TKBRep as a thin wrapper over GeomProp:: free
functions for computing local differential properties of BRep edges and faces
without exceptions. Replaces the legacy BRepLProp macro-based (.gxx) pattern.

New package BRepProp (TKBRep) provides:
- BRepProp_Curve: Local curve property evaluator for BRep edges.
  Delegates derivative computation to BRepAdaptor_Curve and passes results
  to GeomProp::ComputeTangent, ComputeCurvature, ComputeNormal,
  ComputeCentreOfCurvature. Three Initialize overloads: from TopoDS_Edge
  (owning), from BRepAdaptor_Curve reference (non-owning), and from
  occ::handle<BRepAdaptor_Curve> (shared ownership). Includes static
  Continuity() methods for regularity analysis at curve junctions
  (replaces BRepLProp::Continuity).
- BRepProp_Surface: Local surface property evaluator for BRep faces.
  Delegates derivative computation to BRepAdaptor_Surface and passes results
  to GeomProp::ComputeSurfaceNormal, ComputeSurfaceCurvatures,
  ComputeMeanGaussian. Same three Initialize overloads as BRepProp_Curve.

Key design decisions:
- No variant dispatch needed: BRepAdaptor_Curve/Surface handle geometry-type
  dispatch internally via virtual methods, so BRepProp is a thin wrapper
  calling adaptor D1/D2/D3 then GeomProp:: free functions.
- Ownership pattern: occ::handle for owning case + raw const pointer for
  non-owning case, consistent with GeomProp_Curve/Surface.
- Returns result structs with IsDefined flags instead of throwing exceptions.

18 GTests: 11 unit tests (line, circle, box, cylinder, sphere) and
7 cross-validation tests against BRepLProp_CLProps/BRepLProp_SLProps.
2026-02-24 22:19:34 +00:00
Pasukhin Dmitry
e384f0bb93 Testing - Add unit tests for geometric classes and conversions (#1099)
- Introduced new tests for TopExp class to validate shape mapping and vertex retrieval.
- Added tests for Geom_Circle, Geom_Line, and Geom_Plane classes to ensure correct geometric behavior and transformations.
- Implemented tests for GCPnts_AbscissaPoint to verify length calculations and parameter retrieval for lines and circles.
- Created conversion tests in GeomConvert to check the accuracy of converting geometric entities to B-spline representations.
- Updated CMake files to include new test files for the added tests.
2026-02-20 20:25:09 +00:00
Pasukhin Dmitry
c9bdc4b9f1 Modeling Algorithms - Optimize properties computation for complex compounds (#1091)
Optimized exact vprops path for OCC28402 by reducing TopLoc_Location
composition overhead in edge pcurve lookup.

Changes:
- added fast-path exits in TopLoc_Location::Predivided() for identity and
  equal-location cases;
- cached face surface/location in BRepGProp_Face and reused this context in
  Load(const TopoDS_Edge&);
- in BRep_Tool::CurveOnSurface(...), compute Predivided() only when edge
  has curve representations to iterate.

This keeps algorithmic behavior unchanged and targets the performance
regression reported by tests/bugs/modalg_7/bug28402.
2026-02-15 09:24:57 +00:00
Pasukhin Dmitry
964a2c75df Modeling Data, Algorithms - Always-populated weights, direct array access migration, Hermit bug fix (#1058)
Introduce always-populated weight arrays in BSpline/Bezier curve and surface
classes using non-owning views over a static unit-weights buffer. Migrate
~100 callers across the codebase from deprecated copy-out APIs to direct
const-reference array access. Fix a long-standing typo bug in Hermit.cxx.

Infrastructure (BSplCLib, BSplSLib):
- Add BSplCLib::UnitWeights(n) returning a non-owning NCollection_Array1
  view over a compile-time-initialized static array of 2049 ones; falls
  back to heap allocation for larger sizes.
- Add BSplCLib::MaxUnitWeightsSize() (constexpr 2049) and
  BSplCLib::UnitWeightsData() exposing the raw pointer for BSplSLib.
- Add BSplSLib::UnitWeights(nU, nV) returning a non-owning
  NCollection_Array2 view when nU*nV <= 2049, heap-allocated otherwise.

Always-populated myWeights (Geom/Geom2d curve and surface classes):
- myWeights is now always sized to match poles count.
  Non-rational: non-owning view via UnitWeights (zero allocation).
  Rational: owning array with actual weight values.
- Add WeightsArray() returning const NCollection_Array1<double>& (curves)
  or const NCollection_Array2<double>& (surfaces) that is always valid.
- Update all constructors, copy constructors, and restructuring operations
  (IncreaseDegree, InsertKnots, RemoveKnot, Segment, SetPeriodic,
  SetOrigin, SetNotPeriodic, ExchangeUV, etc.) to maintain the invariant.
- SetWeight: copies non-owning view to owned array before mutation when
  transitioning to rational; assigns UnitWeights when becoming non-rational.
- Remove myRational derivation from myWeights.Size() in updateKnots();
  rationality is now tracked explicitly via the myRational flag only.
- Fix Geom2d_BSplineCurve::InsertPoleAfter missing myRational update
  after inserting a weighted pole.
- Fix Geom_BSplineCurve::DumpJson stale myWeights.Size() > 0 guard
  (changed to myRational, matching all other classes).

Caller migration to direct array access (~100 files):
- Replace deprecated copy-out pattern (allocate temp + call Foo(temp))
  with const-reference access for Poles(), Knots(), Multiplicities(),
  UKnots(), VKnots(), UMultiplicities(), VMultiplicities(),
  KnotSequence(), UKnotSequence(), VKnotSequence().
- Replace Weights() null-pointer patterns with WeightsArray() const-ref
  or *Weights() dereference where null check is still appropriate.
- Affected modules: GeomConvert, Geom2dConvert, GeomLib, GeomFill,
  ProjLib, ShapeUpgrade, ShapeCustom, ShapeConstruct, ShapeAnalysis,
  ShapeAlgo, BRepLib, BRepGProp, HLRBRep, ChFi3d, ChFiKPart, BlendFunc,
  FairCurve, IntTools, TopOpeBRepTool, TopOpeBRepBuild, LocOpe,
  BRepOffset, Adaptor3d, GeomAdaptor, Geom2dAdaptor, BndLib, Extrema,
  DrawTrSurf, GeometryTest, GeomliteTest, SWDRAW, QABugs,
  GeomToIGES, IGESToBRep, GeomToStep, StdPrs.

Bug fix in Hermit.cxx (PolyTest, both 3D and 2D overloads):
- Fix typo: "Pole0 < 3" changed to "Pole0 < Pole3" — was comparing
  a double variable against the integer literal 3 instead of the
  variable Pole3 holding the endpoint weight value.
- Fix logic: "if (boucle == 1)" changed to "else if (boucle == 1)"
  to make the boucle==1 and boucle==2 branches mutually exclusive.
- Add explanatory comments on BSplCLib::D1 calls that intentionally
  pass weight values as scalar "poles" to evaluate the weight function.

NCollection_PackedMapAlgo migration (TDataStd, QABugs):
- Replace deprecated member functions (IsSubset, Subtraction, Subtract,
  Unite, Intersect, IsEqual) with NCollection_PackedMapAlgo free functions.

GTests:
- New BSplCLib_Test.cxx: 5 tests for UnitWeights API.
- New BSplSLib_Test.cxx: 5 tests for surface UnitWeights API.
- New Hermit_Test.cxx: 11 tests for Hermit::Solution (3D/2D) and
  Hermit::Solutionbis covering uniform, distinct, high-ratio, reversed,
  symmetric weights and positive-poles invariant.
- Add WeightsArray tests to Geom_BSplineCurve_Test, Geom_BezierCurve_Test,
  Geom_BSplineSurface_Test, Geom_BezierSurface_Test (2 tests each)
  verifying const-ref return, non-owning for non-rational, owning for
  rational.
2026-02-10 18:41:34 +00:00
Pasukhin Dmitry
3aeb4668f5 Foundation Classes - Refactor TShape hierarchy for performance and memory efficiency (#1027)
- Made ShapeType() non-virtual by embedding the shape type in a compact uint16_t state field alongside flags
- Replaced int myFlags with uint16_t myState using a BitLayout enum for compact storage
- Moved Compose/Reverse/Complement operations from TopAbs.cxx to inline implementations in TopAbs.hxx
- Updated all TShape derived class constructors to pass their type to the base class
- Refactored TopoDS_Iterator to use index-based iteration with updateCurrentShape() helper
2026-01-23 21:08:39 +00:00
Pasukhin Dmitry
36e781813e Coding - Revert type definitions for Standard_CString replacements (#1021)
Fix the replacement issue when Standard_CString was replaced to const char* even when it was const.
Now "const Standard_CString" is replaced with "const char* const".
Only places which were before const Standard_CString is replaced.
2026-01-21 10:09:22 +00:00
Pasukhin Dmitry
a36bca57a9 Coding - Clean up the FILES (#1002)
- Removed legacy metadata entries (EXTERNLIB, PACKAGES, DEFINES, FILES) that are no longer used by the build system
- Removed references to obsolete build artifacts (.lex, .yacc files) that appear to be superseded by generated .c/.h files
- Removed references to non-source files (README.md, .tcl scripts, GUID.txt) that shouldn't be listed in source file manifests
2026-01-14 14:46:42 +00:00
Pasukhin Dmitry
e1d36343e4 Foundation Classes - Inherited Standard_Failure from std::exception (#984)
First patch in iterative renovation of exceptions.

- Simplify exception classes to be container of data only.
- Removed redundant inclusion of <Standard_Type.hxx> in various header files across the project.
- Removed Set methods for failure and its define template.
- Removed Raise and Rerise static methods.
- Remove Instance and Throw methods
- Deprecated getting message with old approach, and moving to what()
- Update ErrorHandler to handle only specific list of exceptions.
2026-01-07 12:22:32 +00:00
Pasukhin Dmitry
6c24544fe1 Coding - Apply more flags from Clang-tidy (#977)
- Refactor boolean expressions and improve code readability across multiple files
- Simplified boolean expressions by removing unnecessary comparisons to true/false.
- Replaced explicit boolean checks with direct variable usage 

Used flags:
readability-static-accessed-through-instance
readability-simplify-boolean-expr
performance-for-range-copy
performance-move-const-arg
misc-unused-parameters
misc-redundant-expression
2026-01-03 12:18:59 +00:00
Pasukhin Dmitry
bd99539eb2 Coding - Remove unused typedefs and includes, replace with forward declarations (#971)
- Deleted TopoDS_ListOfShape.hxx and removed its references in various files.
- Replaced instances of TopoDS_ListOfShape with NCollection_List in TopoDS_Builder, TopoDS_Iterator, and TopoDS_TShape.
- Updated CMake files to exclude TopoDS_ListOfShape from the build.
- Removed Geom2dConvert_SequenceOfPPoint and its usages, replacing them with NCollection_Sequence.
- Cleaned up Select3D and SelectMgr modules by removing Select3D_EntitySequence, Select3D_IndexedMapOfEntity, and SelectMgr_IndexedMapOfOwner.
- Adjusted includes in various files to use NCollection types instead of removed classes.
- Overall, this commit streamlines the codebase by eliminating unused types and reducing dependencies.
2025-12-29 22:31:23 +00:00
Pasukhin Dmitry
f675adaac0 Coding - Remove unused code and comments across various files (#968)
- Removed conditional compilation blocks (`#if 0`) that contained unused code in:
  - BRepTools_Modifier.cxx
  - AdvApp2Var_Data_f2c.hxx
  - AdvApp2Var_SysBase_baseinit.cxx
  - Extrema_FuncExtCS.cxx
  - Extrema_FuncExtSS.cxx
  - GeomProjLib.cxx
  - IntAna_IntLinTorus.cxx
  - IntAna2d_AnaIntersection_8.cxx
  - IntAna2d_Outils.cxx
  - ProjLib_CompProjectedCurve.cxx
  - ProjLib_ComputeApprox.cxx
  - ProjLib_ComputeApproxOnPolarSurface.cxx

- Cleaned up header files by ensuring proper end-of-file newlines in:
  - TKBRep_pch.hxx
  - GeomLib_Tool.hxx
  - MeshVS_SymmetricPairHasher.hxx
  - OpenGl_ShaderProgramDumpLevel.hxx
  - Graphic3d_ToneMappingMethod.hxx
2025-12-29 16:58:00 +00:00
Pasukhin Dmitry
c020fc2fad Coding - Clang-Tidy apply with refactoring (#965)
- Replacing empty constructor/destructor implementations with `= default`
- Removing redundant `virtual` keywords from override methods
- Replacing `NULL` and `0` with `nullptr`
- Replacing C headers with C++ equivalents (`<cstdio>`, `<cstring>`, etc.)
- Marking copy constructors/assignment operators as `= delete` for non-copyable classes
- Converting `void` parameter lists to empty parameter lists
- Replacing integer literals with appropriate boolean values
2025-12-29 11:55:04 +00:00
Pasukhin Dmitry
14d4e91171 Coding - Global Refactoring OCCT as a part of 8.0.0 (#955)
- Added automated migration scripts for handle syntax, standard types, and macros
- Deprecated legacy `Standard_*` types and macros in favor of native C++ equivalents
- Introduced modern `occ` namespace with template-based type checking helpers
- Enhanced NCollection macros to support variadic arguments for complex template types- Added automated migration scripts for handle syntax, standard types, and macros
- Deprecated legacy `Standard_*` types and macros in favor of native C++ equivalents
- Introduced modern `occ` namespace with template-based type checking helpers
- Enhanced NCollection macros to support variadic arguments for complex template types
2025-12-28 14:38:06 +00:00
Pasukhin Dmitry
b5d2fc73fb Coding - Refactor HArray and HSequence Definitions (#962)
- Replaced custom DEFINE_HARRAY1 and DEFINE_HSEQUENCE macros with typedefs to NCollection_HArray1 and NCollection_HSequence for various data types across multiple files.
- Updated header files in the following modules:
  - HLRAlgo
  - TKShHealing
  - TKBRep
  - TKG2d
  - TKG3d
  - TKGeomBase
  - TKMeshVS
  - TKV3d
- This change improves consistency and reduces the complexity of the codebase by utilizing the standard NCollection templates.
2025-12-28 11:42:24 +00:00
Pasukhin Dmitry
5870232236 Modeling - Optimize geometry grid evaluating (#908)
- Introduced `GeomGridEval` package with specialized evaluators for analytical surfaces (plane, cylinder, sphere, cone, torus) and parametric surfaces (Bezier, BSpline, offset)
- Refactored extrema computation in `Extrema_GenExtSS`, `Extrema_GenExtPS`, and `Extrema_GenExtCS` to use batch grid evaluation
- Added comprehensive derivative computation support (D0-D3, DN) for all surface types
2025-12-23 14:10:04 +00:00
Pasukhin Dmitry
fe2595e21a Modeling - Refactor Evaluator classes to inline Utils and variant-based Adaptors (#935)
This commit completes the refactoring of geometry evaluator classes, replacing polymorphic Handle-based evaluators with inline template utilities and std::variant-based data storage in adaptor classes.

Key changes:

1. Removed GeomEvaluator and Geom2dEvaluator packages:
   - Deleted GeomEvaluator_Curve, GeomEvaluator_Surface base classes
   - Deleted GeomEvaluator_OffsetCurve, GeomEvaluator_OffsetSurface
   - Deleted GeomEvaluator_SurfaceOfExtrusion, GeomEvaluator_SurfaceOfRevolution
   - Deleted Geom2dEvaluator_Curve, Geom2dEvaluator_OffsetCurve

2. Added private utility headers (.pxx files) with inline template functions:
   - Geom_OffsetCurveUtils.pxx - offset curve evaluation
   - Geom_OffsetSurfaceUtils.pxx - offset surface evaluation
   - Geom_ExtrusionUtils.pxx - surface of extrusion evaluation
   - Geom_RevolutionUtils.pxx - surface of revolution evaluation
   - Geom2d_OffsetCurveUtils.pxx - 2D offset curve evaluation

3. Refactored GeomAdaptor_Curve:
   - Moved BezierData and BSplineData structs inside the class
   - Added std::variant<monostate, OffsetData, BezierData, BSplineData> for type-specific evaluation data
   - Removed separate myBSplineCurve and myCurveCache members
   - Updated all evaluation methods to use variant-based access

4. Refactored GeomAdaptor_Surface:
   - Changed ExtrusionData and RevolutionData to use Handle(Adaptor3d_Curve) instead of Handle(GeomAdaptor_Curve) for flexibility
   - Changed RevolutionData to store gp_Ax1 instead of separate AxisLoc/AxisDir
   - Updated OffsetData to store Handle(Geom_OffsetSurface) for osculating surface queries instead of creating new Geom_OsculatingSurface

5. Updated Geom_OsculatingSurface:
   - Renamed UOscSurf/VOscSurf methods to UOsculatingSurface/VOsculatingSurface for consistency with Geom_OffsetSurface public API

6. Fixed specialized adaptor classes:
   - GeomAdaptor_SurfaceOfLinearExtrusion - removed evaluator, uses variant
   - GeomAdaptor_SurfaceOfRevolution - removed evaluator, uses variant
   - Geom2dAdaptor_Curve - updated to use variant-based data
   - Adaptor2d_OffsetCurve - updated to use Geom2d_OffsetCurveUtils

7. Fixed Geom_SurfaceOfRevolution:
   - Updated utility calls to use gp_Ax1 parameter instead of separate XYZ

8. Added missing includes in dependent files:
   - Adaptor3d_HSurfaceTool.cxx - added GeomAdaptor_Curve.hxx
   - GeomAdaptor.cxx - added Adaptor3d_Surface.hxx, GeomAbs_SurfaceType.hxx
   - Extrema_GenExtPS.cxx - added Adaptor3d_Curve/Surface.hxx, GeomAbs_IsoType.hxx
   - TopOpeBRepTool_GEOMETRY.cxx - added Geom2dAdaptor_Curve.hxx
   - BRepAdaptor_Curve2d.cxx - updated ShallowCopy for variant

Benefits:
- Reduced virtual function call overhead in hot evaluation paths
- Better code locality with inline template functions
- Simplified class hierarchy without abstract evaluator base classes
- More efficient memory layout with variant instead of polymorphic handles
- Consistent method naming across related classes
2025-12-21 10:28:25 +00:00
Pasukhin Dmitry
1d8add2970 Coding - Translate French comments and modernize constants (#932)
This commit performs safe code cleanup across multiple modules:

1. French to English comment translations:
   - ApplicationFramework: TNaming, TDF, TDataStd packages
   - ModelingAlgorithms: BRepFill, TopOpeBRepBuild, TopOpeBRepTool,
     NLPlate, FairCurve, IntSurf, Contap, ShapeFix, MAT2d, LocOpe
   - ModelingData: ProjLib, GeomLib, GeomConvert, IntAna, AppDef,
     GCPnts, Hermit, BinTools, LProp
   - Visualization: PrsDim, AIS, V3d packages

2. Constexpr modernization:
   - Convert static const variables to constexpr
   - Replace #define macros with constexpr variables
   - Add anonymous namespaces for internal constants
   - Affected files: V3d_View, V3d_CircularGrid, V3d_RectangularGrid,
     Graphic3d_FrameStats, PrsDim_*, Convert_*ToBSplineSurface,
     math_BrentMinimum, and others

3. Code organization:
   - Wrap file-scope constants in anonymous namespaces
   - Use consistent naming convention (THE_* prefix)

No functional changes - all modifications are comment-only or
compile-time constant improvements that preserve identical runtime
behavior.
2025-12-17 10:23:13 +00:00
Dmitrii Kulikov
c479f6e000 Coding - Rework of Math global functions to stl (#833)
Majority of functions now simply call same functions from std namespace.
Functions that duplicate std namespace functionality are declared
deprecated.
Calls of deprecated functions are replaced with std functions calls.
2025-11-17 14:20:24 +00:00
Pasukhin Dmitry
e03b266234 Foundation Classes - Performance improvements for TopExp package (#831)
- Replaced raw pointer-based stack (`TopExp_Stack`) with `NCollection_Vector<TopoDS_Iterator>`
- Mark some methods noexcept
- Removed `myTop` field
2025-11-14 18:00:19 +00:00
luzpaz
79289339d8 Documentation - Fix whitespaces and typos (#824)
- Fixed excessive whitespace in multi-line comments
- Corrected spelling errors (e.g., "selectionnable" → "selectable", "begenning" → "beginning")
- Improved comment formatting and readability
2025-11-13 20:31:57 +00:00
luzpaz
df59c53e79 Documentation - Fix whitespaces and typos (#821)
- Removed excessive whitespace between words in comments
- Removed <br> syntax
- Fixed spelling errors ("hilight" → "highlights", "texte" → "text")
- Improved comment formatting and structure
2025-11-13 09:30:53 +00:00
Pasukhin Dmitry
d166ff70e7 Testing - Migrate QA DRAW tests to GTest (#818)
- Removed 37 DRAW test scripts from `tests/bugs/` directories
- Added 31 new GTest C++ test files in appropriate `GTests/` directories
- Removed corresponding QAcommands implementations from QABugs source files
- Updated CMake FILES.cmake files to include new test files
2025-11-10 21:17:50 +00:00
Pasukhin Dmitry
2cc2bfdd27 Foundation Classes, gp - Add constexpr/noexcept constructors and standard direction enums (#803)
- Addition of `gp_Dir::D` and `gp_Dir2d::D` enums for standard directions (X, Y, Z, NX, NY, NZ)
- Constexpr/noexcept constructors for geometric primitives (circles, cones, cylinders, etc.)
- Enhanced axis placement classes with enum-based constructors
- Replacement of hardcoded direction values throughout the codebase
2025-11-04 16:21:59 +00:00
Pasukhin Dmitry
787bee375c Coding - Replace Standard_Mutex with std::mutex and migrate to RAII locks (#766)
- Replace legacy Standard_Mutex usage across many modules with std::mutex.
- Include <mutex> where needed and remove <Standard_Mutex.hxx> includes.
- Replace Standard_Mutex::Sentry / explicit Lock/Unlock with std::lock_guard or std::unique_lock.
- Convert optional/heap mutex holders to std::unique_ptr<std::mutex> and adapt locking accordingly.
- Simplify several singleton initializations (remove manual double-checked locking where safe).
- Use thread_local for per-thread flags instead of ad-hoc mutex protection.
- Fix BVH_BuildQueue Fetch logic to preserve thread counters and wasBusy handling.
- Remove obsolete TopTools_MutexForShapeProvider sources and update FILES.cmake.

This modernizes mutex usage, reduces dependency on custom mutex types and improves clarity of locking patterns.
2025-11-03 16:44:08 +00:00
Pasukhin Dmitry
962a456f9b Foundation Classes, Strings - add EmptyString() for Ascii/Extended and use it everywhere (#788)
Introduce TCollection_AsciiString::EmptyString() and TCollection_ExtendedString::EmptyString()
  and update headers.
Replace many local/static empty string instances and default-constructed
  temporaries with the shared EmptyString() reference across ApplicationFramework, DataExchange,
  Visualization and other modules.
Remove several unused local empty-key/static variables and
  adjust default parameters and return paths to use the centralized empty-string accessors.
Add missing #include <TCollection_AsciiString.hxx> to several headers that use/forward TCollection_AsciiString.
2025-11-01 22:39:12 +00:00
luzpaz
719ed090cb Documentation - Fix whitespace uniformity (#770)
- Standardized spacing in documentation comments by removing extra spaces between words
- Fixed inconsistent line breaks in multi-line comment blocks  
- Corrected minor spelling/grammar issues (e.g., "follow" → "follows", "form" → "from")
2025-10-28 08:26:46 +00:00
Pasukhin Dmitry
f4741d647f Coding - Checking for copyright notice (#749)
Created a new CI step to validate the presence of a copyright notice in each source file.
Updated existed files to include the copyright notice.
2025-10-16 18:39:56 +01:00
Pasukhin Dmitry
47bc102e28 Coding - Method guard iterative update (#732)
Used regex in src folder:
^//[\s\n\r\t]*[-=]{2,}[=]*[\n\r]*//[\s\n\r\t]*[a-z]+[\s\n\r\t]*:[\s\n\r\t]*[a-z0-9_:\t\s]*[\s\n\r\t]*//[\s\n\r\t]*[a-z]+[\s\n\r\t]*:[\s\n\r\t]*[a-z0-9_\s\t./-><]{0,22}//[\s\n\r\t]*[-=]{3,}[=]*
2025-09-21 11:50:56 +01:00
Pasukhin Dmitry
ae4de70f98 Coding - Method guard iterative update (#674)
- Standardizes comment formatting by replacing detailed comment blocks with a uniform "//=================================================================================================" separator
- Removes redundant "function:" and "purpose:" fields that often contained minimal or no useful information
- Maintains code functionality while improving visual consistency across the codebase
2025-08-15 17:14:53 +01:00
Dmitrii Kulikov
7b016e5c28 Modeling - General Fuse (BOPAlgo_PaveFiller) optimization #514
Adding a null check for the triangulation in BRep_Tool::IsClosed.
Simplifying index lookup logic in BOPDS_DS.
Introducing helper functions (IsPlaneFF and IsClosedFF) and updating iteration loops in BOPAlgo_PaveFiller_6 for improved clarity and robustness.
2025-05-16 00:03:44 +01:00
Dmitrii Kulikov
a56d85bf15 Modeling - BRepFilletAPI_MakeFillet Segfault with two curves and rim #532
Added null checks for TopoDS_Face in ChFi3d_Builder_2 and BRepAdaptor_Surface.
Added tests to check for crash.
2025-05-15 19:35:52 +01:00