[vtkusers] Problem in reading more than 1000 files by vtk readers

David E DeMarle dave.demarle at kitware.com
Mon Feb 6 08:19:12 EST 2012


Does this fix it?

diff --git a/IO/vtkTecplotReader.cxx b/IO/vtkTecplotReader.cxx
index 7713098..f4afae5 100644
--- a/IO/vtkTecplotReader.cxx
+++ b/IO/vtkTecplotReader.cxx
@@ -467,6 +467,7 @@ vtkTecplotReader::vtkTecplotReader()
 // ----------------------------------------------------------------------------
 vtkTecplotReader::~vtkTecplotReader()
 {
+  this->Internal->ASCIIStream.close();
   this->Init();

   if ( this->FileName )

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



On Sun, Feb 5, 2012 at 9:28 PM, Ahmad <falahatpisheh at gmail.com> wrote:
> Hi all,
>
> I am trying to read 10,000 Tecplot ASCII files by using vtkTecplotReader.
> 1000 files in 10 different folders. I get the error *too many open files*.
> For debug purposes, I tried to read only 1000 files in one folder. I get the
> same error after reading 508 files. Could someone help me on the correct way
> of reading many files.
>
> It seems that the file handles are not released by the vtkTecplotReader.
> The way I read the files is as follows.
>
> for (int ifile = 0; ifile < 1000; ifile++){
> {
>        string fullpath_filename;
>        ostringstream strout(fullpath_filename);
>
>        for ( int i = 0 ; i < 1 ; i++){
>                vtkSmartPointer<vtkTecplotReader> reader =
>                                                                vtkSmartPointer<vtkTecplotReader>::New();
>                strout <<       direc[ifile] << "\\" << filename_prefix_veloc << setw( 6 ) <<
>                                setfill( '0' ) <<  filelist[ifile] << ".dat";
>                fullpath_vel_filename = strout.str();
>                reader->SetFileName(fullpath_filename.c_str());
>                reader->Update(); // this is the line where the error occurs when ifile ==
> 508.
>                strout.str("");
>        }
> }
>
> I am running the code on a dual quad core Xeon processors, Windows 7 64 bit
> machine with Visual Studio 2008.
>
> I would be very grateful for any help.
>
> falahatpisheh at gmail.com
> Ahmad
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Problem-in-reading-more-than-1000-files-by-vtk-readers-tp5459233p5459233.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list