Commit 31a251ed authored by Jean-Noël Grad's avatar Jean-Noël Grad Committed by Christoph Schwarzmeier
Browse files

Improve portability of size_t and ptrdiff_t on recent compilers

parent 6e75c8a8
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "waLBerlaDefinitions.h" #include "waLBerlaDefinitions.h"
#include <cmath> #include <cmath>
#include <cstddef>
#include <cstdint> #include <cstdint>
#include <limits> #include <limits>
#include <memory> #include <memory>
...@@ -116,6 +117,8 @@ template< typename T > inline uint64_t uint64_c( T t ) { return numeric_cast< ui ...@@ -116,6 +117,8 @@ template< typename T > inline uint64_t uint64_c( T t ) { return numeric_cast< ui
// signed integral type // signed integral type
using ptrdiff_t = std::ptrdiff_t;
template< typename T > inline int int_c( T t ) { return numeric_cast< int >(t); } ///< cast to type int using "int_c(x)" template< typename T > inline int int_c( T t ) { return numeric_cast< int >(t); } ///< cast to type int using "int_c(x)"
template< typename INT > template< typename INT >
...@@ -127,7 +130,8 @@ inline void static_assert_int_t() { ...@@ -127,7 +130,8 @@ inline void static_assert_int_t() {
// unsigned integral type // unsigned integral type
using uint_t = size_t; using uint_t = std::size_t;
using size_t = std::size_t;
static_assert( std::numeric_limits<uint_t>::is_specialized && static_assert( std::numeric_limits<uint_t>::is_specialized &&
std::numeric_limits<uint_t>::is_integer && std::numeric_limits<uint_t>::is_integer &&
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "core/DataTypes.h" #include "core/DataTypes.h"
#include "core/StringUtility.h" #include "core/StringUtility.h"
#include <cstddef>
#include <sstream> #include <sstream>
namespace boost { namespace boost {
...@@ -132,7 +133,7 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,1> & arr ) ...@@ -132,7 +133,7 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,1> & arr )
arr.resize( boost::extents[walberla::numeric_cast< boost::multi_array_types::index >(rows)] ); arr.resize( boost::extents[walberla::numeric_cast< boost::multi_array_types::index >(rows)] );
for( size_t r = 0; r < rows; ++r ) for( std::size_t r = 0; r < rows; ++r )
arr[walberla::numeric_cast< boost::multi_array_types::index >(r)] = vec[r]; arr[walberla::numeric_cast< boost::multi_array_types::index >(r)] = vec[r];
return is; return is;
...@@ -142,7 +143,7 @@ template<typename T> ...@@ -142,7 +143,7 @@ template<typename T>
std::ostream & operator<< ( std::ostream & os, const boost::multi_array<T,1> & arr ) std::ostream & operator<< ( std::ostream & os, const boost::multi_array<T,1> & arr )
{ {
os << "[ "; os << "[ ";
for( size_t c = 0; c < arr.size(); ++c ) for( std::size_t c = 0; c < arr.size(); ++c )
os << arr[walberla::numeric_cast< boost::multi_array_types::index >(c)] << ","; os << arr[walberla::numeric_cast< boost::multi_array_types::index >(c)] << ",";
os << "]"; os << "]";
...@@ -172,12 +173,12 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,2> & arr ) ...@@ -172,12 +173,12 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,2> & arr )
return is; return is;
} }
size_t rows = vec2D.size(); std::size_t rows = vec2D.size();
if ( rows == 0 ) if ( rows == 0 )
return is; return is;
size_t cols = vec2D[0].size(); std::size_t cols = vec2D[0].size();
for( size_t r = 0; r < rows; ++r ) for( std::size_t r = 0; r < rows; ++r )
{ {
if ( vec2D[r].size() != cols ) if ( vec2D[r].size() != cols )
{ {
...@@ -192,8 +193,8 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,2> & arr ) ...@@ -192,8 +193,8 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,2> & arr )
arr.resize( boost::extents[ walberla::numeric_cast< boost::multi_array_types::index >(rows) ][ walberla::numeric_cast< boost::multi_array_types::index >(cols) ] ); arr.resize( boost::extents[ walberla::numeric_cast< boost::multi_array_types::index >(rows) ][ walberla::numeric_cast< boost::multi_array_types::index >(cols) ] );
for( size_t r = 0; r < rows; ++r ) for( std::size_t r = 0; r < rows; ++r )
for( size_t c = 0; c < cols; ++c ) for( std::size_t c = 0; c < cols; ++c )
arr[walberla::numeric_cast< boost::multi_array_types::index >(r)][walberla::numeric_cast< boost::multi_array_types::index >(c)] = vec2D[r][c]; arr[walberla::numeric_cast< boost::multi_array_types::index >(r)][walberla::numeric_cast< boost::multi_array_types::index >(c)] = vec2D[r][c];
...@@ -205,10 +206,10 @@ std::ostream & operator<< ( std::ostream & os, const boost::multi_array<T,2> & a ...@@ -205,10 +206,10 @@ std::ostream & operator<< ( std::ostream & os, const boost::multi_array<T,2> & a
{ {
os << "[\n"; os << "[\n";
for( size_t r = 0; r < arr.size(); ++r ) for( std::size_t r = 0; r < arr.size(); ++r )
{ {
os << " [ "; os << " [ ";
for( size_t c = 0; c < arr[walberla::numeric_cast< boost::multi_array_types::index >(r)].size(); ++c ) { for( std::size_t c = 0; c < arr[walberla::numeric_cast< boost::multi_array_types::index >(r)].size(); ++c ) {
os << arr[walberla::numeric_cast< boost::multi_array_types::index >(r)][walberla::numeric_cast< boost::multi_array_types::index >(c)] << "\t"; os << arr[walberla::numeric_cast< boost::multi_array_types::index >(r)][walberla::numeric_cast< boost::multi_array_types::index >(c)] << "\t";
} }
os << "] \n"; os << "] \n";
......
...@@ -74,8 +74,8 @@ public: ...@@ -74,8 +74,8 @@ public:
/*! \name Access operators */ /*! \name Access operators */
//@{ //@{
cell_idx_t operator[]( size_t idx ) const; cell_idx_t operator[]( std::size_t idx ) const;
cell_idx_t & operator[]( size_t idx ); cell_idx_t & operator[]( std::size_t idx );
cell_idx_t x() const { return cell[0]; } cell_idx_t x() const { return cell[0]; }
cell_idx_t & x() { return cell[0]; } cell_idx_t & x() { return cell[0]; }
...@@ -158,7 +158,7 @@ inline bool Cell::operator==( const Cell & rhs ) const ...@@ -158,7 +158,7 @@ inline bool Cell::operator==( const Cell & rhs ) const
* *
* \return The idx-th coordinate component. This is equal to this->cell[i]. * \return The idx-th coordinate component. This is equal to this->cell[i].
**********************************************************************************************************************/ **********************************************************************************************************************/
inline cell_idx_t Cell::operator[]( size_t idx ) const inline cell_idx_t Cell::operator[]( std::size_t idx ) const
{ {
WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this ); WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this );
return cell[idx]; return cell[idx];
...@@ -257,7 +257,7 @@ inline Cell Cell::operator-() const ...@@ -257,7 +257,7 @@ inline Cell Cell::operator-() const
* *
* \return The idx-th coordinate component. This is equal to this->cell[i]. * \return The idx-th coordinate component. This is equal to this->cell[i].
**********************************************************************************************************************/ **********************************************************************************************************************/
inline cell_idx_t & Cell::operator[]( size_t idx ) inline cell_idx_t & Cell::operator[]( std::size_t idx )
{ {
WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this ); WALBERLA_ASSERT_LESS( idx, 3, "Index 'idx' = " << idx << " out of bounds! Cell: " << *this );
return cell[idx]; return cell[idx];
......
...@@ -671,7 +671,7 @@ private: ...@@ -671,7 +671,7 @@ private:
pGMI = (tGMI) GetProcAddress( hPsapi, "GetModuleInformation" ); pGMI = (tGMI) GetProcAddress( hPsapi, "GetModuleInformation" );
if ( (pEPM == NULL) || (pGMFNE == NULL) || (pGMBN == NULL) || (pGMI == NULL) ) if ( (pEPM == NULL) || (pGMFNE == NULL) || (pGMBN == NULL) || (pGMI == NULL) )
{ {
// we couldnt find all functions // we couldn't find all functions
FreeLibrary(hPsapi); FreeLibrary(hPsapi);
return FALSE; return FALSE;
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "core/mpi/SendBuffer.h" #include "core/mpi/SendBuffer.h"
#include <cmath> #include <cmath>
#include <cstddef>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <type_traits> #include <type_traits>
...@@ -1561,9 +1562,9 @@ struct Vector2LexicographicalyLess ...@@ -1561,9 +1562,9 @@ struct Vector2LexicographicalyLess
// \returns A hash for the entire Vector2. // \returns A hash for the entire Vector2.
*/ */
template< typename T > template< typename T >
size_t hash_value( const Vector2<T> & v ) std::size_t hash_value( const Vector2<T> & v )
{ {
size_t seed = 0; std::size_t seed = 0;
std::hash<T> hasher; std::hash<T> hasher;
seed ^= hasher(v[0]) + 0x9e3779b9 + (seed<<6) + (seed>>2); seed ^= hasher(v[0]) + 0x9e3779b9 + (seed<<6) + (seed>>2);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "core/debug/CheckFunctions.h" #include "core/debug/CheckFunctions.h"
#include <cmath> #include <cmath>
#include <cstddef>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <type_traits> #include <type_traits>
...@@ -1821,9 +1822,9 @@ struct Vector3LexicographicalyLess ...@@ -1821,9 +1822,9 @@ struct Vector3LexicographicalyLess
// \returns A hash for the entire Vector3. // \returns A hash for the entire Vector3.
*/ */
template< typename T > template< typename T >
size_t hash_value( const Vector3<T> & v ) std::size_t hash_value( const Vector3<T> & v )
{ {
size_t seed = 0; std::size_t seed = 0;
std::hash<T> hasher; std::hash<T> hasher;
seed ^= hasher(v[0]) + 0x9e3779b9 + (seed<<6) + (seed>>2); seed ^= hasher(v[0]) + 0x9e3779b9 + (seed<<6) + (seed>>2);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* by worldwide copyright and trade secret laws and treaty provisions. * by worldwide copyright and trade secret laws and treaty provisions.
* No part of the Material may be used, copied, reproduced, modified, * No part of the Material may be used, copied, reproduced, modified,
* published, uploaded, posted, transmitted, distributed, or disclosed * published, uploaded, posted, transmitted, distributed, or disclosed
* in any way without Intels prior express written permission. * in any way without Intel's prior express written permission.
* *
* No license under any patent, copyright, trade secret or other * No license under any patent, copyright, trade secret or other
* intellectual property right is granted to or conferred upon you by * intellectual property right is granted to or conferred upon you by
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#pragma once #pragma once
#include <cstddef>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -50,22 +51,22 @@ class BasicVoxelFileReader ...@@ -50,22 +51,22 @@ class BasicVoxelFileReader
public: public:
BasicVoxelFileReader(); BasicVoxelFileReader();
BasicVoxelFileReader( const std::string & _filename); BasicVoxelFileReader( const std::string & _filename);
BasicVoxelFileReader( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, T value = T() ); BasicVoxelFileReader( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, T value = T() );
BasicVoxelFileReader( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, const T * values ); BasicVoxelFileReader( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, const T * values );
~BasicVoxelFileReader(); ~BasicVoxelFileReader();
void open ( const std::string & _filename ); void open ( const std::string & _filename );
void create( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, T value = T() ); void create( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, T value = T() );
void create( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, const T * values ); void create( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, const T * values );
void close (); void close ();
bool isOpen() const; bool isOpen() const;
const std::string & filename() const; const std::string & filename() const;
size_t numCells() const; std::size_t numCells() const;
size_t xSize() const; std::size_t xSize() const;
size_t ySize() const; std::size_t ySize() const;
size_t zSize() const; std::size_t zSize() const;
void read ( const CellAABB & cellAABB, std::vector<T> & data ) const; void read ( const CellAABB & cellAABB, std::vector<T> & data ) const;
void write( const CellAABB & cellAABB, const std::vector<T> & data ); void write( const CellAABB & cellAABB, const std::vector<T> & data );
...@@ -77,9 +78,9 @@ private: ...@@ -77,9 +78,9 @@ private:
std::streampos dataBegin_; ///< Position in the stream where to raw data starts std::streampos dataBegin_; ///< Position in the stream where to raw data starts
size_t xSize_; ///< Extend of the currently open geometry file in x direction std::size_t xSize_; ///< Extend of the currently open geometry file in x direction
size_t ySize_; ///< Extend of the currently open geometry file in y direction std::size_t ySize_; ///< Extend of the currently open geometry file in y direction
size_t zSize_; ///< Extend of the currently open geometry file in z direction std::size_t zSize_; ///< Extend of the currently open geometry file in z direction
}; // class StructuredGeometryFileBasicReader }; // class StructuredGeometryFileBasicReader
...@@ -97,21 +98,21 @@ private: ...@@ -97,21 +98,21 @@ private:
struct CellAABB struct CellAABB
{ {
inline CellAABB(); inline CellAABB();
inline CellAABB(size_t _xBegin, size_t _yBegin, size_t _zBegin, inline CellAABB(std::size_t _xBegin, std::size_t _yBegin, std::size_t _zBegin,
size_t _xEnd, size_t _yEnd, size_t _zEnd); std::size_t _xEnd, std::size_t _yEnd, std::size_t _zEnd);
inline size_t numCells() const; inline std::size_t numCells() const;
inline size_t xSize() const; inline std::size_t xSize() const;
inline size_t ySize() const; inline std::size_t ySize() const;
inline size_t zSize() const; inline std::size_t zSize() const;
size_t xBegin; ///< The minimal x coordinate of all cells included in the AABB. std::size_t xBegin; ///< The minimal x coordinate of all cells included in the AABB.
size_t yBegin; ///< The minimal y coordinate of all cells included in the AABB. std::size_t yBegin; ///< The minimal y coordinate of all cells included in the AABB.
size_t zBegin; ///< The minimal z coordinate of all cells included in the AABB. std::size_t zBegin; ///< The minimal z coordinate of all cells included in the AABB.
size_t xEnd; ///< The maximal x coordinate of all cells included in the AABB. std::size_t xEnd; ///< The maximal x coordinate of all cells included in the AABB.
size_t yEnd; ///< The maximal y coordinate of all cells included in the AABB. std::size_t yEnd; ///< The maximal y coordinate of all cells included in the AABB.
size_t zEnd; ///< The maximal z coordinate of all cells included in the AABB. std::size_t zEnd; ///< The maximal z coordinate of all cells included in the AABB.
}; // class CellAABB }; // class CellAABB
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
//====================================================================================================================== //======================================================================================================================
#include <cassert> #include <cassert>
#include <cstddef>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <typeinfo> #include <typeinfo>
...@@ -83,7 +84,7 @@ BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename) ...@@ -83,7 +84,7 @@ BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename)
* \post isOpen() == true * \post isOpen() == true
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, T value /*= T()*/ ) BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, T value /*= T()*/ )
: xSize_(0), ySize_(0), zSize_(0) : xSize_(0), ySize_(0), zSize_(0)
{ {
create(_filename, _xSize, _ySize, _zSize, value); create(_filename, _xSize, _ySize, _zSize, value);
...@@ -114,7 +115,7 @@ BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, si ...@@ -114,7 +115,7 @@ BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, si
* \post isOpen() == true * \post isOpen() == true
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, const T * values ) BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, const T * values )
: xSize_(0), ySize_(0), zSize_(0) : xSize_(0), ySize_(0), zSize_(0)
{ {
assert(values != 0); assert(values != 0);
...@@ -190,7 +191,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename ) ...@@ -190,7 +191,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename )
assert(dataBegin_ <= dataEnd); assert(dataBegin_ <= dataEnd);
size_t rawDataLengthBytes = static_cast<size_t>( dataEnd - dataBegin_ ); std::size_t rawDataLengthBytes = static_cast<std::size_t>( dataEnd - dataBegin_ );
if( rawDataLengthBytes % sizeof(T) != 0 ) if( rawDataLengthBytes % sizeof(T) != 0 )
{ {
std::stringstream ss; std::stringstream ss;
...@@ -199,7 +200,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename ) ...@@ -199,7 +200,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename )
throw std::runtime_error(ss.str()); throw std::runtime_error(ss.str());
} }
assert(rawDataLengthBytes % sizeof(T) == 0); assert(rawDataLengthBytes % sizeof(T) == 0);
size_t rawDataLength = rawDataLengthBytes / sizeof(T); std::size_t rawDataLength = rawDataLengthBytes / sizeof(T);
if( rawDataLength != numCells() ) if( rawDataLength != numCells() )
{ {
std::stringstream ss; std::stringstream ss;
...@@ -233,7 +234,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename ) ...@@ -233,7 +234,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename )
* \post isOpen() == true * \post isOpen() == true
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, T value /*= T()*/ ) void BasicVoxelFileReader<T>::create( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, T value /*= T()*/ )
{ {
if( isOpen() ) if( isOpen() )
close(); close();
...@@ -256,15 +257,15 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi ...@@ -256,15 +257,15 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi
if( filestream_.fail() || filestream_.bad() || dataBegin_ == std::streampos(-1) ) if( filestream_.fail() || filestream_.bad() || dataBegin_ == std::streampos(-1) )
throw std::runtime_error("I/O Error while writing file \"" + _filename + "\"!"); throw std::runtime_error("I/O Error while writing file \"" + _filename + "\"!");
const size_t maxChunkSizeBytes = 1024 * 1024; // 1 MegaByte const std::size_t maxChunkSizeBytes = 1024 * 1024; // 1 MegaByte
const size_t numCellsPerChunk = maxChunkSizeBytes / sizeof(T); const std::size_t numCellsPerChunk = maxChunkSizeBytes / sizeof(T);
const std::streamsize bytesPerChunk = static_cast< std::streamsize >( numCellsPerChunk * sizeof(T) ); const std::streamsize bytesPerChunk = static_cast< std::streamsize >( numCellsPerChunk * sizeof(T) );
const std::vector<T> chunkData(numCellsPerChunk, value); const std::vector<T> chunkData(numCellsPerChunk, value);
assert(!chunkData.empty()); assert(!chunkData.empty());
const char * rawData = reinterpret_cast<const char*>(&chunkData[0]); const char * rawData = reinterpret_cast<const char*>(&chunkData[0]);
size_t cellsLeft = numCells(); std::size_t cellsLeft = numCells();
while( cellsLeft >= numCellsPerChunk ) while( cellsLeft >= numCellsPerChunk )
{ {
filestream_.write(rawData, bytesPerChunk); filestream_.write(rawData, bytesPerChunk);
...@@ -309,7 +310,7 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi ...@@ -309,7 +310,7 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi
* \post isOpen() == true * \post isOpen() == true
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSize, size_t _ySize, size_t _zSize, const T * values ) void BasicVoxelFileReader<T>::create( const std::string & _filename, std::size_t _xSize, std::size_t _ySize, std::size_t _zSize, const T * values )
{ {
if( isOpen() ) if( isOpen() )
close(); close();
...@@ -333,7 +334,7 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi ...@@ -333,7 +334,7 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi
throw std::runtime_error("I/O Error while writing file \"" + _filename + "\"!"); throw std::runtime_error("I/O Error while writing file \"" + _filename + "\"!");
const char * rawData = reinterpret_cast<const char*>(values); const char * rawData = reinterpret_cast<const char*>(values);
size_t dataSizeBytes = numCells() * sizeof(T); std::size_t dataSizeBytes = numCells() * sizeof(T);
filestream_.write(rawData, static_cast< std::streamsize >( dataSizeBytes ) ); filestream_.write(rawData, static_cast< std::streamsize >( dataSizeBytes ) );
if( filestream_.fail() || filestream_.bad() ) if( filestream_.fail() || filestream_.bad() )
throw std::runtime_error("I/O Error while writing file \"" + _filename + "\"!"); throw std::runtime_error("I/O Error while writing file \"" + _filename + "\"!");
...@@ -364,9 +365,9 @@ void BasicVoxelFileReader<T>::close() ...@@ -364,9 +365,9 @@ void BasicVoxelFileReader<T>::close()
filestream_.close(); filestream_.close();
dataBegin_ = std::streampos(); dataBegin_ = std::streampos();
filename_.clear(); filename_.clear();
xSize_ = size_t(0); xSize_ = std::size_t(0);
ySize_ = size_t(0); ySize_ = std::size_t(0);
zSize_ = size_t(0); zSize_ = std::size_t(0);
} }
assert(!filestream_.is_open()); assert(!filestream_.is_open());
...@@ -411,7 +412,7 @@ const std::string & BasicVoxelFileReader<T>::filename() const ...@@ -411,7 +412,7 @@ const std::string & BasicVoxelFileReader<T>::filename() const
* \return The extend of the geometry file in x direction. * \return The extend of the geometry file in x direction.
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
size_t BasicVoxelFileReader<T>::xSize() const std::size_t BasicVoxelFileReader<T>::xSize() const
{ {
assert( isOpen() ); assert( isOpen() );
return xSize_; return xSize_;
...@@ -425,7 +426,7 @@ size_t BasicVoxelFileReader<T>::xSize() const ...@@ -425,7 +426,7 @@ size_t BasicVoxelFileReader<T>::xSize() const
* \return The extend of the geometry file in y direction. * \return The extend of the geometry file in y direction.
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
size_t BasicVoxelFileReader<T>::ySize() const std::size_t BasicVoxelFileReader<T>::ySize() const
{ {
assert( isOpen() ); assert( isOpen() );
return ySize_; return ySize_;
...@@ -439,7 +440,7 @@ size_t BasicVoxelFileReader<T>::ySize() const ...@@ -439,7 +440,7 @@ size_t BasicVoxelFileReader<T>::ySize() const
* \return The extend of the geometry file in z direction. * \return The extend of the geometry file in z direction.
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
size_t BasicVoxelFileReader<T>::zSize() const std::size_t BasicVoxelFileReader<T>::zSize() const
{ {
assert( isOpen() ); assert( isOpen() );
return zSize_; return zSize_;
...@@ -453,7 +454,7 @@ size_t BasicVoxelFileReader<T>::zSize() const ...@@ -453,7 +454,7 @@ size_t BasicVoxelFileReader<T>::zSize() const
* \return xSize() * ySize() * zSize(). * \return xSize() * ySize() * zSize().
**********************************************************************************************************************/ **********************************************************************************************************************/
template<typename T> template<typename T>
size_t BasicVoxelFileReader<T>::numCells() const std::size_t BasicVoxelFileReader<T>::numCells() const
{ {
assert( isOpen() ); assert( isOpen() );
return xSize() * ySize() * zSize(); return xSize() * ySize() * zSize();
...@@ -488,12 +489,12 @@ void BasicVoxelFileReader<T>::read( const CellAABB & cellAABB, std::vector<T> & ...@@ -488,12 +489,12 @@ void BasicVoxelFileReader<T>::read( const CellAABB & cellAABB, std::vector<T> &
assert(!data.empty()); assert(!data.empty());
char * buffer = reinterpret_cast<char*>( &data[0] ); char * buffer = reinterpret_cast<char*>( &data[0] );