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

Viet H.Q.H viet at bakuhatsu.jp
Sat Feb 20 07:47:15 EST 2010


Dear David,

Because of forgetting to comment out some lines in an other part of the
code, the error message appeared as shown in the previous mail.
Sorry for the false report.
Now I am able to access data in Lsdyna files:

        //string dir="/home/viet/vtk_test/3dplot/";
        //string dir="/home/viet/vtk_test/airbag/";
        //string dir="/home/viet/vtk_test/billet/";
        string dir="/home/viet/vtk_test/taylor/";
        plLD->SetDatabaseDirectory(dir.c_str());
        plLD->Update();

        int dbValid=plLD->IsDatabaseValid();
        cout<<"Is database valid = "<<dbValid<<endl;
        char * title = plLD->GetTitle();
        cout<<"Title = "<<title<<endl;
        int cellArrNum = plLD->GetNumberOfCellArrays(4);
        cout<<"Number of cell arrays = "<<cellArrNum<<endl;
        int nodeNum=plLD->GetNumberOfNodes( );
        cout<<"Number of nodes = "<<nodeNum<<endl;
        plLD->Dump(cout);

By reference to "MultiBlock.cxx" in "VTK/Examples", I made a code for
rendering as follows:

        vtkMultiBlockDataSet* mbds = plLD->GetOutput();
        vtkStructuredGridOutlineFilter* of =
vtkStructuredGridOutlineFilter::New();
        of->SetInput(mbds);
        // geometry filter
        vtkCompositeDataGeometryFilter* geom1 =
vtkCompositeDataGeometryFilter::New();
        geom1->SetInputConnection(0, of->GetOutputPort(0));
        // Rendering objects
        vtkPolyDataMapper* geoMapper = vtkPolyDataMapper::New();
        geoMapper->SetInputConnection(0, geom1->GetOutputPort(0));
        vtkActor* geoActor = vtkActor::New();
        geoActor->SetMapper(geoMapper);
        geoActor->GetProperty()->SetColor(0, 0, 0);
        ren->AddActor(geoActor);

I've got a error message when compiling but still know no way to fix it.

    error: no matching function for call to
'vtkStructuredGridOutlineFilter::SetInput(vtkMultiBlockDataSet*&)'

Could you please be a little bit more specific on the matter of rendering a
vtkMultiBlockDataSet object by giving some examples or some reference links?

Thank you in advance and best regards,

Viet.


2010/2/20 Viet H.Q.H <viet at bakuhatsu.jp>

> Dear David,
>
> Thank you very much for your quick responding.
>
> As you had explained, I ran the following code for directories containing
> d3plot files generated from three examples at the site:
> http://www.dynaexamples.com
>
>     vtkLSDynaReader *plLD=vtkLSDynaReader::New( );
>     //string dir="/home/viet/vtk_test/airbag/";
>     //string dir="/home/viet/vtk_test/taylor/";
>     //string dir="/home/viet/vtk_test/billet/";
>     //plLD->SetDatabaseDirectory(dir.c_str());
>     plLD->SetDatabaseDirectory("/home/viet/vtk_test/taylor/");
>     plLD->Update();
>
> I get the following error:
>
>     ERROR: In /home/viet/VTK/IO/vtkPLOT3DReader.cxx, line 126
>     vtkPLOT3DReader (0x194f5500): Must specify geometry file
>
> How can I specify the geometry file?
> The directory "taylor" is the directory containing a d3plot file generated
> from the file taylor1.k downloaded at the site:
> http://www.dynaexamples.com/sph/bar-iv.
>
> # ls taylor
> adptmp      d3dump01.0000  d3dump01.0003  d3plot    glstat      messag0001
> mf         scr0000   scr0001h  scr0003     taylor1.k
> bg_switch   d3dump01.0001  d3full01       d3plot01  log.txt     messag0002
> run.sh     scr0000h  scr0002   scr0003h
> binout0000  d3dump01.0002  d3hsp          dyna.str  messag0000  messag0003
> run.sh.bk  scr0001   scr0002h  status.out
>
> I also got the same error message for the directories "airbag"<http://www.dynaexamples.com/examples-manual/misc/airbag>and
> "billet" <http://www.dynaexamples.com/examples-manual/control/timestep>.
> Thank you in advance and best regards,
>
> Viet.
>
>
>
> On Sat, Feb 20, 2010 at 9:49 AM, David Thompson <dcthomp at sandia.gov>wrote:
>
>> 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
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100220/45103b87/attachment.htm>


More information about the vtkusers mailing list