Skip to content

feat: improve and update of geos-mesh utils functions #109

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

RomainBaville
Copy link

@RomainBaville RomainBaville commented Jun 27, 2025

This PR updates the utils functions of geos-mesh:

  • Functions are added to arrayHelper.py
  • Functions in arrayModifiers are updated to be more global and consistent
    • VTK data type and value type are checked to be coherent
    • No more hard coded variable
  • Tests in test_arrayModifiers.py are updated to check more unit case

close #108

Comment on lines +354 to +359
npArraycreated: npt.NDArray[ Any ] = vnp.vtk_to_numpy( createdAttribute )
assert ( npArray == npArraycreated ).all()
assert valueType == npArraycreated.dtype

vtkDataTypeCreated: int = createdAttribute.GetDataType()
assert vtkDataTypeTest == vtkDataTypeCreated
Copy link
Contributor

Choose a reason for hiding this comment

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

same remark about test result and reference

Comment on lines +362 to +378
@pytest.mark.parametrize( "componentNames, componentNamesTest, onPoints, vtkDataType, vtkDataTypeTest, valueType", [
( (), (), True, VTK_FLOAT, VTK_FLOAT, "float32" ),
( (), (), False, VTK_FLOAT, VTK_FLOAT, "float32" ),
( (), (), True, None, VTK_FLOAT, "float32" ),
( (), (), False, None, VTK_FLOAT, "float32" ),
( (), ( "Component0", "Component1" ), True, VTK_FLOAT, VTK_FLOAT, "float32" ),
( (), ( "Component0", "Component1" ), False, VTK_FLOAT, VTK_FLOAT, "float32" ),
( (), ( "Component0", "Component1" ), True, None, VTK_FLOAT, "float32" ),
( (), ( "Component0", "Component1" ), False, None, VTK_FLOAT, "float32" ),
( ( "X", "Y" ), ( "X", "Y" ), True, VTK_FLOAT, VTK_FLOAT, "float32" ),
( ( "X", "Y" ), ( "X", "Y" ), False, VTK_FLOAT, VTK_FLOAT, "float32" ),
( ( "X", "Y" ), ( "X", "Y" ), True, None, VTK_FLOAT, "float32" ),
( ( "X", "Y" ), ( "X", "Y" ), False, None, VTK_FLOAT, "float32" ),
( ( "X", "Y", "Z" ), ( "X", "Y" ), True, VTK_FLOAT, VTK_FLOAT, "float32" ),
( ( "X", "Y", "Z" ), ( "X", "Y" ), False, VTK_FLOAT, VTK_FLOAT, "float32" ),
( ( "X", "Y", "Z" ), ( "X", "Y" ), True, None, VTK_FLOAT, "float32" ),
( ( "X", "Y", "Z" ), ( "X", "Y" ), False, None, VTK_FLOAT, "float32" ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark about one line comments for a rapid visual about what you're testing


createdAttribute: vtkDataArray = data.GetArray( attributeName )
nbComponentsCreated: int = createdAttribute.GetNumberOfComponents()
assert nbComponents == nbComponentsCreated
Copy link
Contributor

Choose a reason for hiding this comment

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

obtained from test == expected

Comment on lines +465 to +472
assert componentNamesTest == componentsNamesCreated

npArraycreated: npt.NDArray[ Any ] = vnp.vtk_to_numpy( createdAttribute )
assert ( npArray == npArraycreated ).all()
assert valueType == npArraycreated.dtype

vtkDataTypeCreated: int = createdAttribute.GetDataType()
assert vtkDataTypeTest == vtkDataTypeCreated
Copy link
Contributor

Choose a reason for hiding this comment

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

same remark test == expected

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve geos-mesh utils functions
2 participants