[vtkusers] How to use the vtkLSDynaReader class to handle FEM data in LSDYNA database

David Thompson dcthomp at sandia.gov
Fri Feb 19 19:49:17 EST 2010


> I am a beginner of using VTK. I was trying to use the  
> vtkLSDynaReader class to handle FEM data in LSDYNA database but  
> found no program examples to start.
>
> I checked some functions of vtkLSDynaReader class and found that  
> they didn't function well.
>
> For instance, the function CanReadFile always return the value of 1  
> regarless of the exitence of files.

Unlike many file formats, LS-Dyna stores results in many files located  
in a single directory. These files have canonical names, not user- 
specified names. So CanReadFile attempts to determine the directory  
containing whatever filename you pass it and looks for these  
canonically-named files (d3plot, for instance) in that directory.  
Therefore, instead of using SetFileName() it is recommended that you  
use SetDatabaseDirectory() to the name of a directory containing  
d3plot files.

If you have a specific circumstance where this is failing, some more  
information would help. For instance, does d3plot exist in that  
directory? Does it work if you pass CanReadFile an absolute path  
instead of a relative one like the example you included?

> Are there any starting points to use the VTK to visualize FEM data  
> in LSDYNA database?

It should be as simple as
   vtkLSDynaReader* rdr = vtkLSDynaReader::New();
   rdr->SetDatabaseDirectory( "/path/to/output" );
   rdr->Update();
After calling Update(), GetOutput() should return a pointer to a  
vtkMultiBlockDataSet that you can render.

I have tested the reader with LS-Dyna output generated from many  
examples at http://www.dynaexamples.como/ including

http://www.dynaexamples.com/examples-manual/misc/airbag
http://www.dynaexamples.com/examples-manual/control/timestep
http://www.dynaexamples.com/sph/bar-iv

One important thing to note is that the reader only parses LS-Dyna  
*output*, not LS-Dyna input decks.

	David





More information about the vtkusers mailing list