Skip to content

refactor: Refactor arrayModifiers functions#225

Open
RomainBaville wants to merge 8 commits intomainfrom
RomainBaville/refactor/RefactorArrayModifiersFunctions
Open

refactor: Refactor arrayModifiers functions#225
RomainBaville wants to merge 8 commits intomainfrom
RomainBaville/refactor/RefactorArrayModifiersFunctions

Conversation

@RomainBaville
Copy link
Contributor

@RomainBaville RomainBaville commented Feb 11, 2026

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.

@RomainBaville RomainBaville self-assigned this Feb 11, 2026
@RomainBaville RomainBaville added type: cleanup test-geos-integration Triggers the testing of geosPythonPackages import and integration in GEOS CI type: refactor flag: ready for review labels Feb 11, 2026
@RomainBaville RomainBaville marked this pull request as ready for review February 11, 2026 13:45
@RomainBaville RomainBaville requested review from jafranc and paloma-martinez and removed request for paloma-martinez February 11, 2026 13:45
…sFunctions

Update to the last version of the main
Copy link
Collaborator

@paloma-martinez paloma-martinez left a comment

Choose a reason for hiding this comment

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

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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

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 )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Split the test cases please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flag: ready for review test-geos-integration Triggers the testing of geosPythonPackages import and integration in GEOS CI type: cleanup type: refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants