stepUpdate.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2007-2019 PCOpt/NTUA
9 Copyright (C) 2013-2019 FOSS GP
10 Copyright (C) 2019-2021 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28\*---------------------------------------------------------------------------*/
29
30#include "stepUpdate.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
38}
39
40
41// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
42
44{
45 return dict_.optionalSubDict(type() + "Coeffs");
46}
47
48
49// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50
52:
53 dict_(dict)
54{}
55
56
57// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * //
58
60{
61 const word type =
62 dict.getOrDefault<word>("stepUpdateType", "bisection");
63
64 Info<< "stepUpdate type : " << type << endl;
65
66 auto* ctorPtr = dictionaryConstructorTable(type);
67
68 if (!ctorPtr)
69 {
71 (
72 dict,
73 "stepUpdate",
74 type,
75 *dictionaryConstructorTablePtr_
76 ) << exit(FatalIOError);
77 }
78
79 return autoPtr<stepUpdate>(ctorPtr(dict));
80}
81
82
83// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * //
84
85void Foam::stepUpdate::setDeriv(const scalar deriv)
86{
87 // Does nothing in base
88}
89
90
91void Foam::stepUpdate::setNewMeritValue(const scalar value)
92{
93 // Does nothing in base
94}
95
96
97void Foam::stepUpdate::setOldMeritValue(const scalar value)
98{
99 // Does nothing in base
100}
101
102
103// ************************************************************************* //
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
Definition: dictionary.C:577
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Abstract base class for step update methods used in line search.
Definition: stepUpdate.H:55
const dictionary & coeffsDict()
Optional coeffs dict.
Definition: stepUpdate.C:43
virtual void setDeriv(const scalar deriv)
Set objective derivative.
Definition: stepUpdate.C:85
virtual void setOldMeritValue(const scalar value)
Set old merit value.
Definition: stepUpdate.C:97
virtual void setNewMeritValue(const scalar value)
Set new merit value.
Definition: stepUpdate.C:91
const dictionary dict_
Definition: stepUpdate.H:60
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
IOerror FatalIOError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict