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
- get the mapping between cells or points shared by two meshes
The check functions:
- check of an attribute is on an mesh for a piece (one for dataset, one for multiblockDataset, one for the both and one for a list of attributes)
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
- check of an attribute is on an mesh for a piece (one for dataset, one for multiblockDataset, one for the both and one for a list of attributes)
- check if an attribute is on a mesh (one for dataset, one for multiblockDataset, one for the both and one for a list of attributes)

Returns:
set[str]: Set of attribute names present in input mesh.
(set[str]): Set of attribute names present in input 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
(set[str]): Set of attribute names present in input mesh.
set[str]: Set of attribute names present in input mesh.

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.

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

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