Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First stage to memory rework #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

dpasukhi
Copy link
Owner

@dpasukhi dpasukhi commented Sep 26, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new methods in the FilletPoint class for resetting and copying point data, enhancing functionality.
  • Bug Fixes

    • Improved memory management across multiple components by replacing raw pointers with smart pointers, reducing the risk of memory leaks.
  • Refactor

    • Streamlined memory management in various classes by removing dynamic memory allocation and using stack allocation or smart pointers instead, enhancing code safety and clarity.

Copy link

coderabbitai bot commented Sep 26, 2024

Walkthrough

The changes involve refactoring memory management across multiple source files by replacing raw pointers with smart pointers and stack-allocated objects. This transition enhances memory safety by automating resource management and eliminating the need for manual deallocation. Additionally, new methods are introduced in the FilletPoint class to improve functionality, while existing methods are updated to reflect these changes.

Changes

File Path Change Summary
src/Approx/Approx_CurveOnSurface.cxx Replaced raw pointer CutTool with std::unique_ptr aCutTool, updating memory management practices.
src/BSplCLib/BSplCLib.cxx Replaced dynamic arrays for knots and poles with NCollection_Array1, streamlining memory management.
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx Changed aShapesSection from a raw pointer to std::unique_ptr, enhancing memory safety.
src/Bisector/Bisector_Inter.cxx Replaced dynamic arrays with NCollection_Array1 for curves and domains, improving memory management.
src/ChFi2d/ChFi2d_FilletAlgo.cxx Updated FilletPoint handling to use std::unique_ptr, added Reset method, modified Copy method.
src/ChFi2d/ChFi2d_FilletAlgo.hxx Introduced Reset and modified Copy methods in FilletPoint class.
src/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx Removed dynamic allocation for IntPatch_LineConstructor, using stack allocation instead.

Sequence Diagram(s)

sequenceDiagram
    participant A as User
    participant B as FilletPoint
    participant C as ChFi2d_FilletAlgo

    A->>C: Call FillDiff()
    C->>B: Create FilletPoint with make_unique
    B->>B: Reset parameters
    B->>C: Return FilletPoint
    C->>A: Return result
Loading

🐰 In the code where pointers once roamed,
Smart pointers now call it home.
Memory leaks, they now evade,
With every change, a safer glade.
Hopping through code, we celebrate,
For clearer paths, we elevate! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (7)
src/ChFi2d/ChFi2d_FilletAlgo.hxx (2)

149-151: LGTM! Consider enhancing the documentation.

The addition of the Reset method is a good improvement to the FilletPoint class, allowing for object reuse. This can potentially improve performance in scenarios where FilletPoint objects are frequently reset.

Consider adding a brief explanation of what the "default version" entails in the method comment. For example:

//! Resets a point to the default version (e.g., clears all computed values and sets the parameter)
void Reset(const Standard_Real theParam);

This would provide more clarity to users of the class.


197-200: LGTM! Consider enhancing documentation and method name for clarity.

The addition of the Copy method provides a useful way to partially copy FilletPoint objects. This can be beneficial for performance in scenarios where only specific attributes need to be copied.

  1. Consider renaming the method to PartialCopy or CopyEssentialAttributes to make it immediately clear that this is not a full copy.
  2. Enhance the method comment to explain why only these specific attributes are copied and in what scenarios this partial copy is useful.
  3. Consider adding a const qualifier to the method to indicate that it doesn't modify the current object.

Here's an example of how you might implement these suggestions:

//! Copies essential attributes (myParam, myV, myD, myValid) to the given point.
//! This partial copy is useful for [explain specific use case].
//! Note: Other attributes are not copied and retain their default values.
void PartialCopy(FilletPoint& thePoint) const;

These changes would improve the clarity and usability of the method.

src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx (2)

129-130: Great improvement in memory management

The transition from raw pointers to std::unique_ptr significantly enhances memory safety:

  1. Automatic resource management prevents potential memory leaks.
  2. Usage of opencascade::make_unique ensures exception safety during object construction.

This change aligns well with modern C++ best practices.

Consider using auto for type deduction to improve readability:

-std::unique_ptr<BinLDrivers_DocumentSection> aShapesSection;
+auto aShapesSection = std::unique_ptr<BinLDrivers_DocumentSection>();

-aShapesSection = opencascade::make_unique<BinLDrivers_DocumentSection> (SHAPESECTION_POS,
-                                                                        Standard_False);
+aShapesSection = opencascade::make_unique<BinLDrivers_DocumentSection>(SHAPESECTION_POS,
+                                                                       Standard_False);

Also applies to: 135-136


Line range hint 1-1000: Summary: Improved memory safety and code organization

The changes in this file represent a significant improvement in memory management and code organization:

  1. Transition from raw pointers to std::unique_ptr for automatic resource management.
  2. Use of opencascade::make_unique for exception-safe object construction.
  3. Proper deallocation using reset() instead of manual deletion.
  4. Improved header organization and inclusion.

These modifications align with modern C++ best practices and enhance the overall quality and safety of the code without altering its core functionality. This refactoring is a positive step towards modernizing the codebase and reducing the risk of memory-related issues.

Consider extending this approach to other parts of the codebase:

  1. Gradually replace raw pointers with smart pointers where appropriate.
  2. Use RAII principles consistently across the project.
  3. Implement a code review checklist to ensure these best practices are followed in future changes.
src/Approx/Approx_CurveOnSurface.cxx (2)

449-449: LGTM: Improved memory management with smart pointers

The replacement of raw pointers with std::unique_ptr and the use of opencascade::make_unique for initialization significantly improves memory safety and exception safety in this code. These changes eliminate the need for manual memory management and reduce the risk of memory leaks.

Consider removing the explicit aCutTool.reset() call at line 486, as it's redundant. The unique_ptr will automatically clean up when it goes out of scope at the end of the function.

Also applies to: 455-455, 466-466, 477-477, 486-486


Line range hint 449-486: Excellent refactoring for improved memory management

The changes in this section significantly enhance the memory management of the Perform function. By replacing raw pointers with std::unique_ptr and using opencascade::make_unique for object creation, the code becomes more robust against memory leaks and exception-related issues. These modifications align well with modern C++ best practices and contribute to overall code quality and safety.

Consider applying similar smart pointer patterns consistently across the codebase to further improve memory safety and reduce the risk of resource leaks.

src/ChFi2d/ChFi2d_FilletAlgo.cxx (1)

283-289: Replace magic number 999. with a named constant

To improve code readability and maintainability, consider defining the magic number 999. as a named constant or provide a comment explaining its significance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 495a6a6 and 6e36469.

📒 Files selected for processing (7)
  • src/Approx/Approx_CurveOnSurface.cxx (4 hunks)
  • src/BSplCLib/BSplCLib.cxx (10 hunks)
  • src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx (3 hunks)
  • src/Bisector/Bisector_Inter.cxx (4 hunks)
  • src/ChFi2d/ChFi2d_FilletAlgo.cxx (6 hunks)
  • src/ChFi2d/ChFi2d_FilletAlgo.hxx (2 hunks)
  • src/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx (1 hunks)
🔇 Additional comments (17)
src/ChFi2d/ChFi2d_FilletAlgo.hxx (1)

Line range hint 1-200: Overall, the changes improve the FilletPoint class functionality.

The additions of the Reset and Copy methods to the FilletPoint class are positive improvements that enhance the flexibility and potential performance of the code. These methods allow for more efficient reuse and partial copying of FilletPoint objects, which could be particularly beneficial in performance-critical scenarios.

The changes are consistent with the existing code style and conventions, maintaining the overall quality and readability of the codebase. The minor suggestions provided for improving documentation and naming will further enhance the clarity and usability of these new methods.

These changes align well with the PR objective of refactoring memory management, as they provide more control over object lifecycle and data copying, which can lead to more efficient memory usage.

src/Bisector/Bisector_Inter.cxx (5)

102-105: Excellent use of NCollection_Array1 for improved memory management

The replacement of dynamically allocated arrays with NCollection_Array1 is a positive change. This approach enhances memory safety by automating resource management and eliminating the need for manual deallocation. The array sizes are correctly set based on the number of intervals plus one, ensuring proper allocation for all elements.


135-136: Correct usage of SetValues for anArrayOfDomainBis1

The SetValues method is correctly used to populate the anArrayOfDomainBis1 array. The parameters and tolerances are passed appropriately, maintaining the original functionality while utilizing the new NCollection_Array1 data structure.


143-143: Correct assignment of curve values to anArrayOfCurveBis1

The code correctly assigns values to anArrayOfCurveBis1 for different cases. It properly handles the extended parts by constructing a segment (line 143) and the regular case by directly assigning Bis1 (line 146). This preserves the original logic while using the new NCollection_Array1 data structure.

Also applies to: 146-146


197-198: Correct usage of NCollection_Array1 objects in SinglePerform call

The SinglePerform method is correctly called with the new NCollection_Array1 objects. The indexing of the arrays (IB1 and IB2) is appropriate, completing the transition from dynamically allocated arrays to NCollection_Array1. This change maintains the original functionality while improving memory management.


Line range hint 1-424: Summary of changes: Improved memory management in Bisector_Inter

The changes in this file successfully refactor the memory management by replacing dynamically allocated arrays with NCollection_Array1. This transition enhances memory safety by automating resource management and eliminating the need for manual deallocation. The functionality of the code has been preserved while improving its robustness and aligning with modern C++ practices.

Key improvements:

  1. Replaced raw pointers with NCollection_Array1 for curves and domains.
  2. Eliminated manual memory deallocation, reducing the risk of memory leaks.
  3. Maintained the original logic and functionality while using safer data structures.

One minor issue was identified: a typo in a condition checking the number of intervals for Bis2. This should be addressed for consistency and correctness.

Overall, these changes significantly improve the code quality and align well with the PR objective of refactoring memory management.

src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx (3)

16-16: LGTM: Improved header management

The changes to the header inclusions are well-structured:

  1. Including the class's own header file at the top is a good practice.
  2. Splitting the Message headers improves modularity.
  3. Adding Standard_MemoryUtils.hxx aligns with the goal of improving memory management.

These modifications enhance code organization and prepare for the memory management improvements.

Also applies to: 26-27, 30-30


168-168: Correct usage of unique_ptr

The replacement of manual deletion with reset() is the proper way to handle memory deallocation for unique_ptr. This change:

  1. Ensures consistent memory management throughout the lifecycle of aShapesSection.
  2. Improves exception safety.
  3. Aligns with modern C++ best practices.

Line range hint 16-168: Verify impact on the codebase

The changes improve memory management without altering the class's public API or core logic. This should result in:

  1. No negative impact on existing code interacting with this class.
  2. Potential prevention of memory-related issues in the future.

To ensure there are no unintended consequences:

Run the following script to check for any changes in the public API or usage of this class:

src/Approx/Approx_CurveOnSurface.cxx (2)

40-40: LGTM: Inclusion of memory utilities header

The addition of Standard_MemoryUtils.hxx is appropriate for the upcoming changes related to smart pointer usage, which will improve memory management in the code.


484-484: LGTM: Updated constructor call

The change from *CutTool to *aCutTool in the AdvApprox_ApproxAFunction constructor call is correct and consistent with the switch to using a smart pointer. This ensures that the underlying AdvApprox_Cutting object is properly passed to the constructor.

src/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx (1)

400-409: Improved memory safety, but verify correctness and performance

The changes replace dynamic memory allocation with stack allocation for IntPatch_LineConstructor objects, which improves memory safety by eliminating manual memory management. This is a positive change that reduces the risk of memory leaks and improves code maintainability.

However, please consider the following points:

  1. Ensure that the new implementation correctly handles all cases that the old one did, especially if there were any specific reasons for using dynamic allocation before.

  2. Be aware of potential stack overflow issues if IntPatch_LineConstructor is a large object and this method is called with deep recursion or in a constrained stack environment.

  3. Verify that the loop logic (which is not shown in this diff) has been appropriately adjusted to work with the new stack-allocated object instead of the previous array of pointers.

To ensure the changes don't introduce any regressions, please run the following verification:

✅ Verification successful

Memory management improvements verified successfully

The removal of malloc and free in src/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx has been confirmed, ensuring that dynamic memory allocation has been replaced with stack allocation for IntPatch_LineConstructor. Additionally, the loop logic involving aLineConstructor remains correct and functions as intended.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining uses of malloc or free in this file
rg --type cpp "(malloc|free)\(" src/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx

# Check for any changes in the loop logic that uses aLineConstructor
rg --type cpp -A 10 "aLineConstructor" src/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx

Length of output: 869

src/ChFi2d/ChFi2d_FilletAlgo.cxx (5)

35-35: Confirmation of necessary include directive

The inclusion of <Standard_MemoryUtils.hxx> is necessary for the use of opencascade::make_unique, which enhances memory management.


329-330: Use of std::unique_ptr for aLeft and aRight enhances memory safety

Transitioning to smart pointers eliminates manual memory management and reduces the risk of memory leaks.


341-343: Consistent use of smart pointers for aRight

Using std::unique_ptr for aRight aligns with modern C++ practices and ensures proper resource management.


345-346: Appropriate use of raw pointers from smart pointers

Passing raw pointers obtained via .get() from std::unique_ptr to functions expecting raw pointers is appropriate in this context.


645-658: Addition of FilletPoint::Reset method

The new Reset method correctly initializes myParam, resets myParam2 to zero, and clears internal data structures. This enhances object reusability and maintains consistent state.

Comment on lines +175 to +186
anArrayOfDomainBis2 [IB2].SetValues(PMin,UMin,D2.FirstTolerance(),
PMax,UMax,D2.LastTolerance());

if ((IB2 == 1 && Bis2->IsExtendAtStart()) ||
(IB2 == Bis1->NbIntervals() && Bis2->IsExtendAtEnd()) ){
//--------------------------------------------------------
// Part corresponding to an extension is a segment.
//--------------------------------------------------------
SBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax);
anArrayOfCurveBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax);
}
else {
SBis2 [IB2] = Bis2;
anArrayOfCurveBis2 [IB2] = Bis2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct assignment of values to anArrayOfDomainBis2 and anArrayOfCurveBis2 with a minor typo

The code correctly assigns values to anArrayOfDomainBis2 and anArrayOfCurveBis2, consistent with the changes made for Bis1. The usage of NCollection_Array1 is appropriate and maintains the original functionality.

However, there's a minor typo in the condition on line 180:

-	       (IB2 == Bis1->NbIntervals() && Bis2->IsExtendAtEnd())    ){
+	       (IB2 == Bis2->NbIntervals() && Bis2->IsExtendAtEnd())    ){

This should be corrected to use Bis2 instead of Bis1 for consistency and correctness.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
anArrayOfDomainBis2 [IB2].SetValues(PMin,UMin,D2.FirstTolerance(),
PMax,UMax,D2.LastTolerance());
if ((IB2 == 1 && Bis2->IsExtendAtStart()) ||
(IB2 == Bis1->NbIntervals() && Bis2->IsExtendAtEnd()) ){
//--------------------------------------------------------
// Part corresponding to an extension is a segment.
//--------------------------------------------------------
SBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax);
anArrayOfCurveBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax);
}
else {
SBis2 [IB2] = Bis2;
anArrayOfCurveBis2 [IB2] = Bis2;
anArrayOfDomainBis2 [IB2].SetValues(PMin,UMin,D2.FirstTolerance(),
PMax,UMax,D2.LastTolerance());
if ((IB2 == 1 && Bis2->IsExtendAtStart()) ||
(IB2 == Bis2->NbIntervals() && Bis2->IsExtendAtEnd()) ){
//--------------------------------------------------------
// Part corresponding to an extension is a segment.
//--------------------------------------------------------
anArrayOfCurveBis2 [IB2] = ConstructSegment (PMin,PMax,UMin,UMax);
}
else {
anArrayOfCurveBis2 [IB2] = Bis2;

Comment on lines +384 to +386
auto aPoint1 = opencascade::make_unique<FilletPoint> (theLeft->getParam());
theLeft->Copy (aPoint1.get());
auto aPoint2 = opencascade::make_unique<FilletPoint> (theParameter);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct argument type in Copy method call

The Copy method expects a reference to FilletPoint, but aPoint1.get() returns a pointer. Please dereference the pointer when calling the method:

theLeft->Copy(*aPoint1);

Comment on lines +821 to +828
//=======================================================================
//function : Copy
//purpose :
//=======================================================================
FilletPoint* FilletPoint::Copy()
{
FilletPoint* aCopy = new FilletPoint(myParam);
Standard_Integer a;
for(a = 1; a <= myV.Length(); a++)
{
aCopy->myV.Append(myV.Value(a));
aCopy->myD.Append(myD.Value(a));
aCopy->myValid.Append(myValid.Value(a));
}
Copy(*aCopy);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Undeclared variable aCopy in FilletPoint::Copy()

The variable aCopy is used without declaration, leading to a compilation error. Please declare aCopy before using it:

FilletPoint* aCopy = new FilletPoint(myParam);
Copy(*aCopy);
return aCopy;

Comment on lines +836 to +841
void FilletPoint::Copy (FilletPoint& thePoint)
{
thePoint.myV.Assign(myV);
thePoint.myD.Assign(myD);
thePoint.myValid.Assign(myValid);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure all relevant member variables are copied in FilletPoint::Copy

The Copy method copies myV, myD, and myValid, but does not copy myParam, myParam2, and myNear. Consider copying these members as well to ensure a complete duplication of the object's state.

Comment on lines +1903 to +1905
NCollection_Array1<Standard_Real> knots (0, 2 * Degree);
NCollection_Array1<Standard_Real> poles (0, (2 * Degree + 1) * Dimension);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Incorrect use of ChangeFirst() when a pointer is expected

The method ChangeFirst() of NCollection_Array1 returns a reference to the first element, not a pointer to the internal data array. In the code, you are passing knots.ChangeFirst() and poles.ChangeFirst() to functions that expect a pointer to the data array (Standard_Real*). This may lead to incorrect behavior or compilation errors.

To obtain a pointer to the internal data, you should take the address of the first element using &knots.ChangeValue(knots.Lower()) or use knots.ChangeData() if available.

Apply the following changes to fix the issue:

- NCollection_Array1<Standard_Real> knots (0, 2 * Degree);
- NCollection_Array1<Standard_Real> poles (0, (2 * Degree + 1) * Dimension);

...

- BuildKnots(Degree, curnk, Periodic, nknots, &nmults, knots.ChangeFirst());
+ BuildKnots(Degree, curnk, Periodic, nknots, &nmults, &knots.ChangeValue(knots.Lower()));

...

- BuildBoor(index, length, Dimension, npoles, poles.ChangeFirst());
+ BuildBoor(index, length, Dimension, npoles, &poles.ChangeValue(poles.Lower()));

- BoorScheme(u, Degree, knots.ChangeFirst(), Dimension, poles.ChangeFirst(), depth, length);
+ BoorScheme(u, Degree, &knots.ChangeValue(knots.Lower()), Dimension, &poles.ChangeValue(poles.Lower()), depth, length);

...

- GetPole(i, length, depth, Dimension, poles.ChangeFirst(), np, ThePoles);
+ GetPole(i, length, depth, Dimension, &poles.ChangeValue(poles.Lower()), np, ThePoles);

...

- BuildKnots(Degree, curnk, Periodic, NewKnots, &NewMults, knots.ChangeFirst());
+ BuildKnots(Degree, curnk, Periodic, NewKnots, &NewMults, &knots.ChangeValue(knots.Lower()));

...

- BuildBoor(0, length, Dimension, npoles, poles.ChangeFirst());
+ BuildBoor(0, length, Dimension, npoles, &poles.ChangeValue(poles.Lower()));

- BoorScheme(NewKnots(curnk), Degree, knots.ChangeFirst(), Dimension, poles.ChangeFirst(), depth, length);
+ BoorScheme(NewKnots(curnk), Degree, &knots.ChangeValue(knots.Lower()), Dimension, &poles.ChangeValue(poles.Lower()), depth, length);

...

- GetPole(i, length, depth, Dimension, poles.ChangeFirst(), np, NewPoles);
+ GetPole(i, length, depth, Dimension, &poles.ChangeValue(poles.Lower()), np, NewPoles);

...

- NCollection_Array1<Standard_Real> knots (0, 4 * Degree);
- NCollection_Array1<Standard_Real> poles (0, (2 * Degree + 1) * Dimension);

...

- BSplCLib::BuildKnots(Degree, TheIndex-1, Periodic, Knots, &Mults, knots.ChangeFirst());
+ BSplCLib::BuildKnots(Degree, TheIndex-1, Periodic, Knots, &Mults, &knots.ChangeValue(knots.Lower()));

...

- Standard_Boolean result = AntiBoorScheme(Knots(TheIndex), Degree, knots.ChangeFirst(),
-                                          Dimension, poles.ChangeFirst(),
-                                          depth, length, Tolerance);
+ Standard_Boolean result = AntiBoorScheme(Knots(TheIndex), Degree, &knots.ChangeValue(knots.Lower()),
+                                          Dimension, &poles.ChangeValue(poles.Lower()),
+                                          depth, length, Tolerance);

Also applies to: 2019-2019, 2035-2036, 2047-2047, 2091-2091, 2095-2096, 2106-2106, 2111-2111, 2164-2165, 2174-2174, 2208-2209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant