mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
216 lines
5.9 KiB
C++
216 lines
5.9 KiB
C++
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM.
|
|
|
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by the
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
option) any later version.
|
|
|
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
Class
|
|
Foam::cellTable
|
|
|
|
Description
|
|
The cellTable persistent data saved as a Map<dictionary>.
|
|
|
|
The meshReader supports cellTable information.
|
|
|
|
The <tt>constant/cellTable</tt> file is an @c IOMap<dictionary> that is
|
|
used to save the information persistently. It contains the cellTable
|
|
information of the following form:
|
|
|
|
@verbatim
|
|
(
|
|
ID
|
|
{
|
|
Label WORD;
|
|
MaterialType WORD;
|
|
MaterialId INT;
|
|
PorosityId INT;
|
|
ColorIdx INT;
|
|
...
|
|
}
|
|
...
|
|
)
|
|
@endverbatim
|
|
|
|
If the @a Label is missing, a value <tt>cellTable_{ID}</tt> will be
|
|
inferred. If the @a MaterialType is missing, the value @a fluid will
|
|
be inferred.
|
|
|
|
SourceFiles
|
|
cellTable.C
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#ifndef cellTable_H
|
|
#define cellTable_H
|
|
|
|
#include "polyMesh.H"
|
|
#include "Map.H"
|
|
#include "dictionary.H"
|
|
#include "labelList.H"
|
|
#include "wordReList.H"
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
namespace Foam
|
|
{
|
|
|
|
/*---------------------------------------------------------------------------*\
|
|
Class cellTable Declaration
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
class cellTable
|
|
:
|
|
public Map<dictionary>
|
|
{
|
|
// Private data
|
|
|
|
static const char* const defaultMaterial_;
|
|
|
|
|
|
// Private Member Functions
|
|
|
|
//- Map from cellTable ID => zone number
|
|
Map<label> zoneMap() const;
|
|
|
|
//- A contiguous list of cellTable names
|
|
List<word> namesList() const;
|
|
|
|
//- Add required entries - MaterialType
|
|
void addDefaults();
|
|
|
|
void setEntry(const label id, const word& keyWord, const word& value);
|
|
|
|
//- Disallow default bitwise copy construct
|
|
cellTable(const cellTable&);
|
|
|
|
|
|
public:
|
|
|
|
// Constructors
|
|
|
|
//- Construct null
|
|
cellTable();
|
|
|
|
//- Construct read from registry, name. instance
|
|
cellTable
|
|
(
|
|
const objectRegistry&,
|
|
const word& name = "cellTable",
|
|
const fileName& instance = "constant"
|
|
);
|
|
|
|
|
|
//- Destructor
|
|
~cellTable();
|
|
|
|
|
|
// Member Functions
|
|
|
|
//- Append to the end, return index
|
|
label append(const dictionary&);
|
|
|
|
//- Return index corresponding to name
|
|
// returns -1 if not found
|
|
label findIndex(const word& name) const;
|
|
|
|
//- Return the name corresponding to id
|
|
// returns cellTable_ID if not otherwise defined
|
|
word name(const label id) const;
|
|
|
|
//- Return a Map of (id => name)
|
|
Map<word> names() const;
|
|
|
|
//- Return a Map of (id => names) selected by patterns
|
|
Map<word> names(const UList<wordRe>& patterns) const;
|
|
|
|
//- Return a Map of (id => name) for materialType (fluid | solid | shell)
|
|
Map<word> selectType(const word& materialType) const;
|
|
|
|
//- Return a Map of (id => name) for fluids
|
|
Map<word> fluids() const;
|
|
|
|
//- Return a Map of (id => name) for shells
|
|
Map<word> shells() const;
|
|
|
|
//- Return a Map of (id => name) for solids
|
|
Map<word> solids() const;
|
|
|
|
//- Return a Map of (id => fluid|solid|shell)
|
|
Map<word> materialTypes() const;
|
|
|
|
//- Assign material Type
|
|
void setMaterial(const label, const word&);
|
|
|
|
//- Assign name
|
|
void setName(const label, const word&);
|
|
|
|
//- Assign default name if not already set
|
|
void setName(const label);
|
|
|
|
//- Read constant/cellTable
|
|
void readDict
|
|
(
|
|
const objectRegistry&,
|
|
const word& name = "cellTable",
|
|
const fileName& instance = "constant"
|
|
);
|
|
|
|
//- write constant/cellTable for later reuse
|
|
void writeDict
|
|
(
|
|
const objectRegistry&,
|
|
const word& name = "cellTable",
|
|
const fileName& instance = "constant"
|
|
) const;
|
|
|
|
|
|
// Member Operators
|
|
|
|
//- Assignment
|
|
void operator=(const cellTable&);
|
|
|
|
//- Assign from Map<dictionary>
|
|
void operator=(const Map<dictionary>&);
|
|
|
|
//- Assign from cellZones
|
|
void operator=(const polyMesh&);
|
|
|
|
|
|
// Friend Functions
|
|
|
|
//- Classify tableIds into cellZones according to the cellTable
|
|
void addCellZones(polyMesh&, const labelList& tableIds) const;
|
|
|
|
//- Combine tableIds together
|
|
// each dictionary entry is a wordList
|
|
void combine(const dictionary&, labelList& tableIds);
|
|
};
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
} // End namespace Foam
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
#endif
|
|
|
|
// ************************************************************************* //
|