txt2vtk.py

File uploaded by Toby on Feb 21, 2017
Version 1Show Document
  • View in full screen mode

Following up on a previous discussion about field export from ADS FEM / EMpro (basically emds_viewer) https://community.keysight.com/message/28014, I'd like to share a quickly developed snippet of python code, which is able to convert exported field given Keysight proprietary txt format (export from emds_viewer) to generic VTK legacy unstructured grid binary format, which can be loaded into any scientific visualization tool based on VTK (Paraview, MayaVi, Visit, etc.). 


The code is verified to run with the Python 2.7 install shipped with ADS ( e.g. $HPEESOF_DIR/tools/win32_64/python on windows), but typically any python 2.7  or later is likely to work.

The only argument required is the exported txt field file name. But anyone using it is advised to have a look on the code and adapt to specific needs.

 

Conversion is going to take some time, as the exported txt file is "unwinded" with respect o vertex information and all information regarding mesh topology (shared vertices between mesh cells) is lost. Rebuilding this topology (=> a common vertex table) requires an extensive search & compare implemented based on a multi-level linked list of associative arrays to get aceptable speed for large number of vertices (>>100k). Thoughput of the current implementation is in the order of 5k..10k tetrahedrons per second even for 100k vertices, which is acceptable. But for sure, lots of room for improvement ;-)

 

Have fun!

Toby

Attachments

Outcomes