1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 3 of the License, or (at your
14 option) any later version.
16 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "polyMeshGenModifier.H"
29 #include "VRWGraphList.H"
30 #include "demandDrivenData.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 void polyMeshGenModifier::addCells(const LongList<faceList>& cellFaces)
39 Info << "Adding cells to the mesh" << endl;
41 faceListPMG& faces = mesh_.faces_;
42 cellListPMG& cells = mesh_.cells_;
44 VRWGraph& pointFaces = this->pointFaces();
46 //- start adding cells into the mesh
47 label nFaces = faces.size();
48 label nCells = cells.size();
52 const faceList& facesInCell = cellFaces[cI];
55 cell c(cellFaces[cI].size());
57 forAll(facesInCell, faceI)
59 const face& f = facesInCell[faceI];
61 const label pointI = f[0];
64 forAllRow(pointFaces, pointI, pfI)
66 const label faceI = pointFaces(pointI, pfI);
68 if( faces[faceI] == f )
81 pointFaces.append(f[pI], nFaces);
98 Info << "Finished adding cells to the mesh" << endl;
101 void polyMeshGenModifier::addCells(const VRWGraphList& cellFaces)
103 Info << "Adding " << cellFaces.size() << " cells to the mesh" << endl;
105 faceListPMG& faces = mesh_.faces_;
106 cellListPMG& cells = mesh_.cells_;
108 VRWGraph& pointFaces = this->pointFaces();
110 //- start adding cells into the mesh
111 label nFaces = faces.size();
112 label nCells = cells.size();
114 forAll(cellFaces, cI)
116 faceList facesInCell(cellFaces.sizeOfGraph(cI));
117 forAll(facesInCell, fI)
119 facesInCell[fI].setSize(cellFaces.sizeOfRow(cI, fI));
121 forAll(facesInCell[fI], pI)
122 facesInCell[fI][pI] = cellFaces(cI, fI, pI);
126 cell c(facesInCell.size());
128 forAll(facesInCell, faceI)
130 const face& f = facesInCell[faceI];
132 const label pointI = f[0];
135 forAllRow(pointFaces, pointI, pfI)
137 const label faceI = pointFaces(pointI, pfI);
139 if( faces[faceI] == f )
152 pointFaces.append(f[pI], nFaces);
169 Info << "Finished adding cells to the mesh" << endl;
172 void polyMeshGenModifier::addCell(const faceList& cellFaces)
174 faceListPMG& faces = this->facesAccess();
175 cellListPMG& cells = this->cellsAccess();
177 label nFaces = faces.size();
179 VRWGraph& pointFaces = this->pointFaces();
181 cell c(cellFaces.size());
184 forAll(cellFaces, faceI)
186 const face& f = cellFaces[faceI];
188 const label pointI = f[0];
191 forAllRow(pointFaces, pointI, pfI)
193 const label faceI = pointFaces(pointI, pfI);
195 if( faces[faceI] == f )
208 pointFaces.append(f[pI], nFaces);
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 } // End namespace Foam
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //