mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add Function1::NewIfPresent without a redirect type
- simplifies handling, consistent with PatchFunction1 STYLE: use Function1 NewIfPresent instead of separate found/New
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -119,7 +119,11 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
typedef Type returnType;
|
||||
// Data Types
|
||||
|
||||
//- The return type
|
||||
typedef Type returnType;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Function1")
|
||||
@ -196,12 +200,20 @@ public:
|
||||
const bool mandatory = true
|
||||
);
|
||||
|
||||
//- An optional selector
|
||||
//- An optional selector, with fallback redirection
|
||||
static autoPtr<Function1<Type>> NewIfPresent
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const word& redirectType,
|
||||
const objectRegistry* obrPtr = nullptr
|
||||
);
|
||||
|
||||
//- An optional selector, without fallback redirection
|
||||
static autoPtr<Function1<Type>> NewIfPresent
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const word& redirectType = word::null,
|
||||
const objectRegistry* obrPtr = nullptr
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -225,6 +225,20 @@ Foam::Function1<Type>::NewIfPresent
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::autoPtr<Foam::Function1<Type>>
|
||||
Foam::Function1<Type>::NewIfPresent
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const objectRegistry* obrPtr
|
||||
)
|
||||
{
|
||||
// mandatory = false
|
||||
return Function1<Type>::New(entryName, dict, word::null, obrPtr, false);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::refPtr<Foam::Function1<Type>>
|
||||
Foam::Function1<Type>::New
|
||||
|
||||
Reference in New Issue
Block a user