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
26 Create intermediate mesh files from SAMM files
28 \*---------------------------------------------------------------------------*/
31 #include "polyPatch.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 void sammMesh::createPolyBoundary()
37 label nBoundaryFacesFound = 0;
39 polyBoundaryPatchStartIndices_.setSize(boundary_.size());
41 label nCreatedFaces = nInternalFaces_;
43 const labelListList& PointCells = pointCells();
45 forAll (boundary_, patchI)
47 const faceList& curShapePatch = boundary_[patchI];
49 polyBoundaryPatchStartIndices_[patchI] = nCreatedFaces;
51 forAll (curShapePatch, faceI)
55 const face& curFace = curShapePatch[faceI];
57 meshFaces_[nCreatedFaces] = curFace;
59 // Must find which cell this face belongs to in order to
60 // mark it in the cellPolys_
61 const labelList& facePoints = curFace;
63 forAll(facePoints, pointI)
65 const labelList& facePointCells =
66 PointCells[facePoints[pointI]];
68 forAll(facePointCells, cellI)
70 const faceList& curCellFaces =
71 cellFaces_[facePointCells[cellI]];
73 forAll(curCellFaces, cellFaceI)
75 if (curCellFaces[cellFaceI] == curFace)
77 // Found the cell face corresponding to this face
83 cellPolys_[facePointCells[cellI]][cellFaceI]
89 "void sammMesh::createPolyBoundary()"
90 ) << "This looks like an already detected "
95 cellPolys_[facePointCells[cellI]][cellFaceI] =
98 nBoundaryFacesFound++;
111 // reset the size of the face list
112 meshFaces_.setSize(nCreatedFaces);
114 Info << "Number of boundary faces: " << nBoundaryFacesFound << endl;
115 Info << "Total number of faces: " << nCreatedFaces << endl;
119 List<polyPatch* > sammMesh::polyBoundaryPatches(const polyMesh& pMesh)
121 List<polyPatch* > p(boundary_.size());
123 forAll (boundary_, patchI)
125 const faceList& curShapePatch = boundary_[patchI];
127 p[patchI] = polyPatch::New
131 curShapePatch.size(),
132 polyBoundaryPatchStartIndices_[patchI],
137 p[patchI]->physicalType() = patchPhysicalTypes_[patchI];
144 // ************************************************************************* //