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
31 \*---------------------------------------------------------------------------*/
33 #include "blockMesh.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 // Construct from IOdictionary
43 blockMesh::blockMesh(IOdictionary& meshDescription)
45 topologyPtr_(createTopology(meshDescription)),
46 scale_(readScalar(meshDescription.lookup("convertToMeters"))),
47 blockOffsets_(createBlockOffsets()),
48 mergeList_(createMergeList()),
49 points_(createPoints()),
50 cells_(createCells()),
51 patches_(createPatches())
55 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
57 blockMesh::~blockMesh()
63 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
65 const polyMesh& blockMesh::topology() const
69 FatalErrorIn("blockMesh::topology() const")
70 << "topologyPtr_ not allocated"
78 const curvedEdgeList& blockMesh::edges() const
84 wordList blockMesh::patchNames() const
86 const polyPatchList& patchTopologies = topology().boundaryMesh();
87 wordList names(patchTopologies.size());
89 forAll (names, patchI)
91 names[patchI] = patchTopologies[patchI].name();
98 wordList blockMesh::patchTypes() const
100 const polyPatchList& patchTopologies = topology().boundaryMesh();
101 wordList types(patchTopologies.size());
103 forAll (types, patchI)
105 types[patchI] = patchTopologies[patchI].type();
112 wordList blockMesh::patchPhysicalTypes() const
114 const polyPatchList& patchTopologies = topology().boundaryMesh();
115 wordList physicalTypes(patchTopologies.size());
117 forAll (physicalTypes, patchI)
119 physicalTypes[patchI] = patchTopologies[patchI].physicalType();
122 return physicalTypes;
126 label blockMesh::numZonedBlocks() const
130 forAll(*this, blockI)
132 if (operator[](blockI).blockDef().zoneName().size() > 0)
142 void blockMesh::writeTopology(Ostream& os) const
144 const pointField& pts = topology().points();
148 const point& pt = pts[pI];
150 os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
153 const edgeList& edges = topology().edges();
157 const edge& e = edges[eI];
159 os << "l " << e.start() + 1 << ' ' << e.end() + 1 << endl;
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 } // End namespace Foam
168 // ************************************************************************* //