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 "polyMeshGenModifierAddCellByCell.H"
29 #include "demandDrivenData.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 polyMeshGenModifierAddCellByCell::polyMeshGenModifierAddCellByCell
41 polyMeshGenModifier(mesh),
42 nFaces_(mesh.faces().size()),
44 nCells_(mesh.cells().size()),
48 faceListPMG& faces = this->facesAccess();
50 newFaces_[faceI].transfer(faces[faceI]);
52 cellListPMG& cells = this->cellsAccess();
54 newCells_[cellI].transfer(cells[cellI]);
58 polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell()
60 faceListPMG& faces = this->facesAccess();
61 faces.setSize(nFaces_);
63 faces[faceI].transfer(newFaces_[faceI]);
65 cellListPMG& cells = this->cellsAccess();
66 cells.setSize(newCells_.size());
68 cells[cellI].transfer(newCells_[cellI]);
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces)
75 cell c(cellFaces.size());
77 VRWGraph& pointFaces = this->pointFaces();
79 forAll(cellFaces, faceI)
81 const face& f = cellFaces[faceI];
83 const label pointI = f[0];
86 forAllRow(pointFaces, pointI, pfI)
88 const label faceI = pointFaces(pointI, pfI);
90 if( newFaces_[faceI] == f )
102 pointFaces.append(f[pI], nFaces_);
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 } // End namespace Foam
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //