1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 The cellTable persistent data saved as a Map<dictionary>.
30 The meshReader supports cellTable information.
32 The <tt>constant/cellTable</tt> file is an @c IOMap<dictionary> that is
33 used to save the information persistently. It contains the cellTable
34 information of the following form:
51 If the @a Label is missing, a value <tt>cellTable_{ID}</tt> will be
52 inferred. If the @a MaterialType is missing, the value @a fluid will
58 \*---------------------------------------------------------------------------*/
65 #include "dictionary.H"
66 #include "labelList.H"
67 #include "wordReList.H"
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 /*---------------------------------------------------------------------------*\
75 Class cellTable Declaration
76 \*---------------------------------------------------------------------------*/
80 public Map<dictionary>
84 static const char* const defaultMaterial_;
87 // Private Member Functions
89 //- Map from cellTable ID => zone number
90 Map<label> zoneMap() const;
92 //- A contiguous list of cellTable names
93 List<word> namesList() const;
95 //- Add required entries - MaterialType
98 void setEntry(const label& id, const word& keyWord, const word& value);
100 //- Disallow default bitwise copy construct
101 cellTable(const cellTable&);
111 //- Construct read from registry, name. instance
114 const objectRegistry&,
115 const word& name = "cellTable",
116 const fileName& instance = "constant"
126 //- Append to the end, return index
127 label append(const dictionary&);
129 //- Return index corresponding to name
130 // returns -1 if not found
131 label findIndex(const word& name) const;
133 //- Return the name corresponding to id
134 // returns cellTable_ID if not otherwise defined
135 word name(const label& id) const;
137 //- Return a Map of (id => name)
138 Map<word> names() const;
140 //- Return a Map of (id => names) selected by patterns
141 Map<word> names(const List<wordRe>& patterns) const;
143 //- Return a Map of (id => name) for materialType (fluid | solid | shell)
144 Map<word> selectType(const word& materialType) const;
146 //- Return a Map of (id => name) for fluids
147 Map<word> fluids() const;
149 //- Return a Map of (id => name) for shells
150 Map<word> shells() const;
152 //- Return a Map of (id => name) for solids
153 Map<word> solids() const;
155 //- Return a Map of (id => fluid|solid|shell)
156 Map<word> materialTypes() const;
158 //- Assign material Type
159 void setMaterial(const label&, const word&);
162 void setName(const label&, const word&);
164 //- Assign default name if not already set
165 void setName(const label&);
167 //- Read constant/cellTable
170 const objectRegistry&,
171 const word& name = "cellTable",
172 const fileName& instance = "constant"
175 //- write constant/cellTable for later reuse
178 const objectRegistry&,
179 const word& name = "cellTable",
180 const fileName& instance = "constant"
187 void operator=(const cellTable&);
189 //- Assign from Map<dictionary>
190 void operator=(const Map<dictionary>&);
192 //- Assign from cellZones
193 void operator=(const polyMesh&);
198 //- Classify tableIds into cellZones according to the cellTable
199 void addCellZones(polyMesh&, const labelList& tableIds) const;
201 //- Combine tableIds together
202 // each dictionary entry is a wordList
203 void combine(const dictionary&, labelList& tableIds);
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 // ************************************************************************* //