Commit ac40aaf0 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Improving tnl-view to skip already processed files.

parent ca4e7eb7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define TNLFILE_H_

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <tnlConfig.h>
@@ -331,5 +332,15 @@ bool tnlFile :: write( const Type* buffer,
   return true;
};

inline bool fileExists( const tnlString& fileName )
{
  fstream file;
  file.open( fileName. getString(), ios::in );
  bool result( true );
  if( ! file )
     result = false;
  file.close();
  return result;
};

#endif /* TNLFILE_H_ */
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ group IO
   string mesh( "" )               [Mesh file. If none is given, a regular rectangular mesh is assumed.];
   list of string input-files(!)   [Input files.];
   list of string output-files     [Output files.];
   bool check-output-file(false)   [If the output file already exists, do not recreate it.];
   list of real level-lines        [List of level sets which will be drawn.];
   integer output-x-size           [X size of the output.];
   integer output-y-size           [Y size of the output.];
+8 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ bool convertObject( const Mesh& mesh,
                    const tnlParameterContainer& parameters )
{
   int verbose = parameters. GetParameter< int >( "verbose");
   bool checkOutputFile = parameters. GetParameter< bool >( "check-output-file" );
   tnlString outputFileName( inputFileName );
   RemoveFileExtension( outputFileName );
   tnlString outputFormat = parameters. GetParameter< tnlString >( "output-format" );
@@ -45,6 +46,12 @@ bool convertObject( const Mesh& mesh,
      cerr << "Unknown file format " << outputFormat << ".";
      return false;
   }
   if( checkOutputFile && fileExists( outputFileName ) )
   {
      if( verbose )
         cout << " file already exists. Skipping.            \r" << flush;
      return true;
   }
   if( verbose )
      cout << " writing to " << outputFileName << " ... " << flush;

@@ -156,6 +163,7 @@ bool processFiles( const tnlParameterContainer& parameters )
{
   int verbose = parameters. GetParameter< int >( "verbose");
   tnlString meshFile = parameters. GetParameter< tnlString >( "mesh" );

   Mesh mesh;
   if( meshFile != "" )
      if( ! mesh. load( meshFile ) )