Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
3cfc54ba
Commit
3cfc54ba
authored
Apr 26, 2016
by
Henry Weller
Browse files
src/postProcessing/functionObjects/field/Make/files: Corrected
parent
dc2951ca
Changes
12
Hide whitespace changes
Inline
Side-by-side
applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H
View file @
3cfc54ba
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2016
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -30,7 +30,6 @@ InClass
#define vtkOpenFOAMTupleRemap_H
// OpenFOAM includes
#include
"StaticAssert.H"
#include
"Swap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -39,17 +38,6 @@ template<class Type>
inline
void
vtkOpenFOAMTupleRemap
(
float
vec
[]);
// a symmTensor specialization to remap OpenFOAM -> ParaView naming order
// Qt/Core/pqScalarBarRepresentation.cxx defines this order
// { "XX", "YY", "ZZ", "XY", "YZ", "XZ" }
// in pqScalarBarRepresentation::getDefaultComponentLabel()
// whereas OpenFOAM uses this order
// { XX, XY, XZ, YY, YZ, ZZ }
//
// for extra safety, assert that symmTensor indeed has 6 components
StaticAssert
(
Foam
::
symmTensor
::
nComponents
==
6
);
// Template specialization for symmTensor
template
<
>
inline
void
vtkOpenFOAMTupleRemap
<
Foam
::
symmTensor
>
(
float
vec
[])
...
...
applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkOpenFOAMTupleRemap.H
View file @
3cfc54ba
...
...
@@ -30,7 +30,6 @@ InClass
#define vtkOpenFOAMTupleRemap_H
// OpenFOAM includes
#include
"StaticAssert.H"
#include
"Swap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -39,17 +38,6 @@ template<class Type>
inline
void
vtkOpenFOAMTupleRemap
(
float
vec
[]);
// a symmTensor specialization to remap OpenFOAM -> ParaView naming order
// Qt/Core/pqScalarBarRepresentation.cxx defines this order
// { "XX", "YY", "ZZ", "XY", "YZ", "XZ" }
// in pqScalarBarRepresentation::getDefaultComponentLabel()
// whereas OpenFOAM uses this order
// { XX, XY, XZ, YY, YZ, ZZ }
//
// for extra safety, assert that symmTensor indeed has 6 components
StaticAssert
(
Foam
::
symmTensor
::
nComponents
==
6
);
// Template specialization for symmTensor
template
<
>
inline
void
vtkOpenFOAMTupleRemap
<
Foam
::
symmTensor
>
(
float
vec
[])
...
...
src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
View file @
3cfc54ba
...
...
@@ -44,7 +44,7 @@ SourceFiles
#define DynamicList_H
#include
"List.H"
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -79,8 +79,11 @@ class DynamicList
:
public
List
<
T
>
{
//- Avoid invalid sizing parameters
StaticAssert
((
SizeInc
||
SizeMult
)
&&
SizeDiv
);
static_assert
(
(
SizeInc
||
SizeMult
)
&&
SizeDiv
,
"Invalid sizing parameters"
);
// Private data
...
...
src/OpenFOAM/containers/Lists/FixedList/FixedList.H
View file @
3cfc54ba
...
...
@@ -42,7 +42,7 @@ SourceFiles
#include
"uLabel.H"
#include
"Hash.H"
#include
"autoPtr.H"
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -70,8 +70,11 @@ template<class T> class SLList;
template
<
class
T
,
unsigned
Size
>
class
FixedList
{
//- Size must be positive (non-zero) and also fit as a signed value
StaticAssert
(
Size
&&
Size
<=
INT_MAX
);
static_assert
(
Size
&&
Size
<=
INT_MAX
,
"Size must be positive (non-zero) and also fit as a signed value"
);
// Private data
...
...
src/OpenFOAM/containers/Lists/PackedList/PackedList.H
View file @
3cfc54ba
...
...
@@ -103,7 +103,7 @@ SourceFiles
#include
"labelList.H"
#include
"UIndirectList.H"
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -174,7 +174,11 @@ private:
// it is more efficient to use a normal list.
// Thus max nBits is 1/2 of the base storage size.
// For simplicity, assume 8-bit bytes in the assert.
StaticAssert
(
nBits
&&
nBits
<=
(
sizeof
(
StorageType
)
<<
2
));
static_assert
(
nBits
&&
nBits
<=
(
sizeof
(
StorageType
)
<<
2
),
"nBits must be positive (non-zero) and fit within the storage"
);
// Private data
...
...
src/OpenFOAM/containers/NamedEnum/NamedEnum.H
View file @
3cfc54ba
...
...
@@ -36,9 +36,9 @@ SourceFiles
#define NamedEnum_H
#include
"HashTable.H"
#include
"StaticAssert.H"
#include
"stringList.H"
#include
"wordList.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -55,7 +55,7 @@ class NamedEnum
public
HashTable
<
int
>
{
//- nEnum must be positive (non-zero)
S
tatic
A
ssert
(
nEnum
>
0
);
s
tatic
_a
ssert
(
nEnum
>
0
,
"nEnum must be positive (non-zero)"
);
// Private Member Functions
...
...
src/OpenFOAM/db/error/StaticAssert.H
deleted
100644 → 0
View file @
dc2951ca
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::StaticAssertionFailed
Description
Macros and classes to provide static (compile-time) assertions.
Ideas from various sources
(http://www.ddj.com/cpp/184401547, http://www.boost.org)
\*---------------------------------------------------------------------------*/
#ifndef StaticAssert_H
#define StaticAssert_H
namespace
Foam
{
//- Forward declaration of StaticAssertionFailed.
// Leave as an incomplete class so that sizeof(..) fails
template
<
bool
Truth
>
class
StaticAssertionFailed
;
/*---------------------------------------------------------------------------*\
Class StaticAssertionFailed Declaration
\*---------------------------------------------------------------------------*/
//- Specialization for successful assertions
template
<
>
class
StaticAssertionFailed
<
true
>
{};
//- Helper class for handling static assertions
template
<
unsigned
Test
>
class
StaticAssertionTest
{};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Paste together strings, even if an argument is itself a macro
#define StaticAssertMacro(X,Y) StaticAssertMacro1(X,Y)
#define StaticAssertMacro1(X,Y) StaticAssertMacro2(X,Y)
#define StaticAssertMacro2(X,Y) X##Y
#ifdef __GNUC__
#define StaticAssertUnusedTypedef __attribute__((unused))
#else
#define StaticAssertUnusedTypedef
#endif
//- Assert that some test is true at compile-time
#define StaticAssert(Test) \
typedef ::Foam::StaticAssertionTest \
< \
sizeof( ::Foam::StaticAssertionFailed<((Test) ? true : false)>) \
> StaticAssertMacro(StaticAssertionTest, __LINE__) StaticAssertUnusedTypedef
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H
View file @
3cfc54ba
...
...
@@ -37,7 +37,7 @@ SourceFiles
#define DynamicField_H
#include
"Field.H"
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -73,8 +73,11 @@ class DynamicField
:
public
Field
<
T
>
{
//- Avoid invalid sizing parameters
StaticAssert
((
SizeInc
||
SizeMult
)
&&
SizeDiv
);
static_assert
(
(
SizeInc
||
SizeMult
)
&&
SizeDiv
,
"Avoid invalid sizing parameters"
);
// Private data
...
...
src/OpenFOAM/primitives/MatrixSpace/MatrixSpaceI.H
View file @
3cfc54ba
...
...
@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...
...
@@ -90,8 +90,16 @@ ConstBlock(const msType& matrix)
:
matrix_
(
matrix
)
{
StaticAssert
(
msType
::
mRows
>=
BRowStart
+
mRows
);
StaticAssert
(
msType
::
nCols
>=
BColStart
+
nCols
);
static_assert
(
msType
::
mRows
>=
BRowStart
+
mRows
,
"Rows in block > rows in matrix"
);
static_assert
(
msType
::
nCols
>=
BColStart
+
nCols
,
"Columns in block > columns in matrix"
);
}
...
...
@@ -103,8 +111,16 @@ Block(msType& matrix)
:
matrix_
(
matrix
)
{
StaticAssert
(
msType
::
mRows
>=
BRowStart
+
mRows
);
StaticAssert
(
msType
::
nCols
>=
BColStart
+
nCols
);
static_assert
(
msType
::
mRows
>=
BRowStart
+
mRows
,
"Rows in block > rows in matrix"
);
static_assert
(
msType
::
nCols
>=
BColStart
+
nCols
,
"Columns in block > columns in matrix"
);
}
...
...
@@ -114,7 +130,7 @@ template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
template
<
Foam
::
direction
Row
,
Foam
::
direction
Col
>
inline
const
Cmpt
&
Foam
::
MatrixSpace
<
Form
,
Cmpt
,
Mrows
,
Ncols
>::
elmt
()
const
{
S
tatic
A
ssert
(
Row
<
Mrows
&&
Col
<
Ncols
);
s
tatic
_a
ssert
(
Row
<
Mrows
&&
Col
<
Ncols
,
"Address outside matrix"
);
return
this
->
v_
[
Row
*
Ncols
+
Col
];
}
...
...
@@ -123,7 +139,7 @@ template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
template
<
Foam
::
direction
Row
,
Foam
::
direction
Col
>
inline
Cmpt
&
Foam
::
MatrixSpace
<
Form
,
Cmpt
,
Mrows
,
Ncols
>::
elmt
()
{
S
tatic
A
ssert
(
Row
<
Mrows
&&
Col
<
Ncols
);
s
tatic
_a
ssert
(
Row
<
Mrows
&&
Col
<
Ncols
,
"Address outside matrix"
);
return
this
->
v_
[
Row
*
Ncols
+
Col
];
}
...
...
@@ -256,7 +272,7 @@ template<class Form, class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
inline
Foam
::
MatrixSpace
<
Form
,
Cmpt
,
Mrows
,
Ncols
>
Foam
::
MatrixSpace
<
Form
,
Cmpt
,
Mrows
,
Ncols
>::
identity
()
{
S
tatic
A
ssert
(
Mrows
==
Ncols
);
s
tatic
_a
ssert
(
Mrows
==
Ncols
,
"Matrix is not square"
);
msType
result
(
Zero
);
for
(
direction
i
=
0
;
i
<
Ncols
;
++
i
)
...
...
@@ -499,7 +515,7 @@ operator=
const
VectorSpace
<
VSForm
,
Cmpt
,
SubTensor
::
mRows
>&
v
)
{
S
tatic
A
ssert
(
nCols
==
1
);
s
tatic
_a
ssert
(
nCols
==
1
,
"Matrix must have a single column"
);
for
(
direction
i
=
0
;
i
<
SubTensor
::
mRows
;
++
i
)
{
...
...
@@ -560,7 +576,11 @@ inline typename typeOfInnerProduct<Cmpt, Form1, Form2>::type operator&
const
MatrixSpace
<
Form2
,
Cmpt
,
Mrows2
,
Ncols2
>&
matrix2
)
{
StaticAssert
(
Ncols1
==
Mrows2
);
static_assert
(
Ncols1
==
Mrows2
,
"Number of columns in matrix 1 != number of rows in matrix 2"
);
typename
typeOfInnerProduct
<
Cmpt
,
Form1
,
Form2
>::
type
result
(
Zero
);
...
...
src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H
View file @
3cfc54ba
...
...
@@ -27,7 +27,7 @@ License
#include
"products.H"
#include
"VectorSpaceOps.H"
#include
"ops.H"
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -79,7 +79,11 @@ VectorSpace<Form, Cmpt, Ncmpts>::ConstBlock<SubVector, BStart>::ConstBlock
:
vs_
(
vs
)
{
StaticAssert
(
vsType
::
nComponents
>=
BStart
+
nComponents
);
static_assert
(
vsType
::
nComponents
>=
BStart
+
nComponents
,
"Requested block size > VectorSpace size"
);
}
...
...
src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H
View file @
3cfc54ba
...
...
@@ -52,7 +52,7 @@ SourceFiles
#include
"scalar.H"
#include
"Ostream.H"
#include
"VectorSpace.H"
#include
"StaticAssert.H"
#include
<type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -81,8 +81,7 @@ class Polynomial
:
public
VectorSpace
<
Polynomial
<
PolySize
>
,
scalar
,
PolySize
>
{
//- Size must be positive (non-zero)
StaticAssert
(
PolySize
>
0
);
static_assert
(
PolySize
>
0
,
"Size must be positive (non-zero)"
);
// Private data
...
...
src/postProcessing/functionObjects/field/Make/files
View file @
3cfc54ba
...
...
@@ -46,7 +46,4 @@ surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
regionSizeDistribution/regionSizeDistribution.C
regionSizeDistribution/regionSizeDistributionFunctionObject.C
histogram/histogram.C
histogram/histogramFunctionObject.C
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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