genericPatchFieldBase.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) 2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::genericPatchFieldBase
28
29Description
30 Generic infrastructure for reading/writing unknown patch types.
31
32SourceFiles
33 genericPatchFieldBase.C
34 genericPatchFieldBaseTemplates.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef genericPatchFieldBase_H
39#define genericPatchFieldBase_H
40
41#include "dictionary.H"
42#include "primitiveFields.H"
43#include "HashPtrTable.H"
44#include "IOobject.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class genericPatchFieldBase Declaration
53\*---------------------------------------------------------------------------*/
56{
57 // Private Member Functions
58
59 bool checkFieldSize
60 (
61 const label fieldSize,
62 const label patchSize,
63 const word& patchName,
64 const keyType& key,
65 const IOobject& io
66 ) const;
67
68
69protected:
70
71 // Protected Data
72
73 //- The non-generic patch name
83
84
85 // Protected Member Functions
86
87 //- Add error message to FatalError about solving with
88 //- generic condition
90 (
91 const word& patchName,
92 const IOobject& io
93 ) const;
94
95 //- FatalError for missing entry
97 (
98 const word& entryName,
99 const word& patchName,
100 const IOobject& io
101 ) const;
102
103 void processGeneric
104 (
105 const label patchSize,
106 const word& patchName,
107 const IOobject& io,
108 const bool separateValue
109 );
110
111 bool processEntry
112 (
113 const entry& dEntry,
114 const label patchSize,
115 const word& patchName,
116 const IOobject& io
117 );
118
119 //- Write a single entry, with lookup of hashed values
120 void putEntry(const entry& e, Ostream& os) const;
121
122 //- Write all generic entries from dictionary,
123 //- optionally treating the "value" entry separately
124 void writeGeneric(Ostream& os, const bool separateValue) const;
125
126 //- Implementation for construct with mapper
127 template<class MapperType>
128 void mapGeneric
129 (
130 const genericPatchFieldBase& rhs,
131 const MapperType& mapper
132 );
133
134 //- Implementation for autoMap of self given a mapping object
135 template<class MapperType>
136 void autoMapGeneric(const MapperType& mapper);
137
138 //- Implementation for reverse map given patch field onto this
139 //- patch field
140 void rmapGeneric
141 (
142 const genericPatchFieldBase& rhs,
143 const labelList& addr
144 );
145
146
147 // Constructors
148
149 //- Partial copy construct. Only copy type and dictionary
151
152
153public:
154
155 // Constructors
156
157 //- Default construct, generally not useful.
158 genericPatchFieldBase() = default;
159
160 //- Copy construct
162
163 //- Move construct
165
166 //- Initialize from dictionary
167 explicit genericPatchFieldBase(const dictionary& dict);
168
169
170 // Member Functions
171
172 //- The actual patch type
173 const word& actualType() const noexcept
174 {
175 return actualTypeName_;
176 }
177};
178
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182} // End namespace Foam
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186#ifdef NoRepository
188#endif
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191
192#endif
193
194// ************************************************************************* //
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Definition: HashPtrTable.H:68
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:70
Generic infrastructure for reading/writing unknown patch types.
void writeGeneric(Ostream &os, const bool separateValue) const
genericPatchFieldBase()=default
Default construct, generally not useful.
void rmapGeneric(const genericPatchFieldBase &rhs, const labelList &addr)
HashPtrTable< vectorField > vectorFields_
void reportMissingEntry(const word &entryName, const word &patchName, const IOobject &io) const
FatalError for missing entry.
genericPatchFieldBase(genericPatchFieldBase &&)=default
Move construct.
void putEntry(const entry &e, Ostream &os) const
Write a single entry, with lookup of hashed values.
void autoMapGeneric(const MapperType &mapper)
Implementation for autoMap of self given a mapping object.
word actualTypeName_
The non-generic patch name.
HashPtrTable< symmTensorField > symmTensorFields_
genericPatchFieldBase(const genericPatchFieldBase &)=default
Copy construct.
HashPtrTable< sphericalTensorField > sphTensorFields_
void genericFatalSolveError(const word &patchName, const IOobject &io) const
HashPtrTable< tensorField > tensorFields_
const word & actualType() const noexcept
The actual patch type.
void processGeneric(const label patchSize, const word &patchName, const IOobject &io, const bool separateValue)
HashPtrTable< scalarField > scalarFields_
void mapGeneric(const genericPatchFieldBase &rhs, const MapperType &mapper)
Implementation for construct with mapper.
bool processEntry(const entry &dEntry, const label patchSize, const word &patchName, const IOobject &io)
A class for handling keywords in dictionaries.
Definition: keyType.H:71
A class for handling words, derived from Foam::string.
Definition: word.H:68
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:63
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
Specialisations of Field<T> for scalar, vector and tensor.
dictionary dict
volScalarField & e
Definition: createFields.H:11