Modeing - BSpline Cache Optimised calls for Local - #906
Merged
Merged
Conversation
…aluation methods - Introduced new methods for evaluating B-spline curves and surfaces using pre-computed local parameters, bypassing periodic normalization. - Added validation for B-spline degrees to ensure they do not exceed the maximum supported degree. - Refactored existing evaluation methods to utilize the new local parameter methods for improved performance and clarity. - Updated header files to include new function declarations for local parameter evaluations.
…s function - Replaced existing D0, D1, and D2 local evaluation methods with a unified EvaluatePolynomials function for improved clarity and maintainability. - Introduced InvSpanLength in BSplCLib_CacheParams to optimize derivative calculations. - Enhanced derivative scaling by directly using inverse span lengths, improving performance in derivative evaluations. - Updated related methods to ensure consistent handling of rational and non-rational B-splines.
- Enhanced the EvaluatePolynomials function to improve clarity and maintainability by restructuring derivative calculations and parameter handling. - Introduced conditional logic to optimize derivative evaluations based on the maximum degree of parameters. - Updated the handling of rational and non-rational B-splines to ensure correct processing of results. - Improved the organization of derivative storage and evaluation, leading to better performance in polynomial evaluations.
- Refactored D0Local, D1Local, and D2Local methods in BSplCLib_Cache and BSplSLib_Cache to utilize NoDerivativeEvalPolynomial for improved performance and clarity. - Updated handling of rational and non-rational B-splines to ensure correct evaluation of points and derivatives. - Introduced comprehensive unit tests for BSplCLib_Cache and BSplSLib_Cache to validate the correctness of evaluations across various parameter values and configurations. - Added new test files for both BSplCLib and BSplSLib caches to ensure robust testing of B-spline functionalities.
…erformance - Updated BSplCLib_Cache to rename CalculateDerivative to calculateDerivative, enhancing consistency with naming conventions. - Added comments to clarify the purpose of methods and improve code readability. - Introduced a new toLocalParams function in BSplSLib_Cache to streamline the conversion of global UV parameters to local parameters, improving maintainability. - Refactored D0, D1, and D2 methods in BSplSLib_Cache to utilize the new toLocalParams function, reducing code duplication and enhancing clarity.
…ace operations - Added temporary storage for output in RationalDerivative to prevent memory overlap issues during evaluations. - Updated D0Local, D1Local, and D2Local methods to ensure zero-initialization of result storage, improving reliability and clarity. - Enhanced comments to clarify the purpose of changes and improve code readability.
…lity - Updated BSplCLib_Cache and BSplSLib_Cache to use direct division by SpanLength instead of multiplication by InvSpanLength, enhancing numerical stability for very small span lengths. - Removed InvSpanLength from BSplCLib_CacheParams to streamline parameter handling and reduce redundancy. - Enhanced comments to clarify the rationale behind changes and improve code readability.
…erivative evaluations - Introduced a new toLocalParams function for derivative evaluations that computes local UV parameters and inverse span lengths, enhancing numerical consistency. - Updated D0, D1, and D2 methods to utilize the new toLocalParams function, ensuring consistent handling of parameter transformations and derivative scaling. - Enhanced comments to clarify the purpose of changes and improve code readability.
…ve methods - Standardized formatting of variable declarations in D1 and D2 methods for improved readability. - Maintained numerical consistency by ensuring the same inverse values are used for parameter transformation and derivative scaling. - Enhanced comments to clarify the purpose of the changes and improve code clarity.
There was a problem hiding this comment.
Pull request overview
This PR introduces optimized "Local" variants of B-Spline evaluation methods that accept pre-computed local parameters, bypassing periodic normalization and parameter transformation overhead. The changes improve performance for grid-based evaluations where parameters can be computed once and reused.
Key changes:
- Added
D0Local,D1Local,D2Local,D3Localmethods toBSplCLib_CacheandBSplSLib_Cacheclasses - Added accessor methods to
Geom_BSplineCurveandGeom_BSplineSurfacefor direct handle access to internal arrays - Comprehensive test coverage for both curve and surface cache implementations
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Geom_BSplineSurface.hxx | Adds handle accessors for poles, weights, and flat knots arrays |
| Geom_BSplineCurve.hxx | Adds handle accessors for poles, weights, and flat knots arrays |
| FILES.cmake | Registers new test files for B-Spline cache testing |
| BSplSLib_Cache_Test.cxx | Comprehensive tests for surface cache evaluation methods |
| BSplCLib_Cache_Test.cxx | Comprehensive tests for curve cache evaluation methods |
| BSplSLib_Cache.hxx | Declares new Local evaluation methods and modernizes copy prevention |
| BSplSLib_Cache.cxx | Implements Local evaluation methods with refactored parameter handling |
| BSplCLib_Cache.hxx | Declares new Local evaluation methods and modernizes copy prevention |
| BSplCLib_Cache.cxx | Implements Local evaluation methods with refactored internal methods |
| Standard_Real* theDerivArray) const | ||
| { | ||
| const int aDimension = myRowLength; | ||
| Standard_Real* aPolesArray = const_cast<Standard_Real*>(myPolesWeightsBuffer); |
Collaborator
There was a problem hiding this comment.
This variable seems to be useless. We can just use myPolesWeightsBuffer directly at line 161.
| void BSplCLib_Cache::D0Local(double theLocalParam, gp_Pnt& thePoint) const | ||
| { | ||
| // theLocalParam is already computed as (param - SpanStart) / SpanLength | ||
| Standard_Real* aPolesArray = const_cast<Standard_Real*>(myPolesWeightsBuffer); |
Collaborator
There was a problem hiding this comment.
This variable seems to be useless. We can just use myPolesWeightsBuffer directly at line 161.
…alculations - Simplified variable declarations in calculateDerivativeLocal and D0Local methods for enhanced readability. - Replaced the use of const_cast with direct access to myPolesWeightsBuffer, improving code clarity and consistency. - Updated comments to better explain the changes and their impact on derivative evaluations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.