1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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
31 \*---------------------------------------------------------------------------*/
33 #include "blockMesh.H"
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 // Construct from IOdictionary
39 Foam::blockMesh::blockMesh(IOdictionary& meshDescription)
41 topologyPtr_(createTopology(meshDescription)),
42 blockOffsets_(createBlockOffsets()),
43 mergeList_(createMergeList()),
44 points_(createPoints(meshDescription)),
45 cells_(createCells()),
46 patches_(createPatches())
50 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
52 Foam::blockMesh::~blockMesh()
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 const Foam::polyMesh& Foam::blockMesh::topology() const
64 FatalErrorIn("blockMesh::topology() const")
65 << "topologyPtr_ not allocated"
73 Foam::wordList Foam::blockMesh::patchNames() const
75 const polyPatchList& patchTopologies = topology().boundaryMesh();
76 wordList names(patchTopologies.size());
78 forAll (names, patchI)
80 names[patchI] = patchTopologies[patchI].name();
87 Foam::wordList Foam::blockMesh::patchTypes() const
89 const polyPatchList& patchTopologies = topology().boundaryMesh();
90 wordList types(patchTopologies.size());
92 forAll (types, patchI)
94 types[patchI] = patchTopologies[patchI].type();
101 Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
103 const polyPatchList& patchTopologies = topology().boundaryMesh();
104 wordList physicalTypes(patchTopologies.size());
106 forAll (physicalTypes, patchI)
108 physicalTypes[patchI] = patchTopologies[patchI].physicalType();
111 return physicalTypes;
115 Foam::label Foam::blockMesh::numZonedBlocks() const
119 forAll(*this, blockI)
121 if (operator[](blockI).blockDef().zoneName().size())
131 void Foam::blockMesh::writeTopology(Ostream& os) const
133 const pointField& pts = topology().points();
137 const point& pt = pts[pI];
139 os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
142 const edgeList& edges = topology().edges();
146 const edge& e = edges[eI];
148 os << "l " << e.start() + 1 << ' ' << e.end() + 1 << endl;
152 // ************************************************************************* //