createFundamentalSheetsFJ.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "demandDrivenData.H"
30 #include "meshSurfaceEngine.H"
31 #include "extrudeLayer.H"
32 
34 
35 # ifdef USE_OMP
36 #include <omp.h>
37 # endif
38 
39 // #define DEBUGSearch
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
50 (
54 );
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
59 {
60  if( !createWrapperSheet_ )
61  return;
62 
63  const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
64 
65  const label start = boundaries[0].patchStart();
66  const label end
67  (
68  boundaries[boundaries.size()-1].patchStart() +
69  boundaries[boundaries.size()-1].patchSize()
70  );
71 
72  faceListPMG::subList bFaces(mesh_.faces(), end-start, start);
73 
74  const labelList& owner = mesh_.owner();
75 
76  LongList<labelPair> extrudeFaces(end-start);
77 
78  # ifdef USE_OMP
79  # pragma omp parallel for
80  # endif
81  for(label faceI=start;faceI<end;++faceI)
82  extrudeFaces[faceI-start] = labelPair(faceI, owner[faceI]);
83 
84  extrudeLayer(mesh_, extrudeFaces);
85 }
86 
88 {
89  const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
90 
91  forAll(boundaries, patchI)
92  {
93  const cellListPMG& cells = mesh_.cells();
94  boolList patchCell(cells.size(), false);
95 
96  const labelList& owner = mesh_.owner();
97  const labelList& neighbour = mesh_.neighbour();
98 
99  const label start = boundaries[patchI].patchStart();
100  const label end = start + boundaries[patchI].patchSize();
101 
102  for(label faceI=start;faceI<end;++faceI)
103  patchCell[owner[faceI]] = true;
104 
105  LongList<labelPair> front;
106 
107  for(label faceI=start;faceI<end;++faceI)
108  {
109  const cell& c = cells[owner[faceI]];
110 
111  forAll(c, fI)
112  {
113  if( neighbour[c[fI]] < 0 )
114  continue;
115 
116  label nei = owner[c[fI]];
117  if( nei == owner[faceI] )
118  nei = neighbour[c[fI]];
119 
120  if( !patchCell[nei] )
121  front.append(labelPair(c[fI], nei));
122  }
123  }
124 
125  extrudeLayer(mesh_, front);
126  }
127 // const cellListPMG& cells = mesh_.cells();
128 // const labelList& owner = mesh_.owner();
129 // const labelList& neighbour = mesh_.neighbour();
130 //
131 // const label start = boundaries[0].patchStart();
132 // const label end
133 // (
134 // boundaries[boundaries.size()-1].patchStart() +
135 // boundaries[boundaries.size()-1].patchSize()
136 // );
137 //
138 // faceListPMG::subList bFaces(mesh_.faces(), end-start, start);
139 //
140 // labelList patchCell(mesh_.cells().size());
141 //
142 // LongList<labelPair> front;
143 //
144 // const label nThreads = 2 * omp_get_num_procs();
145 // # pragma omp parallel num_threads(nThreads)
146 // {
147 // # pragma omp for
148 // forAll(patchCell, cellI)
149 // patchCell[cellI] = -1;
150 //
151 // # pragma omp barrier
152 //
153 // # pragma omp for
154 // for(label faceI=start;faceI<end;++faceI)
155 // patchCell[owner[faceI]] = mesh_.faceIsInPatch(faceI);
156 //
157 // //- create the front faces
158 // LongList<labelPair> localFront;
159 //
160 // # pragma omp for
161 // for(label faceI=start;faceI<end;++faceI)
162 // {
163 // const cell& c = cells[owner[faceI]];
164 // const label patchI = mesh_.faceIsInPatch(faceI);
165 //
166 // forAll(c, fI)
167 // {
168 // if( neighbour[c[fI]] < 0 )
169 // continue;
170 //
171 // label nei = owner[c[fI]];
172 // if( nei == owner[faceI] )
173 // nei = neighbour[c[fI]];
174 //
175 // if( patchCell[nei] != patchI )
176 // localFront.append(labelPair(c[fI], nei));
177 // }
178 // }
179 //
180 // label frontStart(-1);
181 // # pragma omp critical
182 // {
183 // frontStart = front.size();
184 // front.setSize(front.size()+localFront.size());
185 // }
186 //
187 // # pragma omp barrier
188 //
189 // //- copy the local front into the global front
190 // forAll(localFront, lfI)
191 // front[frontStart+lfI] = localFront[lfI];
192 // }
193 //
194 // //- extrude the layer
195 // extrudeLayer(mesh_, front);
196 }
197 
198 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
199 
200 // Construct from mesh, octree, regions for boundary vertices
202 (
203  polyMeshGen& mesh,
204  const bool createWrapperSheet
205 )
206 :
207  createFundamentalSheets(mesh, createWrapperSheet)
208 {
209  createInitialSheet();
210 
211  createSheetsAtFeatureEdges();
212 }
213 
214 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
215 
217 {}
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // ************************************************************************* //
Foam::polyMeshGenFaces::neighbour
const labelList & neighbour() const
Definition: polyMeshGenFacesI.H:86
Foam::polyMeshGenFaces::owner
const labelList & owner() const
owner and neighbour cells for faces
Definition: polyMeshGenFacesI.H:67
Foam::createFundamentalSheets::mesh_
polyMeshGen & mesh_
reference to mesh
Definition: createFundamentalSheets.H:64
Foam::createFundamentalSheetsFJ::createSheetsAtFeatureEdges
void createSheetsAtFeatureEdges()
create fundamental sheets for all feature edges
Definition: createFundamentalSheetsFJ.C:87
Foam::LongList::append
void append(const T &e)
Append an element at the end of the list.
Definition: LongListI.H:265
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::createFundamentalSheetsFJ::createInitialSheet
void createInitialSheet()
create inital sheet from all boundary faces of the surface mesh
Definition: createFundamentalSheetsFJ.C:58
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::cellListPMG
Definition: cellListPMG.H:49
polyMeshGen
Mesh with selections.
Foam::polyMeshGenFaces::faces
const faceListPMG & faces() const
access to faces
Definition: polyMeshGenFacesI.H:43
Foam::LongList
Definition: LongList.H:55
createFundamentalSheetsFJ.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::polyMeshGenCells::cells
const cellListPMG & cells() const
access to cells
Definition: polyMeshGenCellsI.H:39
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
meshSurfaceEngine.H
Foam::createFundamentalSheetsFJ::~createFundamentalSheetsFJ
~createFundamentalSheetsFJ()
Definition: createFundamentalSheetsFJ.C:216
Foam::createFundamentalSheetsFJ::createFundamentalSheetsFJ
createFundamentalSheetsFJ()
Disallow default construct.
extrudeLayer.H
Foam::polyMeshGenFaces::boundaries
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
Definition: polyMeshGenFacesI.H:111
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::createFundamentalSheets
Definition: createFundamentalSheets.H:55
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::createFundamentalSheets::createWrapperSheet_
const bool createWrapperSheet_
shall the procedure create the intial wrapper sheet
Definition: createFundamentalSheets.H:67
createFundamentalSheetsFJ
Inserts sheets at the boundary of the mesh to capture all feature edges. An initial o-layer is insert...
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:56
Foam::labelPair
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
Foam::extrudeLayer
Definition: extrudeLayer.H:51
createFundamentalSheets
A base class for various method to generate fundamental sheets necessary to capture feature edges.