1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 The cellTable persistent data saved as a Map<dictionary>.
31 The meshReader supports cellTable information.
33 The <tt>constant/cellTable</tt> file is an @c IOMap<dictionary> that is
34 used to save the information persistently. It contains the cellTable
35 information of the following form:
52 If the @a Label is missing, a value <tt>cellTable_{ID}</tt> will be
53 inferred. If the @a MaterialType is missing, the value @a fluid will
59 \*---------------------------------------------------------------------------*/
66 #include "dictionary.H"
67 #include "labelList.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 => name) for materialType (fluid | solid | shell)
141 Map<word> selectType(const word& materialType) const;
143 //- Return a Map of (id => name) for fluids
144 Map<word> fluids() const;
146 //- Return a Map of (id => name) for shells
147 Map<word> shells() const;
149 //- Return a Map of (id => name) for solids
150 Map<word> solids() const;
152 //- Return a Map of (id => fluid|solid|shell)
153 Map<word> materialTypes() const;
155 //- Assign material Type
156 void setMaterial(const label&, const word&);
159 void setName(const label&, const word&);
161 //- Assign default name if not already set
162 void setName(const label&);
164 //- Read constant/cellTable
167 const objectRegistry&,
168 const word& name = "cellTable",
169 const fileName& instance = "constant"
172 //- write constant/cellTable for later reuse
175 const objectRegistry&,
176 const word& name = "cellTable",
177 const fileName& instance = "constant"
184 void operator=(const cellTable&);
186 //- Assign from Map<dictionary>
187 void operator=(const Map<dictionary>&);
189 //- Assign from cellZones
190 void operator=(const polyMesh&);
195 //- Classify tableIds into cellZones according to the cellTable
196 void addCellZones(polyMesh&, const labelList& tableIds) const;
198 //- Combine tableIds together
199 // each dictionary entry is a wordList
200 void combine(const dictionary&, labelList& tableIds);
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 } // End namespace Foam
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 // ************************************************************************* //