refactor: Refactor arrayModifiers functions#225
Open
RomainBaville wants to merge 8 commits intomainfrom
Open
Conversation
…sFunctions Update to the last version of the main
paloma-martinez
requested changes
Feb 16, 2026
Collaborator
paloma-martinez
left a comment
There was a problem hiding this comment.
Good overall, just split the test cases please !
| if elementaryBlockIndexesTo != elementaryBlockIndexesFrom: | ||
| raise ValueError( "The two meshes do not have the same block indexes." ) | ||
|
|
||
| # Parse blocks of the two mesh to copy the attribute. |
Collaborator
There was a problem hiding this comment.
Suggested change
| # Parse blocks of the two mesh to copy the attribute. | |
| # Parse blocks of the two meshes to copy the attribute. |
| The map of points/cells used to transfer the attribute is a dictionary where: | ||
| - The key is the flat index of the final mesh. | ||
| - The item is an array of size (nb elements in the final mesh, 2). | ||
| - Keys are the flat index of all the datasets of the final mesh. |
Collaborator
There was a problem hiding this comment.
Suggested change
| - Keys are the flat index of all the datasets of the final mesh. | |
| - Keys are the flat indexes of all the datasets of the final mesh. |
Comment on lines
345
to
355
| def test_createConstantAttributeRaiseValueError( dataSetTest: vtkDataSet, ) -> None: | ||
| """Test the raises ValueError for the function createConstantAttribute with wrong values.""" | ||
| mesh: vtkDataSet = dataSetTest( "dataset" ) | ||
|
|
||
| # Wrong vtk type | ||
| with pytest.raises( ValueError ): | ||
| arrayModifiers.createConstantAttribute( mesh, [ np.int32( 42 ) ], "newAttribute", vtkDataType=64 ) | ||
|
|
||
| # Wrong piece | ||
| with pytest.raises( ValueError ): | ||
| arrayModifiers.createConstantAttributeDataSet( mesh, [ np.int32( 42 ) ], "newAttribute", vtkDataType=64 ) | ||
| arrayModifiers.createConstantAttribute( mesh, [ np.int32( 42 ) ], "newAttribute", piece=Piece.BOTH ) |
Collaborator
There was a problem hiding this comment.
Split the test cases please
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.
This pr aims to refactor arrayModifiers functions to have just one function dealing with dataset or multiblock dataset instead of multiple functions.
During the factorisation of the arrayModifiers functions, a small clean is made in the tests to.