Loading...
Searching...
No Matches
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-2023 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 Foam_genericPatchFieldBase_H
39#define Foam_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{
51/*---------------------------------------------------------------------------*\
52 Class genericPatchFieldBase Declaration
53\*---------------------------------------------------------------------------*/
54
56{
57 // Private Data
58
59 //- The non-generic patch name
60 word actualTypeName_;
61
62 //- Copy of the input dictionary (used for transcribing)
63 dictionary dict_;
64
65
66 // The data fields read.
67 // Do not need to handle generic for 'label' since these
68 // will be limited to known field types.
69
70 HashPtrTable<scalarField> scalarFields_;
71 HashPtrTable<vectorField> vectorFields_;
73 HashPtrTable<symmTensorField> symmTensorFields_;
74 HashPtrTable<tensorField> tensorFields_;
75
76
77 // Private Member Functions
78
79 bool checkFieldSize
80 (
81 const label fieldSize,
82 const label patchSize,
83 const word& patchName,
84 const keyType& key,
85 const IOobject& io
86 ) const;
87
88
89protected:
90
91 // Protected Member Functions
92
93 //- Add error message to FatalError about solving with
94 //- generic condition
96 (
97 const word& patchName,
98 const IOobject& io
99 ) const;
100
101 //- FatalError for missing entry
103 (
104 const word& entryName,
105 const word& patchName,
106 const IOobject& io
107 ) const;
108
109 void processGeneric
110 (
111 const label patchSize,
112 const word& patchName,
113 const IOobject& io,
114 const bool separateValue
115 );
116
117 bool processEntry
118 (
119 const entry& dEntry,
120 const label patchSize,
121 const word& patchName,
122 const IOobject& io
123 );
124
125 //- Write a single entry, with lookup of hashed values
126 void putEntry(const entry& e, Ostream& os) const;
127
128 //- Write all generic entries from dictionary,
129 //- optionally treating the "value" entry separately
130 void writeGeneric(Ostream& os, const bool separateValue) const;
131
132 //- Implementation for construct with mapper
133 template<class MapperType>
134 void mapGeneric
135 (
137 const MapperType& mapper
138 );
139
140 //- Implementation for autoMap of self given a mapping object
141 template<class MapperType>
142 void autoMapGeneric(const MapperType& mapper);
143
144 //- Implementation for reverse map given patch field onto this
145 //- patch field
146 void rmapGeneric
147 (
149 const labelList& addr
150 );
151
152
153 // Constructors
154
155 //- Partial copy construct. Only copy type and dictionary
157
158
159public:
160
161 // Constructors
162
163 //- Default construct, generally not useful.
164 genericPatchFieldBase() = default;
165
166 //- Copy construct
168
169 //- Move construct
171
172 //- Initialize from dictionary
173 explicit genericPatchFieldBase(const dictionary& dict);
174
175
176 // Member Functions
177
178 //- The actual patch type
179 const word& actualType() const noexcept
180 {
181 return actualTypeName_;
182 }
183};
184
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188} // End namespace Foam
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192#ifdef NoRepository
194#endif
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198#endif
199
200// ************************************************************************* //
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A keyword and a list of tokens is an 'entry'.
Definition entry.H:66
void writeGeneric(Ostream &os, const bool separateValue) const
Write all generic entries from dictionary, optionally treating the "value" entry separately.
genericPatchFieldBase()=default
Default construct, generally not useful.
void rmapGeneric(const genericPatchFieldBase &rhs, const labelList &addr)
Implementation for reverse map given patch field onto this patch field.
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.
genericPatchFieldBase(const Foam::zero, const genericPatchFieldBase &)
Partial copy construct. Only copy type and dictionary.
genericPatchFieldBase(const genericPatchFieldBase &)=default
Copy construct.
void genericFatalSolveError(const word &patchName, const IOobject &io) const
Add error message to FatalError about solving with generic condition.
const word & actualType() const noexcept
The actual patch type.
void processGeneric(const label patchSize, const word &patchName, const IOobject &io, const bool separateValue)
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:69
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
OBJstream os(runTime.globalPath()/outputName)
const auto & io
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
const direction noexcept
Definition scalarImpl.H:265
Specialisations of Field<T> for scalar, vector and tensor.
dictionary dict
volScalarField & e