mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: adjust fileName methods for similarity to std::filesystem::path
- stem(), replace_name(), replace_ext(), remove_ext() etc
- string::contains() method - similar to C++23 method
Eg,
if (keyword.contains('/')) ...
vs
if (keyword.find('/') != std::string::npos) ...
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,14 +43,16 @@ namespace functionObjects
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::checkFormatName
|
||||
(
|
||||
const std::string& str
|
||||
)
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
if (std::string::npos == str.find("@@"))
|
||||
|
||||
// Check that string contains the appropriate substitution token(s)
|
||||
static bool checkFormatName(const word& str)
|
||||
{
|
||||
if (!str.contains("@@"))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Bad result naming (no '@@' token found)."
|
||||
@ -70,6 +72,10 @@ bool Foam::functionObjects::zeroGradient::checkFormatName
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
int Foam::functionObjects::zeroGradient::process(const word& fieldName)
|
||||
{
|
||||
@ -95,7 +101,7 @@ Foam::functionObjects::zeroGradient::zeroGradient
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
selectFields_(),
|
||||
resultName_(string::null),
|
||||
resultName_(),
|
||||
results_()
|
||||
{
|
||||
read(dict);
|
||||
|
||||
@ -137,10 +137,6 @@ class zeroGradient
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check that string contains the appropriate substitution token(s)
|
||||
static bool checkFormatName(const std::string& str);
|
||||
|
||||
|
||||
//- Accept unless field only has constraint patches
|
||||
// (ie, empty/zero-gradient/processor)
|
||||
// This should also avoid fields that were already processed by
|
||||
|
||||
Reference in New Issue
Block a user