Loading src/core/io/tnlPGMImage.h +8 −0 Original line number Diff line number Diff line Loading @@ -28,8 +28,16 @@ class tnlPGMImage : public tnlImage< Index > typedef Index IndexType; tnlPGMImage(); bool open( const tnlString& fileName ); protected: bool binary; IndexType colors; }; Loading src/core/io/tnlPGMImage_impl.h +16 −9 Original line number Diff line number Diff line Loading @@ -21,6 +21,13 @@ #include <cstring> #include <core/io/tnlPGMImage.h> template< typename Index > tnlPGMImage< Index >:: tnlPGMImage() : binary( false ), colors( 0 ) { } template< typename Index > bool Loading @@ -42,12 +49,13 @@ open( const tnlString& fileName ) return false; } if( strcmp( magicNumber, "P5" ) != 2 && strcmp( magicNumber, "P2" ) != 2 ) cout << magicNumber << endl; if( strcmp( magicNumber, "P5" ) != 0 && strcmp( magicNumber, "P2" ) != 0 ) return false; bool binary( false ); if( strcmp( magicNumber, "P5" ) == 2 ) binary = true; if( strcmp( magicNumber, "P5" ) == 0 ) this->binary = true; char line[ 1024 ]; while( fread( line, sizeof( char ), 1, file ) && Loading @@ -58,10 +66,9 @@ open( const tnlString& fileName ) line[ 0 ] != '\n' ); else fseek( file, -1, SEEK_CUR ); Index width, height, colors; fscanf( file, "%d %d\n", &width, &height ); fscanf( file, "%d\n", &colors ); fscanf( file, "%d %d\n", &this->width, &this->height ); fscanf( file, "%d\n", &this->colors ); return true; } Loading src/mesh/tnlGrid1D.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #ifndef SRC_MESH_TNLGRID1D_H_ #define SRC_MESH_TNLGRID1D_H_ #include <mesh/tnlGrid.h> template< typename Real, typename Device, typename Index > Loading src/mesh/tnlGrid2D.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #ifndef SRC_MESH_TNLGRID2D_H_ #define SRC_MESH_TNLGRID2D_H_ #include <mesh/tnlGrid.h> template< typename Real, typename Device, typename Index > Loading src/mesh/tnlGrid3D.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #ifndef SRC_MESH_TNLGRID3D_H_ #define SRC_MESH_TNLGRID3D_H_ #include <mesh/tnlGrid.h> template< typename Real, typename Device, typename Index > Loading Loading
src/core/io/tnlPGMImage.h +8 −0 Original line number Diff line number Diff line Loading @@ -28,8 +28,16 @@ class tnlPGMImage : public tnlImage< Index > typedef Index IndexType; tnlPGMImage(); bool open( const tnlString& fileName ); protected: bool binary; IndexType colors; }; Loading
src/core/io/tnlPGMImage_impl.h +16 −9 Original line number Diff line number Diff line Loading @@ -21,6 +21,13 @@ #include <cstring> #include <core/io/tnlPGMImage.h> template< typename Index > tnlPGMImage< Index >:: tnlPGMImage() : binary( false ), colors( 0 ) { } template< typename Index > bool Loading @@ -42,12 +49,13 @@ open( const tnlString& fileName ) return false; } if( strcmp( magicNumber, "P5" ) != 2 && strcmp( magicNumber, "P2" ) != 2 ) cout << magicNumber << endl; if( strcmp( magicNumber, "P5" ) != 0 && strcmp( magicNumber, "P2" ) != 0 ) return false; bool binary( false ); if( strcmp( magicNumber, "P5" ) == 2 ) binary = true; if( strcmp( magicNumber, "P5" ) == 0 ) this->binary = true; char line[ 1024 ]; while( fread( line, sizeof( char ), 1, file ) && Loading @@ -58,10 +66,9 @@ open( const tnlString& fileName ) line[ 0 ] != '\n' ); else fseek( file, -1, SEEK_CUR ); Index width, height, colors; fscanf( file, "%d %d\n", &width, &height ); fscanf( file, "%d\n", &colors ); fscanf( file, "%d %d\n", &this->width, &this->height ); fscanf( file, "%d\n", &this->colors ); return true; } Loading
src/mesh/tnlGrid1D.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #ifndef SRC_MESH_TNLGRID1D_H_ #define SRC_MESH_TNLGRID1D_H_ #include <mesh/tnlGrid.h> template< typename Real, typename Device, typename Index > Loading
src/mesh/tnlGrid2D.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #ifndef SRC_MESH_TNLGRID2D_H_ #define SRC_MESH_TNLGRID2D_H_ #include <mesh/tnlGrid.h> template< typename Real, typename Device, typename Index > Loading
src/mesh/tnlGrid3D.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #ifndef SRC_MESH_TNLGRID3D_H_ #define SRC_MESH_TNLGRID3D_H_ #include <mesh/tnlGrid.h> template< typename Real, typename Device, typename Index > Loading