VtkIO::xdmf python lib

Hello all,

I’m trying to compile the vtkXdmfReader and expose it to python. Haven’t tried that much but I can guess that you can give me a headstart :slight_smile: . So I compile VTK with python wrapping and everything works great (beside vtkpythonQt*, compiled pyds seems to appropriately load to python’s interpreter). I cannot find where the py class vtkXDmfReader is located in the wrapping, so I’m guessing it should be a vtkIOxdmf module, equivalent to vtokIOExodusReader or equivalent IO modules. Looking into the compiled dll’s I’ve noticed that vtkxdmf (the vtk xdlf library interface) compiles correctly but I can’t find any py equivalent vtkIOXdfm… So there is where the things get wired since shouldn’t there be an associated dll to produce the *.pyd? And I didn’t find one in the build, so I’m guessing that there’s a compilation error somewhere… I build with MSVC 17, python 3.9/10, Qt5.15.

Do you have any suggestions for compiling VTK::IOXdmf (9.1.0) with python wrappings in windows?

I’ll Guess I’ll try tomorrow with master ! Let me know what you think :thinking: and thanks!!

Is the VTK::IOXdmf2 module enabled? It should be available as from vtkmodules.vtkIOXdmf2 import vtkXdmfReader once it is being built.

Thanks for the immediate response.

Both are configured from “default” to “yes”, wrappings enabled etc. I’ve noticed that there also a readme file in vtkIOXdmf, that I believe that it’s not related to my case(or is it…? Not sure). Thank you for confirming my hypothesis about the module localisation.

Would you happen to know if VTKpython by default, i.e pip install VTK, support vtkIOxdmf?

As I continue checking, I’ve also noticed that there is an inconsistency at build-dir/CMakeFiles/vtkIOExodusPython and the equivalent of vtkIOXdmf2Python that misses the wrapped cxx files I guess, *Python.cxx files (actually it’s both from the *Python and *PythonPython folders).

Lete Know what you think! And many thanks!!

This seems to be documentation about the reduced Xdmf2 library import in VTK. It’s not really important here.

It should.

Could you be more specific? What is this “inconsistency”? What files do you expect to be there that aren’t?

Hehe just checked! It isn’t! Could you please confirm in case of an odd typo that I hope I’ve not committed…

Thanks for your replies. The files that I except are the vtkClassPython.cxx where Class is the vtk::IOXdmf2 (cmake)module c++ classes (auto generated by VTKpythonWrappings I guess) for the folder vtkIOXdmf2Python and the init and initImpl equivalents for the vtkXdmf2PythonPython folder. Im only getting the *-[cofigType].args files for the vtkIOXdmf2Python folder and the file vtkIOXdmf2-init.data file in vtkIOXdmf2PythonPython folder…

I did pip install vtk from a venv:

% bin/python
Python 3.10.6 (main, Aug  2 2022, 00:00:00) [GCC 12.1.1 20220507 (Red Hat 12.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from vtkmodules import vtkIOXdmf2
>>> vtkIOXdmf2.vtkXdmfReader()
<vtkmodules.vtkIOXdmf2.vtkXdmfReader(0x56165a0335a0) at 0x7feef2ff10c0>
>>>

A local build also shows the wrapper output sources:

./CMakeFiles/vtkIOXdmf2Python/vtkXdmfReaderPython.cxx
./CMakeFiles/vtkIOXdmf2Python.dir/CMakeFiles/vtkIOXdmf2Python/vtkXdmfReaderPython.cxx.o

Many Thanks!

Everything works fine :slight_smile: and compiles as anticipated with rc2,
min config opts:
VTK_WRAP_PYTHON=ON
VTK_MODULE_ENABLE_VTK_IOXdmf2=ON
at Release mode