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 "createFundamentalSheetsFJ.H"
29 #include "demandDrivenData.H"
30 #include "meshSurfaceEngine.H"
31 #include "extrudeLayer.H"
33 #include "addToRunTimeSelectionTable.H"
39 // #define DEBUGSearch
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 defineTypeNameAndDebug(createFundamentalSheetsFJ, 0);
49 addToRunTimeSelectionTable
51 createFundamentalSheets,
52 createFundamentalSheetsFJ,
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 void createFundamentalSheetsFJ::createInitialSheet()
60 if( !createWrapperSheet_ )
63 const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
65 const label start = boundaries[0].patchStart();
68 boundaries[boundaries.size()-1].patchStart() +
69 boundaries[boundaries.size()-1].patchSize()
72 faceListPMG::subList bFaces(mesh_.faces(), end-start, start);
74 const labelList& owner = mesh_.owner();
76 LongList<labelPair> extrudeFaces(end-start);
79 # pragma omp parallel for
81 for(label faceI=start;faceI<end;++faceI)
82 extrudeFaces[faceI-start] = labelPair(faceI, owner[faceI]);
84 extrudeLayer(mesh_, extrudeFaces);
87 void createFundamentalSheetsFJ::createSheetsAtFeatureEdges()
89 const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
91 forAll(boundaries, patchI)
93 const cellListPMG& cells = mesh_.cells();
94 boolList patchCell(cells.size(), false);
96 const labelList& owner = mesh_.owner();
97 const labelList& neighbour = mesh_.neighbour();
99 const label start = boundaries[patchI].patchStart();
100 const label end = start + boundaries[patchI].patchSize();
102 for(label faceI=start;faceI<end;++faceI)
103 patchCell[owner[faceI]] = true;
105 LongList<labelPair> front;
107 for(label faceI=start;faceI<end;++faceI)
109 const cell& c = cells[owner[faceI]];
113 if( neighbour[c[fI]] < 0 )
116 label nei = owner[c[fI]];
117 if( nei == owner[faceI] )
118 nei = neighbour[c[fI]];
120 if( !patchCell[nei] )
121 front.append(labelPair(c[fI], nei));
125 extrudeLayer(mesh_, front);
127 // const cellListPMG& cells = mesh_.cells();
128 // const labelList& owner = mesh_.owner();
129 // const labelList& neighbour = mesh_.neighbour();
131 // const label start = boundaries[0].patchStart();
134 // boundaries[boundaries.size()-1].patchStart() +
135 // boundaries[boundaries.size()-1].patchSize()
138 // faceListPMG::subList bFaces(mesh_.faces(), end-start, start);
140 // labelList patchCell(mesh_.cells().size());
142 // LongList<labelPair> front;
144 // const label nThreads = 2 * omp_get_num_procs();
145 // # pragma omp parallel num_threads(nThreads)
148 // forAll(patchCell, cellI)
149 // patchCell[cellI] = -1;
151 // # pragma omp barrier
154 // for(label faceI=start;faceI<end;++faceI)
155 // patchCell[owner[faceI]] = mesh_.faceIsInPatch(faceI);
157 // //- create the front faces
158 // LongList<labelPair> localFront;
161 // for(label faceI=start;faceI<end;++faceI)
163 // const cell& c = cells[owner[faceI]];
164 // const label patchI = mesh_.faceIsInPatch(faceI);
168 // if( neighbour[c[fI]] < 0 )
171 // label nei = owner[c[fI]];
172 // if( nei == owner[faceI] )
173 // nei = neighbour[c[fI]];
175 // if( patchCell[nei] != patchI )
176 // localFront.append(labelPair(c[fI], nei));
180 // label frontStart(-1);
181 // # pragma omp critical
183 // frontStart = front.size();
184 // front.setSize(front.size()+localFront.size());
187 // # pragma omp barrier
189 // //- copy the local front into the global front
190 // forAll(localFront, lfI)
191 // front[frontStart+lfI] = localFront[lfI];
194 // //- extrude the layer
195 // extrudeLayer(mesh_, front);
198 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
200 // Construct from mesh, octree, regions for boundary vertices
201 createFundamentalSheetsFJ::createFundamentalSheetsFJ
204 const bool createWrapperSheet
207 createFundamentalSheets(mesh, createWrapperSheet)
209 createInitialSheet();
211 createSheetsAtFeatureEdges();
214 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
216 createFundamentalSheetsFJ::~createFundamentalSheetsFJ()
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 } // End namespace Foam
223 // ************************************************************************* //