-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add missing tests for array helpers #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add missing tests for array helpers #208
Conversation
…tArray already exist
| 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." ) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| DataSetFromMap: npt.NDArray = computeElementMapping( dataSetFrom, meshTo, piece )[ 0 ] | |
| dataSetFromMap: npt.NDArray = computeElementMapping( dataSetFrom, meshTo, piece )[ 0 ] |
idem
Co-authored-by: paloma-martinez <104762252+paloma-martinez@users.noreply.github.com>
This PR amis to:
This PR close #209