Skip to content

Foundation Classes - Implement move semantics for math_Matrix and math_Vector#841

Merged
dpasukhi merged 3 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:math_move_operator
Nov 24, 2025
Merged

Foundation Classes - Implement move semantics for math_Matrix and math_Vector#841
dpasukhi merged 3 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:math_move_operator

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

  • Added move constructors and move assignment operators for math_Matrix and math_Vector classes to optimize resource management.
  • Enhanced tests for move semantics to validate behavior with both large and small matrices/vectors.
  • Ensured proper handling of source state after moves, including dimension mismatch scenarios.

…h_Vector

- Added move constructors and move assignment operators for math_Matrix and math_Vector classes to optimize resource management.
- Enhanced tests for move semantics to validate behavior with both large and small matrices/vectors.
- Ensured proper handling of source state after moves, including dimension mismatch scenarios.
…bleTab and math_VectorBase to improve resource management.

- Added buffer handling for small arrays to optimize performance.
- Ensured proper assignment behavior in the copy assignment operator to prevent self-assignment issues.
- Removed tests for assignment dimension mismatch scenarios in move semantics for both math_Matrix and math_Vector.
- Streamlined test cases to focus on valid move operations, enhancing clarity and maintainability.
@dpasukhi dpasukhi added this to the Release 8.0 milestone Nov 19, 2025
@dpasukhi dpasukhi requested a review from Copilot November 19, 2025 16:48
@dpasukhi dpasukhi self-assigned this Nov 19, 2025
@dpasukhi dpasukhi added 2. Enhancement New feature or request 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code labels Nov 19, 2025
@dpasukhi dpasukhi changed the title Implement move semantics for math_Matrix and math_Vector Foundation Classes - Implement move semantics for math_Matrix and math_Vector Nov 19, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements move semantics for math_Matrix and math_Vector classes to optimize resource management and improve performance when transferring ownership of large matrix/vector objects.

Key Changes:

  • Added move constructors and move assignment operators to math_VectorBase, math_Matrix, and math_DoubleTab
  • Optimized move operations to avoid unnecessary copying when dimensions match and both objects use heap allocation
  • Added comprehensive test coverage for move semantics with both heap-allocated (large) and buffer-allocated (small) objects

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
math_VectorBase.hxx Added move constructor and move assignment operator declarations
math_VectorBase.lxx Implemented move constructor with conditional buffer/heap logic and move assignment operator
math_Matrix.hxx Updated move assignment operator signature (removed noexcept)
math_Matrix.lxx Enhanced move assignment operator with dimension matching logic and fallback to copy
math_DoubleTab.hxx Added move constructor, copy/move assignment operators, and IsDeletable() helper method
math_Vector_Test.cxx Added comprehensive tests for move constructor and move assignment with large and small vectors
math_Matrix_Test.cxx Added comprehensive tests for move constructor and move assignment with large and small matrices

Comment thread src/FoundationClasses/TKMath/math/math_VectorBase.lxx
//==================================================================================================

inline math_Matrix& math_Matrix::operator=(math_Matrix&& Other) noexcept
inline math_Matrix& math_Matrix::operator=(math_Matrix&& Other)
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

Parameter name 'Other' does not follow the OCCT naming convention. It should be 'theOther' to match the project's parameter naming pattern (theParameterName).

Copilot uses AI. Check for mistakes.
Comment thread src/FoundationClasses/TKMath/math/math_VectorBase.lxx
Comment thread src/FoundationClasses/TKMath/math/math_Matrix.lxx
Comment thread src/FoundationClasses/TKMath/math/math_DoubleTab.hxx
@github-project-automation github-project-automation bot moved this from Todo to Integration in Maintenance Nov 24, 2025
@dpasukhi dpasukhi merged commit 6730c84 into Open-Cascade-SAS:IR Nov 24, 2025
67 of 69 checks passed
@github-project-automation github-project-automation bot moved this from Integration to Done in Maintenance Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 2. Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants