polyBoundaryMeshEntries.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) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2020-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::polyBoundaryMeshEntries
29 
30 Description
31  Read and store dictionary entries for boundary patches
32  The object is *never* registered to avoid registry name clashes with
33  polyBoundaryMesh, which may either already have been registered, or
34  which should subsequently be registered.
35 
36 SourceFiles
37  polyBoundaryMeshEntries.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Foam_polyBoundaryMeshEntries_H
42 #define Foam_polyBoundaryMeshEntries_H
43 
44 #include "regIOobject.H"
45 #include "PtrList.H"
46 #include "entry.H"
47 #include "wordList.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class polyBoundaryMeshEntries Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public PtrList<entry>,
61  public regIOobject
62 {
63 public:
64 
65  //- Runtime type information
66  TypeNameNoDebug("polyBoundaryMesh");
67 
68 
69  // Constructors
70 
71  //- Read construct from IOobject. Never register!
72  explicit polyBoundaryMeshEntries(const IOobject& io);
73 
74 
75  // Factory Methods
76 
77  //- Read and return contents. The IOobject is never registered
78  static PtrList<entry> readContents(const IOobject& io);
79 
80 
81  // Static Functions
82 
83  //- Truncate entries at the first processor patch entry
84  static void removeProcPatches(PtrList<entry>& entries);
85 
86  //- Write list of entries
87  static bool writeEntries(Ostream& os, const UPtrList<entry>& entries);
88 
89  //- Return a list of patch types, uses the "patch" entry
90  static wordList types(const UPtrList<entry>& entries);
91 
92  //- Return a list of patch start face indices, uses "startFace" entry
93  static labelList patchStarts(const UPtrList<entry>& entries);
94 
95  //- Return a list of patch sizes, uses "nFaces" entry
96  static labelList patchSizes(const UPtrList<entry>& entries);
97 
98 
99  // Member Functions
100 
101  //- Truncate at the first processor patch entry
102  void removeProcPatches();
103 
104 
105  // Characteristics
106 
107  //- Return a list of patch types, uses the "patch" entry
108  wordList types() const;
109 
110  //- Return a list of patch start face indices, uses "startFace" entry
111  labelList patchStarts() const;
112 
113  //- Return a list of patch sizes, uses "nFaces" entry
114  labelList patchSizes() const;
115 
116 
117  // Write
118 
119  //- Write as a plain list of entries
120  void writeEntry(Ostream& os) const;
121 
122  //- Write as a primitive entry with given name.
123  //- If the keyword is empty, revert to a plain list.
124  void writeEntry(const keyType& keyword, Ostream& os) const;
125 
126  //- The writeData member function required by regIOobject
127  virtual bool writeData(Ostream& os) const;
128 
129  //- Write using stream options, forces UNCOMPRESSED
130  virtual bool writeObject
131  (
132  IOstreamOption streamOpt,
133  const bool writeOnProc = true
134  ) const;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
polyBoundaryMeshEntries(const IOobject &io)
Read construct from IOobject. Never register!
A class for handling keywords in dictionaries.
Definition: keyType.H:66
void removeProcPatches()
Truncate at the first processor patch entry.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc=true) const
Write using stream options, forces UNCOMPRESSED.
A simple container for options an IOstream can normally have.
wordList types() const
Return a list of patch types, uses the "patch" entry.
static bool writeEntries(Ostream &os, const UPtrList< entry > &entries)
Write list of entries.
static PtrList< entry > readContents(const IOobject &io)
Read and return contents. The IOobject is never registered.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
labelList patchSizes() const
Return a list of patch sizes, uses "nFaces" entry.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
void writeEntry(Ostream &os) const
Write as a plain list of entries.
OBJstream os(runTime.globalPath()/outputName)
labelList patchStarts() const
Return a list of patch start face indices, uses "startFace" entry.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:66
virtual bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
TypeNameNoDebug("polyBoundaryMesh")
Runtime type information.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Read and store dictionary entries for boundary patches The object is *never* registered to avoid regi...
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.