objectFunction1.H
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-2021 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 Class
25  Foam::objectFunction1
26 
27 Description
28  Wrapper around Function1 that constructs a function of type associated with
29  an object found in the database.
30 
31 SourceFiles
32  objectFunction1Templates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef objectFunction1_H
37 #define objectFunction1_H
38 
39 #include "Function1.H"
40 #include "objectRegistry.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class objectFunction1 Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class objectFunction1
52 :
53  private autoPtr<Function1<scalar>>,
54  private autoPtr<Function1<vector>>,
55  private autoPtr<Function1<symmTensor>>,
56  private autoPtr<Function1<sphericalTensor>>,
57  private autoPtr<Function1<tensor>>
58 {
59  // Private Classes
60 
61  //- Tag structure used to deduce type in the templated constructor
62  template<class PrimitiveType>
63  struct type
64  {};
65 
66 
67  // Private Constructors
68 
69  //- Construct from an name and a dictionary
70  template<class PrimitiveType>
72  (
73  const word& name,
74  const dictionary& dict,
75  const type<PrimitiveType>&
76  );
77 
78 
79 public:
80 
81  // Selector
82 
83  template<template<class> class ObjectType>
85  (
86  const word& name,
87  const dictionary& dict,
88  const word& objectName,
89  const objectRegistry& db,
90  const bool error = true
91  );
92 
93 
94  //- Destructor
96  {}
97 
98 
99  // Member Functions
100 
101  //- Return value as a function of scalar x
102  template<class PrimitiveType>
103  PrimitiveType value(const scalar x) const;
104 
105  //- Return value as a function of scalarField x
106  template<class PrimitiveType>
107  tmp<Field<PrimitiveType>> value(const scalarField& x) const;
108 
109  //- Integrate between two scalars
110  template<class PrimitiveType>
111  PrimitiveType integral(const scalar x1, const scalar x2) const;
112 
113  //- Integrate between two scalar fields
114  template<class PrimitiveType>
116  (
117  const scalarField& x1,
118  const scalarField& x2
119  ) const;
120 
121 
122  // Member Operators
123 
124  //- Disallow default bitwise assignment
125  void operator=(const objectFunction1&) = delete;
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #ifdef NoRepository
136  #include "objectFunction1Templates.C"
137 #endif
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
dictionary dict
Wrapper around Function1 that constructs a function of type associated with an object found in the da...
PrimitiveType value(const scalar x) const
Return value as a function of scalar x.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
void operator=(const objectFunction1 &)=delete
Disallow default bitwise assignment.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
Definition: error.H:66
A class for handling words, derived from string.
Definition: word.H:59
~objectFunction1()
Destructor.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static autoPtr< objectFunction1 > New(const word &name, const dictionary &dict, const word &objectName, const objectRegistry &db, const bool error=true)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
PrimitiveType integral(const scalar x1, const scalar x2) const
Integrate between two scalars.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
Namespace for OpenFOAM.