[vtkusers] Exodus reader for VTK 5.0.4
johnnyv75 at zoominternet.net
johnnyv75 at zoominternet.net
Sun Aug 24 07:58:54 EDT 2008
All,
I am working with VTK 5.0.4 and need some help with the Exodus reader. I need
some help with handling multiple data files and multiple timesteps. I am loading
4 files each with 100 timesteps and I'm not sure how to access each timestep etc.
I'm hoping some can point me towards an example.
Thanks in advance,
John
At present here is my code to load my exodus files:
#include "vtkExodusReader.h"
#include "vtkAppendFilter.h"
#include "vtkGeometryFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include <iostream>
using std::cout;
using std::endl;
vtkAlgorithmOutput* GetGrid(char *fname);
int main(int argc, char *argv[]){
int i;
vtkAppendFilter *aData = vtkAppendFilter::New();
/*need to check for input files, if none exit*/
if (argc < 2)
cout << "Usage: ExodusReader <data file(s)>" << endl;
else{
for(i = 1; i < argc; i++)
aData->AddInputConnection( GetGrid(argv[i]) );
}
vtkGeometryFilter *geo = vtkGeometryFilter::New();
geo->SetInputConnection( aData->GetOutputPort() );
vtkPolyDataMapper *dataMapper = vtkPolyDataMapper::New();
dataMapper->SetInputConnection( geo->GetOutputPort() );
dataMapper->ScalarVisibilityOn();
dataMapper->SetScalarModeToUseCellData();
dataMapper->SelectColorArray("ObjectId");
vtkActor *dataActor = vtkActor::New();
dataActor->SetMapper( dataMapper );
vtkRenderer *ren1= vtkRenderer::New();
ren1->AddActor( dataActor );
ren1->SetBackground( 0.1, 0.2, 0.4 );
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer( ren1 );
renWin->SetSize( 300, 300 );
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
renWin->Render();
// begin mouse interaction
iren->Start();
return 0;
}
vtkAlgorithmOutput* GetGrid(char *fname){
vtkExodusReader *reader = vtkExodusReader::New();
reader->SetFileName(fname);
reader->Update();
reader->SetAllBlockArrayStatus(1);
reader->SetAllCellArrayStatus(1);
return reader->GetOutputPort();
}
More information about the vtkusers
mailing list