None.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "None.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 (
33  const word& name,
34  const dictionary& dict
35 )
36 :
37  FieldFunction1<Type, None<Type>>(name),
38  dictName_(dict.name())
39 {}
40 
41 
42 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
43 
44 template<class Type>
46 {}
47 
48 
49 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
50 
51 template<class Type>
52 Type Foam::Function1s::None<Type>::value(const scalar) const
53 {
55  << "Required function " << this->name() << " in " << nl
56  << " " << dictName_ << nl
57  << " is not defined."
58  << exit(FatalError);
59 
60  return pTraits<Type>::zero;
61 }
62 
63 
64 template<class Type>
65 Type Foam::Function1s::None<Type>::integral(const scalar, const scalar) const
66 {
68  << "Required function " << this->name() << " in " << nl
69  << " " << dictName_ << nl
70  << " is not defined."
71  << exit(FatalError);
72 
73  return pTraits<Type>::zero;
74 }
75 
76 
77 template<class Type>
79 {}
80 
81 
82 // ************************************************************************* //
Undefined Function1 which returns an error when called.
Definition: None.H:51
virtual ~None()
Destructor.
Definition: None.C:45
virtual Type integral(const scalar x1, const scalar x2) const
Generates an error.
Definition: None.C:65
virtual void write(Ostream &os) const
Write in dictionary format.
Definition: None.C:78
None(const word &name, const dictionary &dict)
Construct from name and dictionary.
Definition: None.C:32
virtual Type value(const scalar x) const
Generates an error.
Definition: None.C:52
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Traits class for primitives.
Definition: pTraits.H:53
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const char nl
Definition: Ostream.H:260
dictionary dict