1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. 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 UList<wordRe>& patterns) const;
143 //- Return a Map of (id => name) for materialType
144 // (fluid | solid | shell)
145 Map<word> selectType(const word& materialType) const;
147 //- Return a Map of (id => name) for fluids
148 Map<word> fluids() const;
150 //- Return a Map of (id => name) for shells
151 Map<word> shells() const;
153 //- Return a Map of (id => name) for solids
154 Map<word> solids() const;
156 //- Return a Map of (id => fluid|solid|shell)
157 Map<word> materialTypes() const;
159 //- Assign material Type
160 void setMaterial(const label, const word&);
163 void setName(const label, const word&);
165 //- Assign default name if not already set
166 void setName(const label);
168 //- Read constant/cellTable
171 const objectRegistry&,
172 const word& name = "cellTable",
173 const fileName& instance = "constant"
176 //- write constant/cellTable for later reuse
179 const objectRegistry&,
180 const word& name = "cellTable",
181 const fileName& instance = "constant"
188 void operator=(const cellTable&);
190 //- Assign from Map<dictionary>
191 void operator=(const Map<dictionary>&);
193 //- Assign from cellZones
194 void operator=(const polyMesh&);
199 //- Classify tableIds into cellZones according to the cellTable
200 void addCellZones(polyMesh&, const labelList& tableIds) const;
202 //- Combine tableIds together
203 // each dictionary entry is a wordList
204 void combine(const dictionary&, labelList& tableIds);
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 // ************************************************************************* //