Skip to content

Conversation

alexbenedicto
Copy link
Collaborator

Closes #80

@alexbenedicto alexbenedicto changed the title VTK filters for mesh doctor feat: VTK filters for mesh-doctor Aug 13, 2025
@alexbenedicto alexbenedicto marked this pull request as ready for review August 13, 2025 01:10
Copy link
Contributor

@RomainBaville RomainBaville left a comment

Choose a reason for hiding this comment

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

The code is good and essay to read but some typing and docstrings are missing.

More over, I don't understand some points :

  • why the check check_fractures is not also check in the function AllChecks.
  • why the doc is duplicaded (a file.rst and a doc part in the filter files)
  • why you use the VTKPythonAlgorithmBase for the filter while the mesh exists already, and with the VTKPythonWrapping we use, the vtk objects are pointers. Meshes can be updated without the VTKPythonAlgorithmBase pipline.
  • why in the filter you use member function to set some variable (mesh, tolerance ...) while they can set as arguments.

At least, the function get_vtk_constant_str in genericHelpers needs to be updated. For now it can return a false name because severals VTK_CONSTANT refers to the same number.

Copy link
Contributor

@RomainBaville RomainBaville left a comment

Choose a reason for hiding this comment

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

It seems good for me, thanks for your answer.
I have just a comment about the logger, for the moment it works but a specific handle has to be used for paraview. With your method, it will not easy but it can be done in a future pr.

@@ -1,8 +1,9 @@
from dataclasses import dataclass
from typing import Dict, FrozenSet, List, Set
Copy link
Contributor

Choose a reason for hiding this comment

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

Why import "List", "Dict", "FrozenSet" and "Set" from typing while "list", "dict", "frozenset" and "set" already are in python?

listValues=listValues,
attributeName=field_info.name,
onPoints=onPoints )
if not success:
Copy link
Contributor

Choose a reason for hiding this comment

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

createConstantAttributeDataSet already log an error if the attribute is not created.

success = createConstantAttributeDataSet( dataSet=mesh,
listValues=listValues,
attributeName=field_info.name,
onPoints=onPoints )
Copy link
Contributor

Choose a reason for hiding this comment

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

You use another logger as the internal one used by this function, you should give your logger to the function (logger=setup_logger) to be sure to keep the same dysplay and names.


io_logger.info( "Reader did not match the file format." )
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use .info and not .warning or .error? The function didn't succed to read the file.

writer.SetInputData( mesh )
writer.SetDataModeToBinary() if toBinary else writer.SetDataModeToAscii()
return writer.Write()
if not output_mesh:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you test again output_mesh? You could raise the ValueError after the for.

Copy link
Contributor

@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.

The general code implementation looks good to me, I have some remarks regarding the documentation and the formatting.

  • for the .rst files of filters, the documentation is very exhaustive (which is good ! ), but I'm wondering what's the reason for not using automodule or literalinclude functionality, at least for some parts ?
    It seems there are also some cases when the code documentation is less detailed than the .rst file... For example in the CollocatedNodes::setPaintWrongSupportElements function, you don't indicate that the default value for the filter would be 0 while it is in the .rst doc.

  • The docstring documentation of functions is incomplete/inexistant in many files, there are the name and type of variables, but the description is often missing.

  • You changed the docstring format from Google docstring to reST in some files (geos-mesh/src/geos/mesh/doctor/actions/non_conformal.py), and did the opposit in some others (geos-mesh/src/geos/mesh/doctor/actions/supported_elements.py)

  • I'm curious about the use of m_ convention for the class attributes, it is pretty unusual in python.

Comment on lines +53 to +57
"""
Builds the face to face connectivities (through edges) for prism graphs.
:param n: The number of nodes of the basis (i.e. the pentagonal prims gets n = 5)
:param name: A human-readable name for logging purpose.
:return: A graph instance.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why changing the doc formatting ?

"""Writes a .vtu file of the vtkUnstructuredGrid at the specified filepath.

Args:
filepath (str): /path/to/your/file.vtu
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
filepath (str): /path/to/your/file.vtu
filepath (str): The output file path.

from typing import Tuple
from vtkmodules.vtkCommonCore import vtkIdList, vtkPoints
from vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, VTK_POLYHEDRON
from vtkmodules.vtkCommonDataModel import ( vtkUnstructuredGrid, vtkQuad, vtkTetra, vtkHexahedron, vtkPolyhedron,
vtkCellArray, VTK_POLYHEDRON, VTK_QUAD, VTK_TETRA, VTK_HEXAHEDRON )
# from geos.mesh.doctor.actions.supported_elements import Options, action, __action
Copy link
Contributor

Choose a reason for hiding this comment

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

__action can be removed here

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.

Create vtk filters for mesh-doctor features
3 participants