Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
waLBerla
waLBerla
Commits
31a251ed
Commit
31a251ed
authored
Aug 28, 2021
by
Jean-Noël Grad
Committed by
Christoph Schwarzmeier
Aug 28, 2021
Browse files
Improve portability of size_t and ptrdiff_t on recent compilers
parent
6e75c8a8
Changes
9
Show whitespace changes
Inline
Side-by-side
src/core/DataTypes.h
View file @
31a251ed
...
...
@@ -24,6 +24,7 @@
#include
"waLBerlaDefinitions.h"
#include
<cmath>
#include
<cstddef>
#include
<cstdint>
#include
<limits>
#include
<memory>
...
...
@@ -116,6 +117,8 @@ template< typename T > inline uint64_t uint64_c( T t ) { return numeric_cast< ui
// 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
INT
>
...
...
@@ -127,7 +130,8 @@ inline void static_assert_int_t() {
// 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
&&
std
::
numeric_limits
<
uint_t
>::
is_integer
&&
...
...
src/core/MultiArrayIO.impl.h
View file @
31a251ed
...
...
@@ -24,6 +24,7 @@
#include
"core/DataTypes.h"
#include
"core/StringUtility.h"
#include
<cstddef>
#include
<sstream>
namespace
boost
{
...
...
@@ -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
)]
);
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
];
return
is
;
...
...
@@ -142,7 +143,7 @@ template<typename T>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
boost
::
multi_array
<
T
,
1
>
&
arr
)
{
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
<<
"]"
;
...
...
@@ -172,12 +173,12 @@ std::istream & operator>> ( std::istream & is, boost::multi_array<T,2> & arr )
return
is
;
}
size_t
rows
=
vec2D
.
size
();
std
::
size_t
rows
=
vec2D
.
size
();
if
(
rows
==
0
)
return
is
;
size_t
cols
=
vec2D
[
0
].
size
();
for
(
size_t
r
=
0
;
r
<
rows
;
++
r
)
std
::
size_t
cols
=
vec2D
[
0
].
size
();
for
(
std
::
size_t
r
=
0
;
r
<
rows
;
++
r
)
{
if
(
vec2D
[
r
].
size
()
!=
cols
)
{
...
...
@@ -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
)
]
);
for
(
size_t
r
=
0
;
r
<
rows
;
++
r
)
for
(
size_t
c
=
0
;
c
<
cols
;
++
c
)
for
(
std
::
size_t
r
=
0
;
r
<
rows
;
++
r
)
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
];
...
...
@@ -205,10 +206,10 @@ std::ostream & operator<< ( std::ostream & os, const boost::multi_array<T,2> & a
{
os
<<
"[
\n
"
;
for
(
size_t
r
=
0
;
r
<
arr
.
size
();
++
r
)
for
(
std
::
size_t
r
=
0
;
r
<
arr
.
size
();
++
r
)
{
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
<<
"]
\n
"
;
...
...
src/core/cell/Cell.h
View file @
31a251ed
...
...
@@ -74,8 +74,8 @@ public:
/*! \name Access operators */
//@{
cell_idx_t
operator
[](
size_t
idx
)
const
;
cell_idx_t
&
operator
[](
size_t
idx
);
cell_idx_t
operator
[](
std
::
size_t
idx
)
const
;
cell_idx_t
&
operator
[](
std
::
size_t
idx
);
cell_idx_t
x
()
const
{
return
cell
[
0
];
}
cell_idx_t
&
x
()
{
return
cell
[
0
];
}
...
...
@@ -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].
**********************************************************************************************************************/
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
);
return
cell
[
idx
];
...
...
@@ -257,7 +257,7 @@ inline Cell Cell::operator-() const
*
* \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
);
return
cell
[
idx
];
...
...
src/core/debug/extern/StackWalker.cpp
View file @
31a251ed
...
...
@@ -671,7 +671,7 @@ private:
pGMI
=
(
tGMI
)
GetProcAddress
(
hPsapi
,
"GetModuleInformation"
);
if
(
(
pEPM
==
NULL
)
||
(
pGMFNE
==
NULL
)
||
(
pGMBN
==
NULL
)
||
(
pGMI
==
NULL
)
)
{
// we couldnt find all functions
// we couldn
'
t find all functions
FreeLibrary
(
hPsapi
);
return
FALSE
;
}
...
...
src/core/math/Vector2.h
View file @
31a251ed
...
...
@@ -38,6 +38,7 @@
#include
"core/mpi/SendBuffer.h"
#include
<cmath>
#include
<cstddef>
#include
<iostream>
#include
<limits>
#include
<type_traits>
...
...
@@ -1561,9 +1562,9 @@ struct Vector2LexicographicalyLess
// \returns A hash for the entire Vector2.
*/
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
;
seed
^=
hasher
(
v
[
0
])
+
0x9e3779b9
+
(
seed
<<
6
)
+
(
seed
>>
2
);
...
...
src/core/math/Vector3.h
View file @
31a251ed
...
...
@@ -39,6 +39,7 @@
#include
"core/debug/CheckFunctions.h"
#include
<cmath>
#include
<cstddef>
#include
<iostream>
#include
<limits>
#include
<type_traits>
...
...
@@ -1821,9 +1822,9 @@ struct Vector3LexicographicalyLess
// \returns A hash for the entire Vector3.
*/
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
;
seed
^=
hasher
(
v
[
0
])
+
0x9e3779b9
+
(
seed
<<
6
)
+
(
seed
>>
2
);
...
...
src/core/perf_analysis/extern/iacaMarks.h
View file @
31a251ed
...
...
@@ -10,7 +10,7 @@
* by worldwide copyright and trade secret laws and treaty provisions.
* No part of the Material may be used, copied, reproduced, modified,
* published, uploaded, posted, transmitted, distributed, or disclosed
* in any way without Intel
’
s prior express written permission.
* in any way without Intel
'
s prior express written permission.
*
* No license under any patent, copyright, trade secret or other
* intellectual property right is granted to or conferred upon you by
...
...
src/geometry/structured/BasicVoxelFileReader.h
View file @
31a251ed
...
...
@@ -25,6 +25,7 @@
#pragma once
#include
<cstddef>
#include
<fstream>
#include
<string>
#include
<vector>
...
...
@@ -50,22 +51,22 @@ class BasicVoxelFileReader
public:
BasicVoxelFileReader
();
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
,
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
,
T
value
=
T
()
);
BasicVoxelFileReader
(
const
std
::
string
&
_filename
,
std
::
size_t
_xSize
,
std
::
size_t
_ySize
,
std
::
size_t
_zSize
,
const
T
*
values
);
~
BasicVoxelFileReader
();
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
,
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
,
T
value
=
T
()
);
void
create
(
const
std
::
string
&
_filename
,
std
::
size_t
_xSize
,
std
::
size_t
_ySize
,
std
::
size_t
_zSize
,
const
T
*
values
);
void
close
();
bool
isOpen
()
const
;
const
std
::
string
&
filename
()
const
;
size_t
numCells
()
const
;
std
::
size_t
numCells
()
const
;
size_t
xSize
()
const
;
size_t
ySize
()
const
;
size_t
zSize
()
const
;
std
::
size_t
xSize
()
const
;
std
::
size_t
ySize
()
const
;
std
::
size_t
zSize
()
const
;
void
read
(
const
CellAABB
&
cellAABB
,
std
::
vector
<
T
>
&
data
)
const
;
void
write
(
const
CellAABB
&
cellAABB
,
const
std
::
vector
<
T
>
&
data
);
...
...
@@ -77,9 +78,9 @@ private:
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
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
xSize_
;
///< Extend of the currently open geometry file in x direction
std
::
size_t
ySize_
;
///< Extend of the currently open geometry file in y direction
std
::
size_t
zSize_
;
///< Extend of the currently open geometry file in z direction
};
// class StructuredGeometryFileBasicReader
...
...
@@ -97,21 +98,21 @@ private:
struct
CellAABB
{
inline
CellAABB
();
inline
CellAABB
(
size_t
_xBegin
,
size_t
_yBegin
,
size_t
_zBegin
,
size_t
_xEnd
,
size_t
_yEnd
,
size_t
_zEnd
);
inline
CellAABB
(
std
::
size_t
_xBegin
,
std
::
size_t
_yBegin
,
std
::
size_t
_zBegin
,
std
::
size_t
_xEnd
,
std
::
size_t
_yEnd
,
std
::
size_t
_zEnd
);
inline
size_t
numCells
()
const
;
inline
size_t
xSize
()
const
;
inline
size_t
ySize
()
const
;
inline
size_t
zSize
()
const
;
inline
std
::
size_t
numCells
()
const
;
inline
std
::
size_t
xSize
()
const
;
inline
std
::
size_t
ySize
()
const
;
inline
std
::
size_t
zSize
()
const
;
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.
size_t
zBegin
;
///< The minimal z coordinate of all cells included in the AABB.
std
::
size_t
xBegin
;
///< The minimal x coordinate of all cells included in the AABB.
std
::
size_t
yBegin
;
///< The minimal y 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.
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
xEnd
;
///< The maximal x coordinate of all cells included in the AABB.
std
::
size_t
yEnd
;
///< The maximal y 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
...
...
src/geometry/structured/BasicVoxelFileReader.impl.h
View file @
31a251ed
...
...
@@ -21,6 +21,7 @@
//======================================================================================================================
#include
<cassert>
#include
<cstddef>
#include
<sstream>
#include
<stdexcept>
#include
<typeinfo>
...
...
@@ -83,7 +84,7 @@ BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename)
* \post isOpen() == true
**********************************************************************************************************************/
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
)
{
create
(
_filename
,
_xSize
,
_ySize
,
_zSize
,
value
);
...
...
@@ -114,7 +115,7 @@ BasicVoxelFileReader<T>::BasicVoxelFileReader( const std::string & _filename, si
* \post isOpen() == true
**********************************************************************************************************************/
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
)
{
assert
(
values
!=
0
);
...
...
@@ -190,7 +191,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename )
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
)
{
std
::
stringstream
ss
;
...
...
@@ -199,7 +200,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename )
throw
std
::
runtime_error
(
ss
.
str
());
}
assert
(
rawDataLengthBytes
%
sizeof
(
T
)
==
0
);
size_t
rawDataLength
=
rawDataLengthBytes
/
sizeof
(
T
);
std
::
size_t
rawDataLength
=
rawDataLengthBytes
/
sizeof
(
T
);
if
(
rawDataLength
!=
numCells
()
)
{
std
::
stringstream
ss
;
...
...
@@ -233,7 +234,7 @@ void BasicVoxelFileReader<T>::open( const std::string & _filename )
* \post isOpen() == true
**********************************************************************************************************************/
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
()
)
close
();
...
...
@@ -256,15 +257,15 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi
if
(
filestream_
.
fail
()
||
filestream_
.
bad
()
||
dataBegin_
==
std
::
streampos
(
-
1
)
)
throw
std
::
runtime_error
(
"I/O Error while writing file
\"
"
+
_filename
+
"
\"
!"
);
const
size_t
maxChunkSizeBytes
=
1024
*
1024
;
// 1 MegaByte
const
size_t
numCellsPerChunk
=
maxChunkSizeBytes
/
sizeof
(
T
);
const
std
::
size_t
maxChunkSizeBytes
=
1024
*
1024
;
// 1 MegaByte
const
std
::
size_t
numCellsPerChunk
=
maxChunkSizeBytes
/
sizeof
(
T
);
const
std
::
streamsize
bytesPerChunk
=
static_cast
<
std
::
streamsize
>
(
numCellsPerChunk
*
sizeof
(
T
)
);
const
std
::
vector
<
T
>
chunkData
(
numCellsPerChunk
,
value
);
assert
(
!
chunkData
.
empty
());
const
char
*
rawData
=
reinterpret_cast
<
const
char
*>
(
&
chunkData
[
0
]);
size_t
cellsLeft
=
numCells
();
std
::
size_t
cellsLeft
=
numCells
();
while
(
cellsLeft
>=
numCellsPerChunk
)
{
filestream_
.
write
(
rawData
,
bytesPerChunk
);
...
...
@@ -309,7 +310,7 @@ void BasicVoxelFileReader<T>::create( const std::string & _filename, size_t _xSi
* \post isOpen() == true
**********************************************************************************************************************/
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
()
)
close
();
...
...
@@ -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
+
"
\"
!"
);
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
)
);
if
(
filestream_
.
fail
()
||
filestream_
.
bad
()
)
throw
std
::
runtime_error
(
"I/O Error while writing file
\"
"
+
_filename
+
"
\"
!"
);
...
...
@@ -364,9 +365,9 @@ void BasicVoxelFileReader<T>::close()
filestream_
.
close
();
dataBegin_
=
std
::
streampos
();
filename_
.
clear
();
xSize_
=
size_t
(
0
);
ySize_
=
size_t
(
0
);
zSize_
=
size_t
(
0
);
xSize_
=
std
::
size_t
(
0
);
ySize_
=
std
::
size_t
(
0
);
zSize_
=
std
::
size_t
(
0
);
}
assert
(
!
filestream_
.
is_open
());
...
...
@@ -411,7 +412,7 @@ const std::string & BasicVoxelFileReader<T>::filename() const
* \return The extend of the geometry file in x direction.
**********************************************************************************************************************/
template
<
typename
T
>
size_t
BasicVoxelFileReader
<
T
>::
xSize
()
const
std
::
size_t
BasicVoxelFileReader
<
T
>::
xSize
()
const
{
assert
(
isOpen
()
);
return
xSize_
;
...
...
@@ -425,7 +426,7 @@ size_t BasicVoxelFileReader<T>::xSize() const
* \return The extend of the geometry file in y direction.
**********************************************************************************************************************/
template
<
typename
T
>
size_t
BasicVoxelFileReader
<
T
>::
ySize
()
const
std
::
size_t
BasicVoxelFileReader
<
T
>::
ySize
()
const
{
assert
(
isOpen
()
);
return
ySize_
;
...
...
@@ -439,7 +440,7 @@ size_t BasicVoxelFileReader<T>::ySize() const
* \return The extend of the geometry file in z direction.
**********************************************************************************************************************/
template
<
typename
T
>
size_t
BasicVoxelFileReader
<
T
>::
zSize
()
const
std
::
size_t
BasicVoxelFileReader
<
T
>::
zSize
()
const
{
assert
(
isOpen
()
);
return
zSize_
;
...
...
@@ -453,7 +454,7 @@ size_t BasicVoxelFileReader<T>::zSize() const
* \return xSize() * ySize() * zSize().
**********************************************************************************************************************/
template
<
typename
T
>
size_t
BasicVoxelFileReader
<
T
>::
numCells
()
const
std
::
size_t
BasicVoxelFileReader
<
T
>::
numCells
()
const
{
assert
(
isOpen
()
);
return
xSize
()
*
ySize
()
*
zSize
();
...
...
@@ -488,12 +489,12 @@ void BasicVoxelFileReader<T>::read( const CellAABB & cellAABB, std::vector<T> &
assert
(
!
data
.
empty
());
char
*
buffer
=
reinterpret_cast
<
char
*>
(
&
data
[
0
]
);
const
size_t
zFactor
=
xSize
()
*
ySize
();
const
size_t
yFactor
=
xSize
();
const
std
::
size_t
zFactor
=
xSize
()
*
ySize
();
const
std
::
size_t
yFactor
=
xSize
();
std
::
streamsize
lineLength
=
static_cast
<
std
::
streamsize
>
(
cellAABB
.
xSize
()
*
sizeof
(
T
)
);
for
(
size_t
z
=
cellAABB
.
zBegin
;
z
<=
cellAABB
.
zEnd
;
++
z
)
for
(
size_t
y
=
cellAABB
.
yBegin
;
y
<=
cellAABB
.
yEnd
;
++
y
)
for
(
std
::
size_t
z
=
cellAABB
.
zBegin
;
z
<=
cellAABB
.
zEnd
;
++
z
)
for
(
std
::
size_t
y
=
cellAABB
.
yBegin
;
y
<=
cellAABB
.
yEnd
;
++
y
)
{
assert
(
buffer
<
reinterpret_cast
<
char
*>
(
&
data
[
0
]
+
data
.
size
())
);
assert
(
buffer
+
lineLength
-
1
<
reinterpret_cast
<
char
*>
(
&
data
[
0
]
+
data
.
size
())
);
...
...
@@ -543,12 +544,12 @@ void BasicVoxelFileReader<T>::write( const CellAABB & cellAABB, const std::vecto
const
char
*
buffer
=
reinterpret_cast
<
const
char
*>
(
&
data
[
0
]
);
const
size_t
zFactor
=
xSize
()
*
ySize
();
const
size_t
yFactor
=
xSize
();
const
std
::
size_t
zFactor
=
xSize
()
*
ySize
();
const
std
::
size_t
yFactor
=
xSize
();
std
::
streamsize
lineLength
=
static_cast
<
std
::
streamsize
>
(
cellAABB
.
xSize
()
*
sizeof
(
T
)
);
for
(
size_t
z
=
cellAABB
.
zBegin
;
z
<=
cellAABB
.
zEnd
;
++
z
)
for
(
size_t
y
=
cellAABB
.
yBegin
;
y
<=
cellAABB
.
yEnd
;
++
y
)
for
(
std
::
size_t
z
=
cellAABB
.
zBegin
;
z
<=
cellAABB
.
zEnd
;
++
z
)
for
(
std
::
size_t
y
=
cellAABB
.
yBegin
;
y
<=
cellAABB
.
yEnd
;
++
y
)
{
assert
(
buffer
<
reinterpret_cast
<
const
char
*>
(
&
data
[
0
]
+
data
.
size
())
);
assert
(
buffer
+
lineLength
-
1
<
reinterpret_cast
<
const
char
*>
(
&
data
[
0
]
+
data
.
size
())
);
...
...
@@ -607,8 +608,8 @@ inline CellAABB::CellAABB()
* \param _yEnd The maximal y coordinate of all cells included in the AABB.
* \param _zEnd The maximal z coordinate of all cells included in the AABB.
**********************************************************************************************************************/
CellAABB
::
CellAABB
(
size_t
_xBegin
,
size_t
_yBegin
,
size_t
_zBegin
,
size_t
_xEnd
,
size_t
_yEnd
,
size_t
_zEnd
)
CellAABB
::
CellAABB
(
std
::
size_t
_xBegin
,
std
::
size_t
_yBegin
,
std
::
size_t
_zBegin
,
std
::
size_t
_xEnd
,
std
::
size_t
_yEnd
,
std
::
size_t
_zEnd
)
:
xBegin
(
_xBegin
),
yBegin
(
_yBegin
),
zBegin
(
_zBegin
),
xEnd
(
_xEnd
),
yEnd
(
_yEnd
),
zEnd
(
_zEnd
)
{
...
...
@@ -626,7 +627,7 @@ CellAABB::CellAABB( size_t _xBegin, size_t _yBegin, size_t _zBegin,
*
* \return xSize() * ySize() * zSize().
**********************************************************************************************************************/
size_t
CellAABB
::
numCells
()
const
std
::
size_t
CellAABB
::
numCells
()
const
{
assert
(
xBegin
<=
xEnd
);
assert
(
yBegin
<=
yEnd
);
...
...
@@ -642,7 +643,7 @@ size_t CellAABB::numCells() const
*
* \return #xEnd - #xBegin + 1.
**********************************************************************************************************************/
size_t
CellAABB
::
xSize
()
const
std
::
size_t
CellAABB
::
xSize
()
const
{
assert
(
xBegin
<=
xEnd
);
return
xEnd
-
xBegin
+
1
;
...
...
@@ -655,7 +656,7 @@ size_t CellAABB::xSize() const
*
* \return #yEnd - #yBegin + 1.
**********************************************************************************************************************/
size_t
CellAABB
::
ySize
()
const
std
::
size_t
CellAABB
::
ySize
()
const
{
assert
(
yBegin
<=
yEnd
);
return
yEnd
-
yBegin
+
1
;
...
...
@@ -668,7 +669,7 @@ size_t CellAABB::ySize() const
*
* \return #zEnd - #zBegin + 1.
**********************************************************************************************************************/
size_t
CellAABB
::
zSize
()
const
std
::
size_t
CellAABB
::
zSize
()
const
{
assert
(
zBegin
<=
zEnd
);
return
zEnd
-
zBegin
+
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment