ENH: relocate zero_one to pTraits, allows reuse for scalar clamping

ENH: add pTraits and IO for std::int8_t

STYLE: cull some implicitly available includes

- pTraits.H is included by label/scalar etc
- zero.H is included by UList

STYLE: cull redundant forward declarations for Istream/Ostream
This commit is contained in:
Mark Olesen 2023-02-22 18:25:33 +01:00
parent f3d447579a
commit d88272f031
102 changed files with 475 additions and 427 deletions

View File

@ -81,7 +81,7 @@ namespace ListPolicy
{
// Override on a per-type basis
template<> struct short_length<short> : std::integral_constant<short,20> {};
template<> struct short_length<short> : std::integral_constant<int,20> {};
} // End namespace ListPolicy
} // End namespace Detail

View File

@ -146,7 +146,7 @@ int main(int argc, char *argv[])
Random rnd(4567);
for (scalar& val : someField)
{
val = rnd.position(-0.2, 1.2);
val = rnd.position(scalar(-0.2), scalar(1.2));
}
Info<< nl
@ -171,6 +171,7 @@ int main(int argc, char *argv[])
// nope << " : " << clamp(val, zero_one{})
// nope << " : " << clamp(val, scalarMinMax(zero_one{}))
<< " : " << clamp(val, 0, 1)
<< " : " << clamp(val, zero_one{})
<< nl;
}

View File

@ -33,7 +33,7 @@ Description
#include "Switch.H"
#include "string.H"
#include "dictionary.H"
#include "nil.H"
#include "zero.H"
#include "IOstreams.H"
#include "PstreamBuffers.H"
#include "argList.H"
@ -82,8 +82,8 @@ int main(int argc, char *argv[])
}
{
nil x;
cout<<"nil:" << sizeof(x) << nl;
zero x;
cout<<"zero:" << sizeof(x) << nl;
}
#if 0
{

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef edgeStats_H
#define edgeStats_H
#ifndef Foam_edgeStats_H
#define Foam_edgeStats_H
#include "direction.H"
#include "scalar.H"
@ -45,9 +45,8 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
class polyMesh;
class Ostream;
class twoDPointCorrector;
/*---------------------------------------------------------------------------*\

View File

@ -62,7 +62,7 @@ namespace Foam
// Volume porosity -> blockage
inline scalar getPorosity(const dictionary& dict)
{
return 1 - clamp(dict.getOrDefault<scalar>("porosity", 0), 0, 1);
return 1 - clamp(dict.getOrDefault<scalar>("porosity", 0), zero_one{});
}
// Direction porosities -> blockage
@ -74,7 +74,7 @@ inline vector getPorosities(const dictionary& dict)
{
for (scalar& val : blockage)
{
val = 1 - clamp(val, 0, 1);
val = 1 - clamp(val, zero_one{});
}
}

View File

@ -108,7 +108,7 @@ void setAlpha
{
cutCell.calcSubCell(cellI, 0.0);
alpha1[cellI] = clamp(cutCell.VolumeOfFluid(), 0, 1);
alpha1[cellI] = clamp(cutCell.VolumeOfFluid(), zero_one{});
if (writeOBJ && (mag(cutCell.faceArea()) >= 1e-14))
{

View File

@ -50,7 +50,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class Ostream;
/*---------------------------------------------------------------------------*\

View File

@ -50,7 +50,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class Ostream;
/*---------------------------------------------------------------------------*\

View File

@ -42,22 +42,21 @@ $(chars)/lists/charUList.C
primitives/direction/directionIO.C
ints = primitives/ints
$(ints)/uint/uintIO.C
$(ints)/uint8/uint8.C
$(ints)/uint8/uint8IO.C
$(ints)/uint16/uint16.C
$(ints)/uint32/uint32.C
$(ints)/uint32/uint32IO.C
$(ints)/uint64/uint64.C
$(ints)/uint64/uint64IO.C
$(ints)/uint/uintIO.C
$(ints)/uLabel/uLabel.C
$(ints)/int/intIO.C
$(ints)/int16/int16.C
$(ints)/int32/int32.C
$(ints)/int32/int32IO.C
$(ints)/int64/int64.C
$(ints)/int64/int64IO.C
$(ints)/int/intIO.C
$(ints)/label/label.C
$(ints)/uLabel/uLabel.C
$(ints)/lists/labelList.C
$(ints)/lists/labelIOList.C
$(ints)/lists/labelListIOList.C

View File

@ -48,7 +48,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
template<class Type> class dynamicIndexedOctree;
template<class Type>
Ostream& operator<<(Ostream&, const dynamicIndexedOctree<Type>&);

View File

@ -53,7 +53,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
template<class Type> class indexedOctree;
template<class Type> Ostream& operator<<(Ostream&, const indexedOctree<Type>&);

View File

@ -47,9 +47,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
template<class LListBase, class T> class ILList;
template<class LListBase, class T> Istream& operator>>

View File

@ -48,10 +48,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
template<class LListBase, class T> class LList;
template<class LListBase, class T>

View File

@ -49,8 +49,6 @@ namespace Foam
{
// Forward Declarations
class Ostream;
template<class LListBase, class T> class UILList;
template<class LListBase, class T>

View File

@ -57,7 +57,6 @@ SourceFiles
#include "ListPolicy.H"
#include <iterator>
#include <type_traits>
#include <vector> // i.e, std::vector
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,8 +65,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
class labelRange;
template<class T> class List;

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "pTraits.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -31,10 +31,9 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef ListPolicy_H
#define ListPolicy_H
#ifndef Foam_ListPolicy_H
#define Foam_ListPolicy_H
#include "label.H"
#include <type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,9 +42,9 @@ namespace Foam
{
// Forward Declarations
class keyType;
class word;
class wordRe;
class keyType;
namespace Detail
{
@ -58,11 +57,11 @@ namespace ListPolicy
//
// Default definition: 10
template<class T>
struct short_length : std::integral_constant<label,10> {};
struct short_length : std::integral_constant<int,10> {};
// Could override on a per-type basis
// Can override on a per-type basis
// Eg,
// template<> struct short_length<label> : std::integral_constant<label,20> {};
// template<> struct short_length<label> : std::integral_constant<int,20> {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,19 +74,19 @@ struct short_length : std::integral_constant<label,10> {};
template<class T>
struct no_linebreak : std::is_arithmetic<T> {};
// Specialization for word, wordRe, keyType
// Specialization for word-like classes
// These elements are normally fairly short, so ok to output a few (eg, 10)
// of them on a single line.
//- Suppress line-breaks for keyType
template<> struct no_linebreak<keyType> : std::true_type {};
//- Suppress line-breaks for word
template<> struct no_linebreak<word> : std::true_type {};
//- Suppress line-breaks for wordRe
template<> struct no_linebreak<wordRe> : std::true_type {};
//- Suppress line-breaks for keyType
template<> struct no_linebreak<keyType> : std::true_type {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -51,8 +51,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
template<class T, class BaseType> class CompactIOList;
template<class T, class BaseType> Istream& operator>>

View File

@ -31,23 +31,25 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef InfoProxy_H
#define InfoProxy_H
#ifndef Foam_InfoProxy_H
#define Foam_InfoProxy_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class Ostream;
template<class T> class InfoProxy;
template<class T> Ostream& operator<<(Ostream&, const InfoProxy<T>&);
/*---------------------------------------------------------------------------*\
Class InfoProxy Declaration
\*---------------------------------------------------------------------------*/
template<class T> class InfoProxy;
template<class T> Ostream& operator<<(Ostream&, const InfoProxy<T>&);
template<class T>
class InfoProxy
{

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef memoryStreamBuffer_H
#define memoryStreamBuffer_H
#ifndef Foam_memoryStreamBuffer_H
#define Foam_memoryStreamBuffer_H
#include "UList.H"
#include <type_traits>
@ -44,9 +44,6 @@ Description
namespace Foam
{
// Forward Declarations
class Ostream;
/*---------------------------------------------------------------------------*\
Class memorybuf Declaration
\*---------------------------------------------------------------------------*/

View File

@ -101,6 +101,7 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class dlLibraryTable;

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/
#include "dimensionedType.H"
#include "pTraits.H"
#include "dictionary.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -43,7 +43,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class dictionary;
class Istream;
class Ostream;

View File

@ -42,7 +42,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class Istream;
class Ostream;

View File

@ -52,8 +52,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef profiling_H
#define profiling_H
#ifndef Foam_profiling_H
#define Foam_profiling_H
#include "profilingTrigger.H"
#include "IOdictionary.H"
@ -69,7 +69,6 @@ namespace Foam
{
// Forward Declarations
class Ostream;
class cpuInfo;
class memInfo;
class profilingInformation;

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef MatrixTools_H
#define MatrixTools_H
#ifndef Foam_MatrixTools_H
#define Foam_MatrixTools_H
#include "Matrix.H"
@ -44,9 +44,6 @@ SourceFiles
namespace Foam
{
// Forward declarations
class Ostream;
/*---------------------------------------------------------------------------*\
Namespace MatrixTools Declaration
\*---------------------------------------------------------------------------*/

View File

@ -294,6 +294,13 @@ inline bool notEqual(const Scalar a, const Scalar b)
}
//- Clamp scalar value to a 0-1 range
inline Scalar clamp(const Scalar val, const Foam::zero_one)
{
return (val < 0) ? 0 : (1 < val) ? 1 : val;
}
// Fast implementation, and with scalar promotion of upper/lower limits
inline Scalar clamp(const Scalar& val, const Scalar& lower, const Scalar& upper)
{

View File

@ -35,12 +35,13 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_doubleScalar_H
#define Foam_doubleScalar_H
#ifndef Foam_primitives_double_H
#define Foam_primitives_double_H
#include "scalarFwd.H"
#include "doubleFloat.H"
#include "direction.H"
#include "pTraits.H"
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -35,12 +35,13 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_floatScalar_H
#define Foam_floatScalar_H
#ifndef Foam_primitives_float_H
#define Foam_primitives_float_H
#include "scalarFwd.H"
#include "doubleFloat.H"
#include "direction.H"
#include "pTraits.H"
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef products_H
#define products_H
#ifndef Foam_products_H
#define Foam_products_H
#include "direction.H"
#include "pTraits.H"

View File

@ -35,18 +35,17 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef bool_H
#define bool_H
#ifndef Foam_primitives_bool_H
#define Foam_primitives_bool_H
#include "pTraits.H"
#include "direction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// IOstream Operators
//- Read bool from stream using Foam::Switch(Istream&)
@ -58,18 +57,12 @@ Ostream& operator<<(Ostream& os, const bool b);
//- Read bool from stream using Foam::Switch(Istream&)
bool readBool(Istream& is);
} // End namespace Foam
/*---------------------------------------------------------------------------*\
Specialization pTraits<bool>
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pTraits.H"
#include "direction.H"
namespace Foam
{
// Template specialisation for pTraits<bool>
//- Template specialisation for pTraits\<bool\>
template<>
class pTraits<bool>
{
@ -121,16 +114,10 @@ public:
// Member Functions
//- Return the value
operator bool() const noexcept
{
return p_;
}
operator bool() const noexcept { return p_; }
//- Access the value
operator bool&() noexcept
{
return p_;
}
operator bool&() noexcept { return p_; }
};

View File

@ -38,15 +38,13 @@ SourceFiles
#ifndef Foam_primitives_char_H
#define Foam_primitives_char_H
#include "pTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Read single character
@ -76,16 +74,9 @@ inline bool isspace(char c) noexcept
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pTraits.H"
namespace Foam
{
/*---------------------------------------------------------------------------*\
Specialization pTraits<char>
\*---------------------------------------------------------------------------*/
//- Template specialisation for pTraits\<char\>
template<>
@ -115,16 +106,10 @@ public:
// Member Functions
//- Return the value
operator char() const noexcept
{
return p_;
}
operator char() const noexcept { return p_; }
//- Access the value
operator char&() noexcept
{
return p_;
}
operator char&() noexcept { return p_; }
};

View File

@ -38,8 +38,8 @@ See also
\*---------------------------------------------------------------------------*/
#ifndef wchar_H
#define wchar_H
#ifndef Foam_primitives_wchar_H
#define Foam_primitives_wchar_H
#include <cwchar>
#include <string>

View File

@ -44,7 +44,6 @@ SourceFiles
#include "zero.H"
#include "contiguous.H"
#include <complex>
#include <type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -224,10 +223,10 @@ public:
/*---------------------------------------------------------------------------*\
Class pTraits<complex> Declaration
Specialization pTraits<complex>
\*---------------------------------------------------------------------------*/
// Template specialisation for pTraits<complex>
//- Template specialisation for pTraits<complex>
template<>
class pTraits<complex>
{
@ -288,16 +287,10 @@ public:
// Member Functions
//- Return the value
operator complex() const noexcept
{
return p_;
}
operator complex() const noexcept { return p_; }
//- Access the value
operator complex&() noexcept
{
return p_;
}
operator complex&() noexcept { return p_; }
};

View File

@ -36,21 +36,19 @@ Note
\*---------------------------------------------------------------------------*/
#ifndef primitives_direction_H
#define primitives_direction_H
#ifndef Foam_primitives_direction_H
#define Foam_primitives_direction_H
#include <cstdint>
#include <iostream>
#include "pTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef uint8_t direction;

View File

@ -47,7 +47,7 @@ Foam::Istream& Foam::operator>>(Istream& is, direction& val)
if (!t.good())
{
FatalIOErrorInFunction(is)
<< "Bad token - could not get direction"
<< "Bad token - could not get uint8/direction"
<< exit(FatalIOError);
is.setBad();
return is;
@ -60,7 +60,7 @@ Foam::Istream& Foam::operator>>(Istream& is, direction& val)
else
{
FatalIOErrorInFunction(is)
<< "Wrong token type - expected label (direction), found "
<< "Wrong token type - expected label (uint8/direction), found "
<< t.info()
<< exit(FatalIOError);
is.setBad();

View File

@ -100,7 +100,7 @@ protected:
//- that forms the basis of many more complex ramp functions
inline scalar linearRamp(const scalar t) const
{
return clamp((t - start_)/duration_, 0, 1);
return clamp((t - start_)/duration_, zero_one{});
}

View File

@ -50,9 +50,9 @@ namespace Foam
{
// Forward Declarations
class SHA1;
class Istream;
class Ostream;
class SHA1;
/*---------------------------------------------------------------------------*\
Class SHA1Digest Declaration

View File

@ -37,6 +37,7 @@ SourceFiles
#ifndef Foam_primitives_int_H
#define Foam_primitives_int_H
#include "int8.H"
#include "int16.H"
#include "int32.H"
#include "int64.H"

View File

@ -27,7 +27,7 @@ Primitive
int16_t
Description
16bit signed integer. I/O is done via an int32.
16bit signed integer. I/O is done as an int32.
SourceFiles
int16.C
@ -38,6 +38,9 @@ SourceFiles
#define Foam_primitives_int16_H
#include <cstdint>
#include "direction.H"
#include "pTraits.H"
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,10 +48,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of int16 value

View File

@ -52,10 +52,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of int32 value
@ -76,6 +72,12 @@ struct nameOp<int32_t>
};
inline int32_t mag(const int32_t val)
{
return ::abs(val);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
//- Read int32_t from stream
@ -131,6 +133,10 @@ Ostream& operator<<(Ostream& os, const int32_t val);
#endif
/*---------------------------------------------------------------------------*\
Specialization pTraits<int32_t>
\*---------------------------------------------------------------------------*/
//- Template specialization for pTraits<int32_t>
template<>
class pTraits<int32_t>
@ -187,25 +193,13 @@ public:
// Member Functions
//- Return the value
operator int32_t() const noexcept
{
return p_;
}
operator int32_t() const noexcept { return p_; }
//- Access the value
operator int32_t&() noexcept
{
return p_;
}
operator int32_t&() noexcept { return p_; }
};
inline int32_t mag(const int32_t val)
{
return ::abs(val);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -52,10 +52,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of int64 value
@ -76,6 +72,12 @@ struct nameOp<int64_t>
};
inline int64_t mag(const int64_t val)
{
return ::labs(val);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
//- Read int64_t from stream
@ -130,6 +132,10 @@ Ostream& operator<<(Ostream& os, const int64_t val);
#endif
/*---------------------------------------------------------------------------*\
Specialization pTraits<int64_t>
\*---------------------------------------------------------------------------*/
//- Template specialization for pTraits<int64_t>
template<>
class pTraits<int64_t>
@ -186,25 +192,13 @@ public:
// Member Functions
//- Return the value
operator int64_t() const noexcept
{
return p_;
}
operator int64_t() const noexcept { return p_; }
//- Access the value
operator int64_t&() noexcept
{
return p_;
}
operator int64_t&() noexcept { return p_; }
};
inline int64_t mag(const int64_t val)
{
return ::labs(val);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#include "int8.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* const Foam::pTraits<int8_t>::typeName = "int8";
const char* const Foam::pTraits<int8_t>::componentNames[] = { "" };
const int8_t Foam::pTraits<int8_t>::zero = 0;
const int8_t Foam::pTraits<int8_t>::one = 1;
const int8_t Foam::pTraits<int8_t>::min = INT8_MIN;
const int8_t Foam::pTraits<int8_t>::max = INT8_MAX;
const int8_t Foam::pTraits<int8_t>::rootMin = INT8_MIN;
const int8_t Foam::pTraits<int8_t>::rootMax = INT8_MAX;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pTraits<int8_t>::pTraits(Istream& is)
{
is >> p_;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// int8_t Foam::readInt8(Istream& is)
// {
// int8_t val(0);
// is >> val;
//
// return val;
// }
Foam::Istream& Foam::operator>>(Istream& is, int8_t& val)
{
token t(is);
if (!t.good())
{
FatalIOErrorInFunction(is)
<< "Bad token - could not get int8"
<< exit(FatalIOError);
is.setBad();
return is;
}
// Accept separated '-' (or '+') while expecting a number.
// This can arise during dictionary expansions (Eg, -$value)
if (t.isLabel())
{
val = int8_t(t.labelToken());
}
else
{
FatalIOErrorInFunction(is)
<< "Wrong token type - expected label (int8), found "
<< t.info() << exit(FatalIOError);
is.setBad();
return is;
}
is.check(FUNCTION_NAME);
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const int8_t val)
{
os.write(label(val));
os.check(FUNCTION_NAME);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Primitive
int8_t
Description
8bit signed integer
SourceFiles
int8.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_primitives_int8_H
#define Foam_primitives_int8_H
#include <cstdint>
#include <climits>
#include <cstdlib>
#include "direction.H"
#include "pTraits.H"
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of uint8 value
inline word name(const int8_t val)
{
return word(std::to_string(int(val)), false); // Needs no stripping
}
//- A word representation of uint8 value
template<>
struct nameOp<int8_t>
{
word operator()(const int8_t val) const
{
return word(std::to_string(int(val)), false); // Needs no stripping
}
};
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
//- Read from stream (as label)
Istream& operator>>(Istream& is, int8_t& val);
//- Write to stream (as label)
Ostream& operator<<(Ostream& os, const int8_t val);
/*---------------------------------------------------------------------------*\
Specialization pTraits<int8_t>
\*---------------------------------------------------------------------------*/
//- Template specialization for pTraits<int8_t>
template<>
class pTraits<int8_t>
{
int8_t p_;
public:
// Typedefs
//- Component type
typedef int8_t cmptType;
// Member Constants
//- Dimensionality of space
static constexpr direction dim = 3;
//- Rank of int8_t is 0
static constexpr direction rank = 0;
//- Number of components in int8_t is 1
static constexpr direction nComponents = 1;
// Static Data Members
static const char* const typeName;
static const char* const componentNames[];
static const int8_t zero;
static const int8_t one;
static const int8_t min;
static const int8_t max;
static const int8_t rootMax;
static const int8_t rootMin;
// Constructors
//- Copy construct from primitive
explicit pTraits(int8_t val) noexcept
:
p_(val)
{}
//- Read construct from Istream
explicit pTraits(Istream& is);
// Member Functions
//- Return the value
operator int8_t() const noexcept { return p_; }
//- Access the value
operator int8_t&() noexcept { return p_; }
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,7 +27,7 @@ Primitive
uint16_t
Description
16bit unsigned integer. I/O is done via an int32.
16bit unsigned integer. I/O is done as an int32.
SourceFiles
uint16.C
@ -38,6 +38,9 @@ SourceFiles
#define Foam_primitives_uint16_H
#include <cstdint>
#include "direction.H"
#include "pTraits.H"
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,10 +48,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of uint16 value

View File

@ -52,10 +52,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of uint32 value
@ -120,6 +116,11 @@ inline bool read(const std::string& str, uint32_t& val)
Istream& operator>>(Istream& is, uint32_t& val);
Ostream& operator<<(Ostream& os, const uint32_t val);
/*---------------------------------------------------------------------------*\
Specialization pTraits<uint32_t>
\*---------------------------------------------------------------------------*/
//- Template specialization for pTraits<uint32_t>
template<>
class pTraits<uint32_t>
@ -173,16 +174,10 @@ public:
// Member Functions
//- Return the value
operator uint32_t() const noexcept
{
return p_;
}
operator uint32_t() const noexcept { return p_; }
//- Access the value
operator uint32_t&() noexcept
{
return p_;
}
operator uint32_t&() noexcept { return p_; }
};

View File

@ -52,10 +52,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of uint64 value
@ -129,6 +125,10 @@ Ostream& operator<<(Ostream& os, const uint64_t val);
#endif
/*---------------------------------------------------------------------------*\
Specialization pTraits<uint64_t>
\*---------------------------------------------------------------------------*/
//- Template specialization for pTraits<uint64_t>
template<>
class pTraits<uint64_t>
@ -182,16 +182,10 @@ public:
// Member Functions
//- Return the value
operator uint64_t() const noexcept
{
return p_;
}
operator uint64_t() const noexcept { return p_; }
//- Access the value
operator uint64_t&() noexcept
{
return p_;
}
operator uint64_t&() noexcept { return p_; }
};

View File

@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "uint8.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -48,4 +49,17 @@ Foam::pTraits<uint8_t>::pTraits(Istream& is)
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
uint8_t Foam::readUint8(Istream& is)
{
uint8_t val(0);
is >> val;
return val;
}
// IO operators are identical to direction, which is uint8_t
// ************************************************************************* //

View File

@ -31,7 +31,6 @@ Description
SourceFiles
uint8.C
uint8IO.C
\*---------------------------------------------------------------------------*/
@ -51,10 +50,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of uint8 value
@ -83,7 +78,9 @@ uint8_t readUint8(Istream& is);
// IO operators are identical to direction, which is uint8_t
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/*---------------------------------------------------------------------------*\
Specialization pTraits<uint8_t>
\*---------------------------------------------------------------------------*/
//- Template specialization for pTraits<uint8_t>
template<>

View File

@ -1,44 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#include "uint8.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
uint8_t Foam::readUint8(Istream& is)
{
uint8_t val(0);
is >> val;
return val;
}
// IO operators are identical to direction, which is uint8_t
// ************************************************************************* //

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Random_H
#define Random_H
#ifndef Foam_Random_H
#define Foam_Random_H
#include "Rand48.H"
#include "label.H"

View File

@ -47,8 +47,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
class labelRanges;
Istream& operator>>(Istream& is, labelRanges& ranges);
Ostream& operator<<(Ostream& is, const labelRanges& ranges);

View File

@ -56,7 +56,6 @@ namespace Foam
// Forward Declarations
class scalarRange;
class Ostream;
template<class T> class MinMax;
Ostream& operator<<(Ostream& os, const scalarRange& range);

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef sliceRange_H
#define sliceRange_H
#ifndef Foam_sliceRange_H
#define Foam_sliceRange_H
#include "label.H"
#include <iterator>
@ -47,8 +47,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
template<class T> class List;
template<class T, unsigned N> class FixedList;

View File

@ -54,11 +54,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
// Forward Declarations
class spatialTransform;
Istream& operator>>(Istream&, spatialTransform&);
Ostream& operator<<(Ostream&, const spatialTransform&);

View File

@ -5,7 +5,6 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -62,8 +61,8 @@ Description
#ifndef Foam_contiguous_H
#define Foam_contiguous_H
#include "scalarFwd.H"
#include "labelFwd.H"
#include "scalarFwd.H"
#include <type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,26 +74,17 @@ namespace Foam
// Base definition for (integral | floating-point) as contiguous
template<class T>
struct is_contiguous
:
std::is_arithmetic<T>
{};
struct is_contiguous : std::is_arithmetic<T> {};
// Base definition for 'label'
template<class T>
struct is_contiguous_label
:
std::is_same<T, label>
{};
struct is_contiguous_label : std::is_same<T, label> {};
// Base definition for 'scalar'
template<class T>
struct is_contiguous_scalar
:
std::is_same<T, scalar>
{};
struct is_contiguous_scalar : std::is_same<T, scalar> {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -51,7 +51,6 @@ namespace Foam
{
// Forward Declarations
class one;
class Istream;
class Ostream;
@ -63,11 +62,11 @@ class one
{
public:
//- The value type
typedef one value_type;
// Forward Declarations
class minus;
class null;
//- Default construct
constexpr one() noexcept {}
@ -113,6 +112,7 @@ class one::minus
{
public:
//- The value type
typedef minus value_type;
//- Default construct
@ -148,27 +148,6 @@ public:
};
/*---------------------------------------------------------------------------*\
Class one::null Declaration
\*---------------------------------------------------------------------------*/
//- A Foam::one class with a null output adapter.
class one::null
:
public one
{
public:
typedef null value_type;
//- Default construct
constexpr null() noexcept {}
//- Construct from Istream consumes no content.
explicit constexpr null(Istream&) noexcept {}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Global one (1)
@ -188,12 +167,6 @@ inline constexpr Istream& operator>>(Istream& is, one::minus&) noexcept
return is;
}
//- Write to Ostream emits no content.
inline constexpr Ostream& operator<<(Ostream& os, const one::null&) noexcept
{
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -46,6 +46,7 @@ namespace Foam
// Forward Declarations
class Istream;
class Ostream;
/*---------------------------------------------------------------------------*\
Class pTraits Declaration
@ -76,6 +77,14 @@ public:
};
/*---------------------------------------------------------------------------*\
Class zero_one Declaration
\*---------------------------------------------------------------------------*/
//- Represents 0/1 range or concept. Used for tagged dispatch or clamping
class zero_one {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -52,8 +52,6 @@ namespace Foam
{
// Forward Declarations
class zero;
class zero_one;
class Istream;
class Ostream;
@ -65,6 +63,7 @@ class zero
{
public:
//- The value type
typedef zero value_type;
// Forward Declarations
@ -133,24 +132,6 @@ public:
};
/*---------------------------------------------------------------------------*\
Class zero_one Declaration
\*---------------------------------------------------------------------------*/
//- Represents 0/1 concept, eg for tagged dispatch
class zero_one
{
public:
typedef zero_one value_type;
//- Default construct
constexpr zero_one() noexcept {}
//- Construct from Istream consumes no content.
explicit constexpr zero_one(Istream&) noexcept {}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Global zero (0)

View File

@ -49,7 +49,6 @@ Author
#include "tmp.H"
#include "autoPtr.H"
#include "dimensionedTypes.H"
#include "zero.H"
#include "className.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -110,7 +110,7 @@ public:
gradcf = stabilise(gradcf, SMALL);
scalar phict = 1 - 0.5*gradf/gradcf;
scalar limiter = clamp(phict/k_, 0, 1);
scalar limiter = clamp(phict/k_, zero_one{});
return lerp(udWeight, cdWeight, limiter);
}

View File

@ -52,10 +52,8 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class eddy;
class Istream;
class Ostream;
bool operator==(const eddy& a, const eddy& b);
bool operator!=(const eddy& a, const eddy& b);

View File

@ -40,7 +40,6 @@ SourceFiles
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "fvMatrix.H"
#include "zero.H"
#include "one.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -49,7 +49,6 @@ SourceFiles
#include "tmp.H"
#include "autoPtr.H"
#include "dimensionedTypes.H"
#include "zero.H"
#include "className.H"
#include "lduPrimitiveMeshAssembly.H"
#include "lduMesh.H"

View File

@ -49,7 +49,6 @@ SourceFiles
#include "surfaceFieldsFwd.H"
#include "primitiveFieldsFwd.H"
#include "geometricOneField.H"
#include "zero.H"
#include "zeroField.H"
#include "UPtrList.H"
#include "HashSet.H"

View File

@ -97,7 +97,7 @@ public:
faceFlux, phiP, phiN, gradcP, gradcN, d
);
return clamp(phict/k_, 0, 1);
return clamp(phict/k_, zero_one{});
}
};

View File

@ -81,7 +81,7 @@ public:
faceFlux, phiP, phiN, gradcP, gradcN, d
);
return clamp(r, 0, 1);
return clamp(r, zero_one{});
}
};

View File

@ -107,7 +107,7 @@ public:
((faceFlux - phiU)/stabilise(phiCD - phiU, SMALL) + k_);
// Limit the limiter between upwind and central
return clamp(PLimiter, 0, 1);
return clamp(PLimiter, zero_one{});
}
};

View File

@ -141,7 +141,7 @@ public:
}
// Limit the limiter between linear and upwind
return clamp(limiter, 0, 1);
return clamp(limiter, zero_one{});
}
};

View File

@ -143,7 +143,7 @@ public:
}
// Limit the limiter between linear and upwind
return clamp(limiter, 0, 1);
return clamp(limiter, zero_one{});
}
};

View File

@ -108,7 +108,7 @@ public:
scalar limiter = 1 - k_*(dN - df)*(dP - df)/max(sqr(dN + dP), SMALL);
// Limit the limiter between linear and upwind
return clamp(limiter, 0, 1);
return clamp(limiter, zero_one{});
}
};

View File

@ -110,7 +110,7 @@ public:
scalar limiter = 1 - k_*(dN - df)*(dP - df)/max(sqr(dN + dP), SMALL);
// Limit the limiter between linear and upwind
return clamp(limiter, 0, 1);
return clamp(limiter, zero_one{});
}
};

View File

@ -97,7 +97,7 @@ public:
faceFlux, phiP, phiN, gradcP, gradcN, d
);
return clamp(twoByk_*r, 0, 1);
return clamp(twoByk_*r, zero_one{});
}
};

View File

@ -36,7 +36,7 @@ Description
face-based Courant number and the lower and upper Courant number limits
supplied:
\f[
weight = 1 - clamp((Co - Co1)/(Co2 - Co1), 0, 1)
weight = 1 - clamp((Co - Co1)/(Co2 - Co1), zero_one{})
\f]
where
\vartable

View File

@ -49,16 +49,13 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
namespace functionObjects
{
// Forward Declarations
class eulerianParticle;
}
// Forward declaration of friend functions and operators
// Forward Declarations
Istream& operator>>(Istream&, functionObjects::eulerianParticle&);
Ostream& operator<<(Ostream&, const functionObjects::eulerianParticle&);

View File

@ -92,15 +92,13 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
// Forward Declarations
class objectRegistry;
namespace functionObjects
{
// Forward declaration of friend functions and operators
// Forward Declarations
class fieldAverageItem;
Istream& operator>>(Istream&, fieldAverageItem&);
Ostream& operator<<(Ostream&, const fieldAverageItem&);

View File

@ -670,7 +670,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
// Uniformity index
const scalar ui = 1 - numer/(2*mag(mean*areaTotal) + ROOTVSMALL);
return clamp(ui, 0, 1);
return clamp(ui, zero_one{});
}
default:
@ -756,7 +756,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
// Uniformity index
const scalar ui = 1 - numer/(2*mag(mean*areaTotal) + ROOTVSMALL);
return vector(clamp(ui, 0, 1), 0, 0);
return vector(clamp(ui, zero_one{}), 0, 0);
}
default:

View File

@ -152,7 +152,7 @@ Description
For option 6, the following relation is used:
\f[
fCoWeight = clamp((Co - Co1)/(Co2 - Co1), 0, 1)
fCoWeight = clamp((Co - Co1)/(Co2 - Co1), zero_one{});
\f]
where

View File

@ -147,7 +147,7 @@ void Foam::fv::solidificationMeltingSource::update(const volScalarField& Cp)
scalar Cpc = Cp[celli];
scalar alpha1New = alpha1_[celli] + relax_*Cpc*(Tc - Tmelt_)/L_;
alpha1_[celli] = clamp(alpha1New, 0, 1);
alpha1_[celli] = clamp(alpha1New, zero_one{});
deltaT_[i] = Tc - Tmelt_;
}

View File

@ -95,16 +95,13 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
namespace distributionModels
{
// Forward Declarations
class binned;
}
// Forward declaration of friend functions and operators
// Forward Declarations
Istream& operator>>(Istream&, distributionModels::binned&);
Ostream& operator<<(Ostream&, const distributionModels::binned&);

View File

@ -106,17 +106,13 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
namespace distributionModels
{
// Forward Declarations
class general;
}
// Forward declaration of friend functions and operators
// Forward Declarations
Istream& operator>>(Istream&, distributionModels::general&);
Ostream& operator<<(Ostream&, const distributionModels::general&);

View File

@ -84,7 +84,7 @@ Foam::forceSuSp Foam::DistortedSphereDragForce<CloudType>::calcCoupled
) const
{
// Limit the drop distortion to y=0 (sphere) and y=1 (disk)
const scalar y = clamp(p.y(), 0, 1);
const scalar y = clamp(p.y(), zero_one{});
// (LMR:Eq. 10)
return

View File

@ -361,7 +361,7 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi
}
}
return clamp(chi, 0, 1);
return clamp(chi, zero_one{});
}

View File

@ -257,7 +257,7 @@ void Foam::lumpedPointMovement::readDict(const dictionary& dict)
}
relax_ = dict.getOrDefault<scalar>("relax", 1);
relax_ = clamp(relax_, 0, 1);
relax_ = clamp(relax_, zero_one{});
forcesDict_.merge(dict.subOrEmptyDict("forces"));

View File

@ -77,10 +77,6 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
/*---------------------------------------------------------------------------*\
Class lumpedPointState Declaration
\*---------------------------------------------------------------------------*/

View File

@ -58,8 +58,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
class gradingDescriptor;
class gradingDescriptors;

View File

@ -48,7 +48,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class gradingDescriptors;
Istream& operator>>(Istream& is, gradingDescriptors& gd);

View File

@ -37,14 +37,14 @@ SourceFiles
#ifndef PointIntegrateData_H
#define PointIntegrateData_H
#include "UList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
template<class DataType> class PointIntegrateData;
template<class DataType>

View File

@ -38,11 +38,10 @@ SourceFiles
#ifndef patchEdgeFaceInfo_H
#define patchEdgeFaceInfo_H
#include "point.H"
#include "label.H"
#include "scalar.H"
#include "point.H"
#include "tensor.H"
#include "pTraits.H"
#include "primitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -48,8 +48,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
template<class DataType> class PointData;
template<class DataType>

View File

@ -41,11 +41,10 @@ SourceFiles
#ifndef Foam_pointEdgePoint_H
#define Foam_pointEdgePoint_H
#include "point.H"
#include "label.H"
#include "scalar.H"
#include "point.H"
#include "tensor.H"
#include "pTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef edgeMeshTools_H
#define edgeMeshTools_H
#ifndef Foam_edgeMeshTools_H
#define Foam_edgeMeshTools_H
#include "tmp.H"
#include "scalarField.H"
@ -46,12 +46,12 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class edgeMesh;
class extendedEdgeMesh;
class extendedFeatureEdgeMesh;
class triSurface;
class Time;
class Ostream;
/*---------------------------------------------------------------------------*\
Namespace edgeMeshTools Declaration

View File

@ -614,7 +614,7 @@ void Foam::MassTransferPhaseSystem<BasePhaseSystem>::alphaTransfer
scalar dmdt21 = dmdtNet[celli];
scalar coeffs12Cell = coeffs12[celli];
scalar alpha1Limited = clamp(alpha1[celli], 0, 1);
scalar alpha1Limited = clamp(alpha1[celli], zero_one{});
// exp.
SuPhase1[celli] += coeffs1[celli]*dmdt21;
@ -657,7 +657,7 @@ void Foam::MassTransferPhaseSystem<BasePhaseSystem>::alphaTransfer
scalar dmdt12 = -dmdtNet[celli];
scalar coeffs21Cell = -coeffs12[celli];
scalar alpha2Limited = clamp(alpha2[celli], 0, 1);
scalar alpha2Limited = clamp(alpha2[celli], zero_one{});
// exp
SuPhase2[celli] += coeffs2[celli]*dmdt12;

View File

@ -57,15 +57,10 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
namespace RBD
{
// Forward declaration of friend functions and operators
// Forward Declarations
class rigidBodyInertia;
Istream& operator>>(Istream&, rigidBodyInertia&);
Ostream& operator<<(Ostream&, const rigidBodyInertia&);

View File

@ -47,15 +47,10 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
namespace RBD
{
// Forward declaration of friend functions and operators
// Forward Declarations
class rigidBodyModelState;
Istream& operator>>(Istream&, rigidBodyModelState&);
Ostream& operator<<(Ostream&, const rigidBodyModelState&);

View File

@ -56,8 +56,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef isoSurfaceParams_H
#define isoSurfaceParams_H
#ifndef Foam_isoSurfaceParams_H
#define Foam_isoSurfaceParams_H
#include "boundBox.H"
#include "Enum.H"
@ -69,7 +69,6 @@ namespace Foam
// Forward Declarations
class dictionary;
class Ostream;
/*---------------------------------------------------------------------------*\
Class isoSurfaceSelector Declaration

View File

@ -233,7 +233,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
g_ = g.value();
}
// scalar ramp = clamp((t.value() - 5)/10, 0, 1);
// scalar ramp = clamp((t.value() - 5)/10, zero_one{});
scalar ramp = 1.0;
motion_.update

View File

@ -54,8 +54,6 @@ namespace Foam
{
// Forward Declarations
class Istream;
class Ostream;
class sixDoFRigidBodyMotionState;
Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);

View File

@ -76,8 +76,6 @@ namespace Foam
class Time;
class surfMesh;
class polyBoundaryMesh;
class Istream;
class Ostream;
template<class Face> class MeshedSurface;
template<class Face> class MeshedSurfaceProxy;

View File

@ -64,8 +64,6 @@ namespace Foam
// Forward Declarations
class Time;
class Istream;
class Ostream;
template<class Face> class MeshedSurface;
template<class Face> class MeshedSurfaceProxy;

Some files were not shown because too many files have changed in this diff Show More