patchFunction1Base.H
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) 2020-2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::patchFunction1Base
28 
29 Description
30  Top level data entry class for use in dictionaries. Provides a mechanism
31  to specify a variable as a certain type, e.g. constant or time varying, and
32  provide functions to return the (interpolated) value, and integral between
33  limits.
34 
35  Extends the Function1 class by adding autoMap and rMap functions
36 
37 SourceFiles
38  patchFunction1Base.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef patchFunction1Base_H
43 #define patchFunction1Base_H
44 
45 #include "dictionary.H"
46 #include "polyPatch.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class objectRegistry;
55 class Time;
56 
57 /*---------------------------------------------------------------------------*\
58  Class patchFunction1Base Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public refCount
64 {
65 protected:
66 
67  // Protected Data
68 
69  //- Name of entry
70  const word name_;
71 
72  //- Reference to the patch
73  const polyPatch& patch_;
74 
75  //- Generate face or point values on patch
76  const bool faceValues_;
77 
78 
79  // Protected Member Functions
80 
81  //- No copy assignment
82  void operator=(const patchFunction1Base&) = delete;
83 
84 
85 public:
86 
87  // Constructors
88 
89  //- Construct from polyPatch and entry name
91  (
92  const polyPatch& pp,
93  const word& entryName,
94  const bool faceValues = true
95  );
96 
97  //- Construct from polyPatch, dictionary and entry name
99  (
100  const polyPatch& pp,
101  const word& entryName,
102  const dictionary& dict,
103  const bool faceValues = true
104  );
105 
106  //- Copy construct
107  explicit patchFunction1Base(const patchFunction1Base& rhs);
108 
109  //- Copy construct setting patch
110  explicit patchFunction1Base
111  (
112  const patchFunction1Base& rhs,
113  const polyPatch& pp
114  );
115 
116 
117  //- Destructor
118  virtual ~patchFunction1Base() = default;
119 
120 
121  // Member Functions
122 
123  // Access
124 
125  //- The name of the entry
126  const word& name() const noexcept
127  {
128  return name_;
129  }
130 
131  //- Reference to the patch
132  const polyPatch& patch() const noexcept
133  {
134  return patch_;
135  }
136 
137  //- Generate face or point values on patch?
138  bool faceValues() const noexcept
139  {
140  return faceValues_;
141  }
142 
143  //- Number of faces or points on the patch
144  label size() const
145  {
146  return (faceValues_ ? patch_.size() : patch_.nPoints());
147  }
148 
149 
150  //- Return the associated registry (ie, the mesh)
151  const objectRegistry* whichDb() const;
152 
153  //- Return the object registry (ie, the mesh)
154  const objectRegistry& obr() const;
155 
156  //- Return false: function not created with time database
161 
162  //- Return the time database
163  const Time& time() const;
164 
165 
166  // Manipulation
167 
168  //- Convert time
169  virtual void userTimeToTime(const Time& t);
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Foam::patchFunction1Base::whichDb
const objectRegistry * whichDb() const
Return the associated registry (ie, the mesh)
Definition: patchFunction1Base.C:87
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::patchFunction1Base::patchFunction1Base
patchFunction1Base(const polyPatch &pp, const word &entryName, const bool faceValues=true)
Construct from polyPatch and entry name.
Definition: patchFunction1Base.C:38
polyPatch.H
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::patchFunction1Base::time
const Time & time() const
Return false: function not created with time database.
Definition: patchFunction1Base.C:99
Foam::patchFunction1Base::operator=
void operator=(const patchFunction1Base &)=delete
No copy assignment.
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::patchFunction1Base::size
label size() const
Number of faces or points on the patch.
Definition: patchFunction1Base.H:143
Foam::patchFunction1Base::patch
const polyPatch & patch() const noexcept
Reference to the patch.
Definition: patchFunction1Base.H:131
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::patchFunction1Base::~patchFunction1Base
virtual ~patchFunction1Base()=default
Destructor.
Foam::patchFunction1Base::userTimeToTime
virtual void userTimeToTime(const Time &t)
Convert time.
Definition: patchFunction1Base.C:105
Foam::patchFunction1Base::obr
const objectRegistry & obr() const
Return the object registry (ie, the mesh)
Definition: patchFunction1Base.C:93
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::PrimitivePatch::nPoints
label nPoints() const
Number of points supporting patch faces.
Definition: PrimitivePatch.H:316
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchFunction1Base::faceValues
bool faceValues() const noexcept
Generate face or point values on patch?
Definition: patchFunction1Base.H:137
Foam::patchFunction1Base::patch_
const polyPatch & patch_
Reference to the patch.
Definition: patchFunction1Base.H:72
Foam::patchFunction1Base::faceValues_
const bool faceValues_
Generate face or point values on patch.
Definition: patchFunction1Base.H:75
dictionary.H
Foam::patchFunction1Base
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: patchFunction1Base.H:60
Foam::patchFunction1Base::name
const word & name() const noexcept
The name of the entry.
Definition: patchFunction1Base.H:125
Foam::patchFunction1Base::name_
const word name_
Name of entry.
Definition: patchFunction1Base.H:69