mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: additional dictionary controls, methods
STYLE: declaration order of topoSet, resize_nocopy for sortedOrder STYLE: remove cstring dependency from SHA1 STYLE: use Ostream endEntry()
This commit is contained in:
@ -203,7 +203,8 @@ static inline scalar averageSurrounding
|
||||
template<class Type>
|
||||
static inline Ostream& putUniform(Ostream& os, const word& key, const Type& val)
|
||||
{
|
||||
os.writeKeyword(key) << word("uniform") << token::SPACE
|
||||
os.writeKeyword(key)
|
||||
<< word("uniform") << token::SPACE
|
||||
<< val << token::END_STATEMENT << nl;
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -327,7 +327,7 @@ Foam::labelList Foam::sortedOrder
|
||||
const UList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
sortedOrder(input, order, typename UList<T>::less(input));
|
||||
return order;
|
||||
}
|
||||
@ -352,15 +352,8 @@ void Foam::sortedOrder
|
||||
const ListComparePredicate& comp
|
||||
)
|
||||
{
|
||||
const label len = input.size();
|
||||
|
||||
// List lengths must be identical
|
||||
if (order.size() != len)
|
||||
{
|
||||
// Avoid copying elements, they are overwritten anyhow
|
||||
order.clear();
|
||||
order.resize(len);
|
||||
}
|
||||
// List lengths must be identical. Old content is overwritten
|
||||
order.resize_nocopy(input.size());
|
||||
|
||||
ListOps::identity(order);
|
||||
|
||||
@ -374,7 +367,7 @@ Foam::labelList Foam::duplicateOrder
|
||||
const UList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
duplicateOrder(input, order, typename UList<T>::less(input));
|
||||
return order;
|
||||
}
|
||||
@ -427,7 +420,7 @@ Foam::labelList Foam::uniqueOrder
|
||||
const UList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
uniqueOrder(input, order, typename UList<T>::less(input));
|
||||
return order;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::labelList Foam::sortedOrder
|
||||
const UPtrList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
sortedOrder(input, order, typename PtrListOps::less<T>(input));
|
||||
return order;
|
||||
}
|
||||
@ -60,15 +60,8 @@ void Foam::sortedOrder
|
||||
const ListComparePredicate& comp
|
||||
)
|
||||
{
|
||||
const label len = input.size();
|
||||
|
||||
// List lengths must be identical
|
||||
if (order.size() != len)
|
||||
{
|
||||
// Avoid copying elements, they are overwritten anyhow
|
||||
order.clear();
|
||||
order.resize(len);
|
||||
}
|
||||
// List lengths must be identical. Old content is overwritten
|
||||
order.resize_nocopy(input.size());
|
||||
|
||||
ListOps::identity(order);
|
||||
|
||||
@ -79,7 +72,7 @@ void Foam::sortedOrder
|
||||
template<class T>
|
||||
void Foam::sort(UPtrList<T>& list)
|
||||
{
|
||||
labelList order(list.size());
|
||||
labelList order;
|
||||
sortedOrder(list, order);
|
||||
list.sortOrder(order, false); // false = allow nullptr
|
||||
}
|
||||
@ -88,7 +81,7 @@ void Foam::sort(UPtrList<T>& list)
|
||||
template<class T, class Compare>
|
||||
void Foam::sort(UPtrList<T>& list, const Compare& comp)
|
||||
{
|
||||
labelList order(list.size());
|
||||
labelList order;
|
||||
sortedOrder(list, order, comp);
|
||||
list.sortOrder(order, false); // false = allow nullptr
|
||||
}
|
||||
|
||||
@ -351,46 +351,6 @@ void Foam::dictionary::raiseBadInput
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::found
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).good();
|
||||
}
|
||||
|
||||
|
||||
Foam::entry* Foam::dictionary::findEntry
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
)
|
||||
{
|
||||
return search(keyword, matchOpt).ptr();
|
||||
}
|
||||
|
||||
|
||||
const Foam::entry* Foam::dictionary::findEntry
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).ptr();
|
||||
}
|
||||
|
||||
|
||||
const Foam::entry* Foam::dictionary::findScoped
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearchScoped(keyword, matchOpt).ptr();
|
||||
}
|
||||
|
||||
|
||||
const Foam::entry& Foam::dictionary::lookupEntry
|
||||
(
|
||||
const word& keyword,
|
||||
@ -485,36 +445,6 @@ bool Foam::dictionary::substituteScopedKeyword
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::isDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).isDict();
|
||||
}
|
||||
|
||||
|
||||
Foam::dictionary* Foam::dictionary::findDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
)
|
||||
{
|
||||
return search(keyword, matchOpt).dictPtr();
|
||||
}
|
||||
|
||||
|
||||
const Foam::dictionary* Foam::dictionary::findDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).dictPtr();
|
||||
}
|
||||
|
||||
|
||||
const Foam::dictionary& Foam::dictionary::subDict
|
||||
(
|
||||
const word& keyword,
|
||||
@ -1019,9 +949,9 @@ Foam::dictionary Foam::operator+
|
||||
const dictionary& dict2
|
||||
)
|
||||
{
|
||||
dictionary sum(dict1);
|
||||
sum += dict2;
|
||||
return sum;
|
||||
dictionary result(dict1);
|
||||
result += dict2;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1031,9 +961,9 @@ Foam::dictionary Foam::operator|
|
||||
const dictionary& dict2
|
||||
)
|
||||
{
|
||||
dictionary sum(dict1);
|
||||
sum |= dict2;
|
||||
return sum;
|
||||
dictionary result(dict1);
|
||||
result |= dict2;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ private:
|
||||
//
|
||||
// \param recursive search parent dictionaries
|
||||
// \param pattern match using regular expressions as well
|
||||
static inline enum keyType::option
|
||||
inline static enum keyType::option
|
||||
matchOpt(bool recursive, bool pattern)
|
||||
{
|
||||
return
|
||||
@ -360,13 +360,14 @@ private:
|
||||
//- Emit IOError about bad input for the entry
|
||||
void raiseBadInput(const ITstream& is, const word& keyword) const;
|
||||
|
||||
//- Report (on stderr) that the keyword default value was used
|
||||
//- Report (stderr) that the keyword default value was used.
|
||||
//- or FatalIOError when writeOptionalEntries greater than 1
|
||||
template<class T>
|
||||
void reportDefault
|
||||
(
|
||||
const word& keyword,
|
||||
const T& deflt,
|
||||
const bool added = false
|
||||
const bool added = false // Value was added to the dictionary
|
||||
) const;
|
||||
|
||||
|
||||
@ -375,13 +376,27 @@ public:
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("dictionary");
|
||||
|
||||
//- Report optional keywords and values if not present in dictionary
|
||||
// For value greater than 1: fatal.
|
||||
// Set/unset via an InfoSwitch or -info-switch at the command-line
|
||||
static int writeOptionalEntries;
|
||||
// Static Data
|
||||
|
||||
//- An empty dictionary, which is also the parent for all dictionaries
|
||||
static const dictionary null;
|
||||
//- Report optional keywords and values if not present in dictionary
|
||||
// For value greater than 1: fatal.
|
||||
// Set/unset via an InfoSwitch or -info-switch at the command-line
|
||||
static int writeOptionalEntries;
|
||||
|
||||
//- An empty dictionary, which is also the parent for all dictionaries
|
||||
static const dictionary null;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return the state of reporting optional (default) entries
|
||||
// 0: no reporting, 1: report, 2: fatal if not set
|
||||
inline static int reportOptional() noexcept;
|
||||
|
||||
//- Change the state of reporting optional (default) entries
|
||||
// 0: no reporting, 1: report, 2: fatal if not set
|
||||
// \return old level
|
||||
inline static int reportOptional(const int level) noexcept;
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -443,30 +458,13 @@ public:
|
||||
// Access
|
||||
|
||||
//- The dictionary name
|
||||
const fileName& name() const noexcept
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
inline const fileName& name() const noexcept;
|
||||
|
||||
//- The dictionary name for modification (use with caution).
|
||||
fileName& name() noexcept
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
inline fileName& name() noexcept;
|
||||
|
||||
//- The local dictionary name (final part of scoped name)
|
||||
word dictName() const
|
||||
{
|
||||
word scopedName(name_.name());
|
||||
|
||||
const auto i = scopedName.rfind('.');
|
||||
if (i == std::string::npos)
|
||||
{
|
||||
return scopedName;
|
||||
}
|
||||
|
||||
return scopedName.substr(i+1);
|
||||
}
|
||||
inline word dictName() const;
|
||||
|
||||
//- The dictionary name relative to the case.
|
||||
// Uses argList::envRelativePath to obtain FOAM_CASE
|
||||
@ -476,11 +474,11 @@ public:
|
||||
// not an absolute location
|
||||
fileName relativeName(const bool caseTag = false) const;
|
||||
|
||||
//- The dictionary is actually dictionary::null (root dictionary)
|
||||
inline bool isNullDict() const noexcept;
|
||||
|
||||
//- Return the parent dictionary
|
||||
const dictionary& parent() const noexcept
|
||||
{
|
||||
return parent_;
|
||||
}
|
||||
inline const dictionary& parent() const noexcept;
|
||||
|
||||
//- Return the top of the tree
|
||||
const dictionary& topDict() const;
|
||||
@ -505,7 +503,7 @@ public:
|
||||
// \param matchOpt the default search is non-recursive with patterns
|
||||
//
|
||||
// \return True if entry was found
|
||||
bool found
|
||||
inline bool found
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -516,7 +514,7 @@ public:
|
||||
// \param matchOpt the search mode
|
||||
//
|
||||
// \return the entry pointer found or a nullptr.
|
||||
entry* findEntry
|
||||
inline entry* findEntry
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -527,7 +525,7 @@ public:
|
||||
// \param matchOpt the default search is non-recursive with patterns
|
||||
//
|
||||
// \return the entry pointer found or a nullptr.
|
||||
const entry* findEntry
|
||||
inline const entry* findEntry
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -541,7 +539,7 @@ public:
|
||||
// \param matchOpt the default search is non-recursive with patterns
|
||||
//
|
||||
// \return the entry pointer found or a nullptr.
|
||||
const entry* findScoped
|
||||
inline const entry* findScoped
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -551,7 +549,7 @@ public:
|
||||
// (and a sub-dictionary) otherwise return nullptr.
|
||||
//
|
||||
// \param matchOpt the default search is non-recursive with patterns
|
||||
dictionary* findDict
|
||||
inline dictionary* findDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -561,7 +559,7 @@ public:
|
||||
// (and a sub-dictionary) otherwise return nullptr.
|
||||
//
|
||||
// \param matchOpt the default search is non-recursive with patterns
|
||||
const dictionary* findDict
|
||||
inline const dictionary* findDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -743,7 +741,7 @@ public:
|
||||
// \param matchOpt the default search is non-recursive with patterns
|
||||
//
|
||||
// \return true if the entry was found.
|
||||
bool isDict
|
||||
inline bool isDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt = keyType::REGEX
|
||||
@ -1531,6 +1529,10 @@ dictionary operator|(const dictionary& dict1, const dictionary& dict2);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "dictionaryI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "dictionaryTemplates.C"
|
||||
#endif
|
||||
|
||||
156
src/OpenFOAM/db/dictionary/dictionaryI.H
Normal file
156
src/OpenFOAM/db/dictionary/dictionaryI.H
Normal file
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 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 "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
inline int Foam::dictionary::reportOptional() noexcept
|
||||
{
|
||||
return writeOptionalEntries;
|
||||
}
|
||||
|
||||
|
||||
inline int Foam::dictionary::reportOptional(const int level) noexcept
|
||||
{
|
||||
int old(writeOptionalEntries);
|
||||
writeOptionalEntries = level;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::fileName& Foam::dictionary::name() const noexcept
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName& Foam::dictionary::name() noexcept
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::word Foam::dictionary::dictName() const
|
||||
{
|
||||
word scopedName(name_.name());
|
||||
|
||||
const auto i = scopedName.rfind('.');
|
||||
if (i == std::string::npos)
|
||||
{
|
||||
return scopedName;
|
||||
}
|
||||
|
||||
return scopedName.substr(i+1);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::dictionary::isNullDict() const noexcept
|
||||
{
|
||||
return (this == &dictionary::null);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary& Foam::dictionary::parent() const noexcept
|
||||
{
|
||||
return parent_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::dictionary::found
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).good();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::entry* Foam::dictionary::findEntry
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
)
|
||||
{
|
||||
return search(keyword, matchOpt).ptr();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::entry* Foam::dictionary::findEntry
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).ptr();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::entry* Foam::dictionary::findScoped
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearchScoped(keyword, matchOpt).ptr();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::dictionary* Foam::dictionary::findDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
)
|
||||
{
|
||||
return search(keyword, matchOpt).dictPtr();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary* Foam::dictionary::findDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).dictPtr();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::dictionary::isDict
|
||||
(
|
||||
const word& keyword,
|
||||
enum keyType::option matchOpt
|
||||
) const
|
||||
{
|
||||
return csearch(keyword, matchOpt).isDict();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -39,6 +39,14 @@ void Foam::dictionary::reportDefault
|
||||
const bool added
|
||||
) const
|
||||
{
|
||||
if (writeOptionalEntries > 1)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "No optional entry: " << keyword
|
||||
<< " Default: " << deflt << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
InfoErr
|
||||
<< "Dictionary: " << this->relativeName().c_str()
|
||||
<< " Entry: " << keyword;
|
||||
@ -140,17 +148,7 @@ T Foam::dictionary::getOrDefault
|
||||
}
|
||||
else if (writeOptionalEntries)
|
||||
{
|
||||
if (writeOptionalEntries > 1)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "No optional entry: " << keyword
|
||||
<< " Default: " << deflt << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportDefault(keyword, deflt);
|
||||
}
|
||||
reportDefault(keyword, deflt);
|
||||
}
|
||||
|
||||
return deflt;
|
||||
@ -180,17 +178,7 @@ T Foam::dictionary::getOrAdd
|
||||
}
|
||||
else if (writeOptionalEntries)
|
||||
{
|
||||
if (writeOptionalEntries > 1)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "No optional entry: " << keyword
|
||||
<< " Default: " << deflt << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportDefault(keyword, deflt, true);
|
||||
}
|
||||
reportDefault(keyword, deflt, true); // Added
|
||||
}
|
||||
|
||||
add(new primitiveEntry(keyword, deflt));
|
||||
@ -236,17 +224,7 @@ T Foam::dictionary::getCheckOrDefault
|
||||
}
|
||||
else if (writeOptionalEntries)
|
||||
{
|
||||
if (writeOptionalEntries > 1)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "No optional entry: " << keyword
|
||||
<< " Default: " << deflt << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportDefault(keyword, deflt);
|
||||
}
|
||||
reportDefault(keyword, deflt);
|
||||
}
|
||||
|
||||
return deflt;
|
||||
@ -291,17 +269,7 @@ T Foam::dictionary::getCheckOrAdd
|
||||
}
|
||||
else if (writeOptionalEntries)
|
||||
{
|
||||
if (writeOptionalEntries > 1)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "No optional entry: " << keyword
|
||||
<< " Default: " << deflt << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportDefault(keyword, deflt, true);
|
||||
}
|
||||
reportDefault(keyword, deflt, true); // Added
|
||||
}
|
||||
|
||||
add(new primitiveEntry(keyword, deflt));
|
||||
@ -463,17 +431,7 @@ T Foam::dictionary::getOrDefaultCompat
|
||||
}
|
||||
else if (writeOptionalEntries)
|
||||
{
|
||||
if (writeOptionalEntries > 1)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "No optional entry: " << keyword
|
||||
<< " Default: " << deflt << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportDefault(keyword, deflt);
|
||||
}
|
||||
reportDefault(keyword, deflt);
|
||||
}
|
||||
|
||||
return deflt;
|
||||
|
||||
@ -130,7 +130,7 @@ Foam::Ostream& Foam::expressions::exprDriver::writeVariableStrings
|
||||
|
||||
if (keyword.size())
|
||||
{
|
||||
os << token::END_STATEMENT << nl;
|
||||
os.endEntry();
|
||||
}
|
||||
|
||||
return os;
|
||||
|
||||
@ -76,7 +76,7 @@ template<class Type>
|
||||
void Foam::Function1Types::LimitRange<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
Function1<Type>::writeData(os);
|
||||
os << token::END_STATEMENT << nl;
|
||||
os.endEntry();
|
||||
|
||||
os.beginBlock(word(this->name() + "Coeffs"));
|
||||
writeEntries(os);
|
||||
|
||||
@ -74,8 +74,7 @@ template<class Type>
|
||||
void Foam::Function1Types::OneConstant<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
Function1<Type>::writeData(os);
|
||||
|
||||
os << token::END_STATEMENT << nl;
|
||||
os.endEntry();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ template<class Type>
|
||||
void Foam::Function1Types::Scale<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
Function1<Type>::writeData(os);
|
||||
os << token::END_STATEMENT << nl;
|
||||
os.endEntry();
|
||||
|
||||
os.beginBlock(word(this->name() + "Coeffs"));
|
||||
writeEntries(os);
|
||||
|
||||
@ -54,8 +54,7 @@ template<class Type>
|
||||
void Foam::Function1Types::ZeroConstant<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
Function1<Type>::writeData(os);
|
||||
|
||||
os << token::END_STATEMENT << nl;
|
||||
os.endEntry();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ void Foam::Function1Types::ramp::convertTimeBase(const Time& t)
|
||||
void Foam::Function1Types::ramp::writeData(Ostream& os) const
|
||||
{
|
||||
Function1<scalar>::writeData(os);
|
||||
os << token::END_STATEMENT << nl;
|
||||
os.endEntry();
|
||||
|
||||
os.beginBlock(word(this->name() + "Coeffs"));
|
||||
writeEntries(os);
|
||||
|
||||
@ -312,7 +312,7 @@ void Foam::SHA1::calcDigest(SHA1Digest& dig) const
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::SHA1::clear()
|
||||
void Foam::SHA1::clear() noexcept
|
||||
{
|
||||
hashsumA_ = 0x67452301;
|
||||
hashsumB_ = 0xefcdab89;
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Reset the hashed data before appending more
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
//- Append data for processing
|
||||
inline SHA1& append(const char* str);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,7 +27,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SHA1.H"
|
||||
#include <cstring>
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -64,7 +63,7 @@ inline Foam::SHA1& Foam::SHA1::append(const char* str)
|
||||
{
|
||||
if (str && *str)
|
||||
{
|
||||
processBytes(str, strlen(str));
|
||||
processBytes(str, std::char_traits<char>::length(str));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -72,7 +71,7 @@ inline Foam::SHA1& Foam::SHA1::append(const char* str)
|
||||
|
||||
inline Foam::SHA1& Foam::SHA1::append(const std::string& str)
|
||||
{
|
||||
processBytes(str.data(), str.size());
|
||||
processBytes(str.data(), str.length());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -552,7 +552,7 @@ Foam::PDRblock::PDRblock(const dictionary& dict, bool verboseOutput)
|
||||
edgeLimits_(0,0),
|
||||
verbose_(verboseOutput)
|
||||
{
|
||||
if (&dict != &dictionary::null)
|
||||
if (!dict.isNullDict())
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -101,9 +101,8 @@ void Foam::PatchFunction1Types::UniformValueField<Type>::writeData
|
||||
) const
|
||||
{
|
||||
PatchFunction1<Type>::writeData(os);
|
||||
//os << token::END_STATEMENT << nl;
|
||||
|
||||
uniformValuePtr_->writeData(os);
|
||||
//os << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -75,16 +75,16 @@ public:
|
||||
enum sourceType
|
||||
{
|
||||
UNKNOWN_SOURCE = 0, //!< Placeholder
|
||||
SET_SOURCE = 0x10, //!< Source based on topoSet
|
||||
ZONE_SOURCE = 0x20, //!< Source based on mesh zone
|
||||
CELL_TYPE = 0x1, //!< Geometric type is "cell"
|
||||
FACE_TYPE = 0x2, //!< Geometric type is "face"
|
||||
POINT_TYPE = 0x4, //!< Geometric type is "point"
|
||||
|
||||
SET_SOURCE = 0x10, //!< A source based on topoSet
|
||||
CELLSET_SOURCE = (CELL_TYPE | SET_SOURCE), //!< Cells as set
|
||||
FACESET_SOURCE = (FACE_TYPE | SET_SOURCE), //!< Faces as set
|
||||
POINTSET_SOURCE = (POINT_TYPE | SET_SOURCE), //!< Points as set
|
||||
|
||||
ZONE_SOURCE = 0x20, //!< A source based on mesh zone
|
||||
CELLZONE_SOURCE = (CELL_TYPE | ZONE_SOURCE), //!< Cells as zone
|
||||
FACEZONE_SOURCE = (FACE_TYPE | ZONE_SOURCE), //!< Faces as zone
|
||||
POINTZONE_SOURCE = (POINT_TYPE | ZONE_SOURCE), //!< Points as zone
|
||||
@ -100,14 +100,18 @@ public:
|
||||
//- Enumeration defining the valid actions
|
||||
enum setAction
|
||||
{
|
||||
ADD, //!< Add elements to the set
|
||||
SUBTRACT, //!< Subtract elements from the set
|
||||
SUBSET, //!< Subset with elements in the set
|
||||
INVERT, //!< Invert the elements in the set
|
||||
CLEAR, //!< Clear the set, possibly creating it
|
||||
// Fundamental actions
|
||||
ADD, //!< Add elements to current set
|
||||
NEW, //!< Create a new set and ADD elements to it
|
||||
SUBTRACT, //!< Subtract elements from current set
|
||||
|
||||
// Derived/intrinsic actions
|
||||
SUBSET, //!< Union of elements with current set
|
||||
INVERT, //!< Invert the elements in the current set
|
||||
CLEAR, //!< Clear the set, possibly creating it
|
||||
REMOVE, //!< Remove the set (from the file system)
|
||||
LIST, //!< Print contents of the set
|
||||
|
||||
DELETE = SUBTRACT, //!< \deprecated(2018-10) Alias for SUBTRACT
|
||||
};
|
||||
|
||||
@ -201,31 +205,31 @@ public:
|
||||
static Istream& checkIs(Istream& is);
|
||||
|
||||
//- True if a "set" source
|
||||
static inline bool isSetSource(const sourceType t)
|
||||
static inline bool isSetSource(const sourceType t) noexcept
|
||||
{
|
||||
return (t & SET_SOURCE);
|
||||
}
|
||||
|
||||
//- True if a "zone" source
|
||||
static inline bool isZoneSource(const sourceType t)
|
||||
static inline bool isZoneSource(const sourceType t) noexcept
|
||||
{
|
||||
return (t & ZONE_SOURCE);
|
||||
}
|
||||
|
||||
//- True if "cell" geometric type
|
||||
static inline bool isCell(const sourceType t)
|
||||
static inline bool isCell(const sourceType t) noexcept
|
||||
{
|
||||
return (t & CELL_TYPE);
|
||||
}
|
||||
|
||||
//- True if "face" geometric type
|
||||
static inline bool isFace(const sourceType t)
|
||||
static inline bool isFace(const sourceType t) noexcept
|
||||
{
|
||||
return (t & FACE_TYPE);
|
||||
}
|
||||
|
||||
//- True if "point" geometric type
|
||||
static inline bool isPoint(const sourceType t)
|
||||
static inline bool isPoint(const sourceType t) noexcept
|
||||
{
|
||||
return (t & POINT_TYPE);
|
||||
}
|
||||
@ -362,7 +366,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The source category (set/zone, cell/face/point)
|
||||
//- The source category (cell/face/point combined with set/zone)
|
||||
virtual sourceType setType() const = 0;
|
||||
|
||||
//- Apply specified action to the topoSet
|
||||
|
||||
Reference in New Issue
Block a user