[vtkusers] Writting files

Eduardo Camargo camargo at lncc.br
Mon Dec 10 12:11:43 EST 2007



Hi,

I have a problem with the vtkEnsgihtWriter, the
method creates all files correctly (array and .case files) but
doesn`t
finish the .case file until the user closes Paraview. The
method used was
the follow:



void
GenerateCaseFiles(vtkUnstructuredGrid *grid)
{
 
vtkIntArray *bids = vtkIntArray::New();
  
bids->SetName("BlockId");
   for(int i = 0;
i
< grid->GetNumberOfCells(); i++)
       bids->InsertNextValue(1);
   grid->GetCellData()->SetScalars(bids);
    
    
   
char name[256];    
   
sprintf(name,
"%s%s", this->GetOutputPath(),
"Out.case");
    
   
vtkEnSightWriter *
writer;
       
writer =
vtkEnSightWriter::New();
   
   
writer->SetFileName(name);
       
   
    
    int
blockids[2];
    blockids[0] = 1;
    blockids[1]
= 0;
   
writer->SetNumberOfBlocks(1);
   
writer->SetBlockIDs(blockids);
   
       
    
        for(int
i=0; i <
grid->GetNumberOfBlocks(); i++)
   
        {
   
       
vtkUnstructuredGrid *output_grid =
vtkUnstructuredGrid::New();
       
   
   
output_grid->DeepCopy(grid);   

   
       
    
       
   
this->GetGridOfInstantOfTime(i,
output_grid);
   
   
    
   
   
    writer->SetInput(output_grid);
           
writer->SetTimeStep(i);
       
    writer->Write();
   
       
output_grid->Delete();    
   
        }
   
    
       
writer->UpdateInformation();
   
   
writer->UpdateWholeExtent();
       
writer->Update();
        
   
   
writer->WriteCaseFile(grid->GetNumberOfBlocks());
           
    
       
writer->Delete();
       
bids->Delete();
}


Regards,



Eduardo Camargo
Analista de Sistemas
HeMoLab -
http://www.lncc.br/prjhemo
Laboratório Nacional de
Computação
Científica - LNCC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071210/f392f5f6/attachment.htm>


More information about the vtkusers mailing list