Skip to content

Conversation

@RomainBaville
Copy link
Contributor

@RomainBaville RomainBaville commented Dec 29, 2025

This PR amis to:

  • Implement tests for all the arrayHelpers functions
  • Remove duplicated functions

This PR close #209

@RomainBaville RomainBaville self-assigned this Dec 29, 2025
@RomainBaville RomainBaville added flag: ready for review type: feature type: cleanup test-geos-integration Triggers the testing of geosPythonPackages import and integration in GEOS CI labels Dec 29, 2025
@RomainBaville RomainBaville marked this pull request as draft December 30, 2025 09:06
@RomainBaville RomainBaville marked this pull request as ready for review December 30, 2025 11:28
Comment on lines -1042 to -1053
def sortArrayByGlobalIds( data: Union[ vtkCellData, vtkPointData ], arr: npt.NDArray[ np.float64 ] ) -> None:
"""Sort an array following global Ids.
Args:
data (vtkFieldData): Global Ids array.
arr (npt.NDArray[ np.float64 ]): Array to sort.
"""
globalids: Optional[ npt.NDArray[ np.int64 ] ] = getNumpyGlobalIdsArray( data )
if globalids is not None:
arr = arr[ np.argsort( globalids ) ]
else:
logging.warning( "No sorting was performed." )
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am surprised by the complete removal of this function. The function getNumpyArrayByName is not a duplicate.

Copy link
Contributor Author

@RomainBaville RomainBaville Jan 22, 2026

Choose a reason for hiding this comment

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

You are right, it is not duplicated but It is not used and I do not fund any situation where it could be used. Even if a mesh is not sorted with global ID, for what I have seen, the global ID numerotation follows the one of the cell ID, the array does not need to be sort. But I can undo it if you think we need it.

Copy link
Collaborator

@paloma-martinez paloma-martinez Jan 23, 2026

Choose a reason for hiding this comment

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

OK

coordElementTo.add( cellPointsTo.GetPoint( idPointTo ) )

idElementFrom: int = 0
ElementFromFund: bool = False
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
ElementFromFund: bool = False
elementFromFund: bool = False

Should be modified in the rest of the code also

idElementFrom += 1
elif isinstance( meshFrom, vtkMultiBlockDataSet ):
listDataSetFromIds: list[ int ] = getBlockElementIndexesFlatten( meshFrom )
for DataSetFromId in listDataSetFromIds:
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
for DataSetFromId in listDataSetFromIds:
for dataSetFromId in listDataSetFromIds:

idem

listDataSetFromIds: list[ int ] = getBlockElementIndexesFlatten( meshFrom )
for DataSetFromId in listDataSetFromIds:
dataSetFrom: vtkDataSet = vtkDataSet.SafeDownCast( meshFrom.GetDataSet( DataSetFromId ) )
DataSetFromMap: npt.NDArray = computeElementMapping( dataSetFrom, meshTo, piece )[ 0 ]
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
DataSetFromMap: npt.NDArray = computeElementMapping( dataSetFrom, meshTo, piece )[ 0 ]
dataSetFromMap: npt.NDArray = computeElementMapping( dataSetFrom, meshTo, piece )[ 0 ]

idem

RomainBaville and others added 2 commits January 22, 2026 14:24
Co-authored-by: paloma-martinez <104762252+paloma-martinez@users.noreply.github.com>
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: feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing tests for arrayHelpers functions

3 participants