STYLE: consistent ordering of is_same parameters

This commit is contained in:
Mark Olesen 2019-01-10 07:55:53 +01:00
parent 7720b59066
commit c52d70cce3
6 changed files with 16 additions and 29 deletions

View File

@ -322,7 +322,7 @@ public:
//
// \return True if value changed.
template<class TypeT = T>
typename std::enable_if<std::is_same<TypeT, bool>::value, bool>::type
typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
inline set(const label i, bool val = true)
{
if (i < 0)

View File

@ -501,7 +501,7 @@ public:
//
// \return The element value, or false for out-of-range access
template<class TypeT = T>
typename std::enable_if<std::is_same<TypeT, bool>::value, bool>::type
typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
inline test(const label i) const
{
return (i >= 0 && i < size() && v_[i]);
@ -511,7 +511,7 @@ public:
//
// \return The element value, or false for out-of-range access
template<class TypeT = T>
typename std::enable_if<std::is_same<TypeT, bool>::value, bool>::type
typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
inline get(const label i) const
{
return (i >= 0 && i < size_ && v_[i]);
@ -521,7 +521,7 @@ public:
//
// \return True if value changed and was not out-of-range
template<class TypeT = T>
typename std::enable_if<std::is_same<TypeT, bool>::value, bool>::type
typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
inline unset(const label i)
{
if (i >= 0 && i < size_ && v_[i])

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,15 +40,12 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
static_assert
(
(
std::is_same<typename pTraits<Type>::cmptType,label>::value
std::is_same<label, typename pTraits<Type>::cmptType>::value
|| std::is_floating_point<typename pTraits<Type>::cmptType>::value
),
"Label and Floating-point vector space only"
);
const bool isLabel =
std::is_same<typename pTraits<Type>::cmptType,label>::value;
// Other integral types (eg, bool etc) would need cast/convert to label.
// Similarly for labelVector etc.
@ -70,7 +67,7 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
if (Pstream::master())
{
if (isLabel)
if (std::is_same<label, typename pTraits<Type>::cmptType>::value)
{
const uint64_t payLoad =
vtk::sizeofData<label, nCmpt>(nTotParcels);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,7 +53,7 @@ void Foam::vtk::lagrangianWriter::write(const IOField<Type>& field)
static_assert
(
(
std::is_same<typename pTraits<Type>::cmptType,label>::value
std::is_same<label, typename pTraits<Type>::cmptType>::value
|| std::is_floating_point<typename pTraits<Type>::cmptType>::value
),
"Label and Floating-point vector space only"
@ -72,9 +72,6 @@ void Foam::vtk::lagrangianWriter::write(const IOField<Type>& field)
// }
// }
const bool isLabel =
std::is_same<typename pTraits<Type>::cmptType(), label>::value;
const direction nCmpt(pTraits<Type>::nComponents);
@ -89,7 +86,7 @@ void Foam::vtk::lagrangianWriter::write(const IOField<Type>& field)
{
// Non-legacy
if (isLabel)
if (std::is_same<label, typename pTraits<Type>::cmptType>::value)
{
const uint64_t payLoad = vtk::sizeofData<label, nCmpt>(nVals);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,16 +53,12 @@ void Foam::vtk::indirectPatchWriter::write
static_assert
(
(
std::is_same<typename pTraits<Type>::cmptType,label>::value
std::is_same<label, typename pTraits<Type>::cmptType>::value
|| std::is_floating_point<typename pTraits<Type>::cmptType>::value
),
"Label and Floating-point vector space only"
);
const bool isLabel =
std::is_same<typename pTraits<Type>::cmptType(), label>::value;
const direction nCmpt(pTraits<Type>::nComponents);
label nValues = field.size();
@ -78,7 +74,7 @@ void Foam::vtk::indirectPatchWriter::write
if (format_)
{
if (isLabel)
if (std::is_same<label, typename pTraits<Type>::cmptType>::value)
{
if (legacy())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,15 +53,12 @@ void Foam::vtk::surfaceWriter::write
static_assert
(
(
std::is_same<typename pTraits<Type>::cmptType,label>::value
std::is_same<label, typename pTraits<Type>::cmptType>::value
|| std::is_floating_point<typename pTraits<Type>::cmptType>::value
),
"Label and Floating-point vector space only"
);
const bool isLabel =
std::is_same<typename pTraits<Type>::cmptType(), label>::value;
const direction nCmpt(pTraits<Type>::nComponents);
@ -78,7 +75,7 @@ void Foam::vtk::surfaceWriter::write
if (format_)
{
if (isLabel)
if (std::is_same<label, typename pTraits<Type>::cmptType>::value)
{
if (legacy())
{