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
28 \*---------------------------------------------------------------------------*/
30 #include "blockMesh.H"
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 Foam::faceList Foam::blockMesh::createPatchFaces
36 const polyPatch& patchTopologyFaces
39 blockMesh& blocks = *this;
41 labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
45 forAll(patchTopologyFaces, patchTopologyFaceLabel)
47 label blockLabel = blockLabels[patchTopologyFaceLabel];
51 blocks[blockLabel].blockDef().blockShape().faces()
54 forAll(blockFaces, blockFaceLabel)
58 blockFaces[blockFaceLabel]
59 == patchTopologyFaces[patchTopologyFaceLabel]
63 blocks[blockLabel].boundaryPatches()[blockFaceLabel].size();
69 faceList patchFaces(nFaces);
73 forAll(patchTopologyFaces, patchTopologyFaceLabel)
75 label blockLabel = blockLabels[patchTopologyFaceLabel];
79 blocks[blockLabel].blockDef().blockShape().faces()
82 forAll(blockFaces, blockFaceLabel)
86 blockFaces[blockFaceLabel]
87 == patchTopologyFaces[patchTopologyFaceLabel]
90 const labelListList& blockPatchFaces =
91 blocks[blockLabel].boundaryPatches()[blockFaceLabel];
93 forAll(blockPatchFaces, blockFaceLabel)
95 // Lookup the face points
96 // and collapse duplicate point labels
101 blockPatchFaces[blockFaceLabel][0]
102 + blockOffsets_[blockLabel]
109 label facePointLabel = 1;
117 blockPatchFaces[blockFaceLabel][facePointLabel]
118 + blockOffsets_[blockLabel]
121 if (quadFace[nUnique] != quadFace[nUnique-1])
127 if (quadFace[nUnique-1] == quadFace[0])
134 patchFaces[faceLabel++] = quadFace;
136 else if (nUnique == 3)
138 patchFaces[faceLabel++] = face
140 labelList::subList(quadFace, 3)
143 // else the face has collapsed to an edge or point
149 patchFaces.setSize(faceLabel);
155 Foam::faceListList Foam::blockMesh::createPatches()
157 Info<< "\nCreating patches\n";
159 const polyPatchList& patchTopologies = topology().boundaryMesh();
160 faceListList patches(patchTopologies.size());
162 forAll(patchTopologies, patchLabel)
164 patches[patchLabel] =
165 createPatchFaces(patchTopologies[patchLabel]);
171 // ************************************************************************* //