Commit 73fe45cd authored by Henry Weller's avatar Henry Weller
Browse files

src/postProcessing/functionObjects/field/Make/files: Corrected

parent 97f473ff
......@@ -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[])
......
......@@ -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[])
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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)
StaticAssert(nEnum > 0);
static_assert(nEnum > 0, "nEnum must be positive (non-zero)");
// Private Member Functions
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
......@@ -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
......
......@@ -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
{
StaticAssert(Row < Mrows && Col < Ncols);
static_assert(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()
{
StaticAssert(Row < Mrows && Col < Ncols);
static_assert(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()
{
StaticAssert(Mrows == Ncols);
static_assert(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
)
{
StaticAssert(nCols == 1);
static_assert(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);
......
......@@ -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"
);
}
......
......@@ -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
......
......@@ -46,7 +46,4 @@ surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
regionSizeDistribution/regionSizeDistribution.C
regionSizeDistribution/regionSizeDistributionFunctionObject.C
histogram/histogram.C
histogram/histogramFunctionObject.C
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment