41 void Foam::extrude2DMesh::check2D()
const
46 if (faces[facei].size() != 2)
49 <<
"Face " << facei <<
" size " << faces[facei].size()
50 <<
" is not of size 2: mesh is not a valid two-dimensional "
84 Foam::extrude2DMesh::extrude2DMesh
87 const dictionary&
dict,
88 const extrudeModel& model
95 modelType_(
dict.
get<word>(
"extrudeModel")),
96 patchType_(
dict.
get<word>(
"patchType")),
108 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
114 List<polyPatch*> newPatches(
patches.size() + 2);
118 const polyPatch& pp =
patches[patchi];
130 if (frontPatchi_ == -1)
134 newPatches[frontPatchi_] =
145 Info<<
"Adding patch " << newPatches[frontPatchi_]->name()
146 <<
" at index " << frontPatchi_
147 <<
" for front faces." <<
nl <<
endl;
150 if (backPatchi_ == -1)
152 backPatchi_ =
patches.size() + 1;
154 newPatches[backPatchi_] =
165 Info<<
"Adding patch " << newPatches[backPatchi_]->name()
166 <<
" at index " << backPatchi_
167 <<
" for back faces." <<
nl <<
endl;
170 mesh_.removeBoundary();
171 mesh_.addPatches(newPatches);
177 polyTopoChange& meshMod
180 const label nLayers = model_.nLayers();
184 for (label layer = 0; layer < nLayers; ++layer)
186 label offset = layer * mesh_.nCells();
188 forAll(mesh_.cells(), celli)
196 mesh_.cellZones().whichZone(celli)
205 for (label layer = 0; layer <= nLayers; ++layer)
207 label offset = layer *
points.size();
213 point newPoint = model_
229 Pout<<
"Added " <<
points.size() <<
" points to layer "
237 const faceList& faces = mesh_.faces();
238 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
240 for (label layer = 0; layer < nLayers; ++layer)
242 label currentLayerOffset = layer * mesh_.nPoints();
243 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
245 for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
247 label
zoneID = mesh_.faceZones().whichZone(facei);
248 bool zoneFlip =
false;
251 const faceZone& fZone = mesh_.faceZones()[
zoneID];
252 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
256 const face&
f = faces[facei];
257 newFace[0] =
f[0] + currentLayerOffset;
258 newFace[1] =
f[1] + currentLayerOffset;
259 newFace[2] =
f[1] + nextLayerOffset;
260 newFace[3] =
f[0] + nextLayerOffset;
279 label offset = layer * mesh_.nCells();
284 mesh_.faceOwner()[facei] + offset,
285 mesh_.faceNeighbour()[facei] + offset,
297 Info<< newFace <<
" "
298 << mesh_.faceOwner()[facei] + offset <<
" "
299 << mesh_.faceNeighbour()[facei] + offset <<
" "
308 for (label layer=0; layer < nLayers; layer++)
310 label currentLayerOffset = layer*mesh_.nPoints();
311 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
314 label endFacei = startFacei +
patches[patchi].size();
316 for (label facei = startFacei; facei < endFacei; facei++)
318 label
zoneID = mesh_.faceZones().whichZone(facei);
319 bool zoneFlip =
false;
322 const faceZone& fZone = mesh_.faceZones()[
zoneID];
323 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
327 const face&
f = faces[facei];
328 newFace[0] =
f[0] + currentLayerOffset;
329 newFace[1] =
f[1] + currentLayerOffset;
330 newFace[2] =
f[1] + nextLayerOffset;
331 newFace[3] =
f[0] + nextLayerOffset;
333 label offset = layer * mesh_.nCells();
338 mesh_.faceOwner()[facei] + offset,
351 Info<< newFace <<
" "
352 << mesh_.faceOwner()[facei] + offset <<
" "
362 forAll(mesh_.cells(), celli)
364 const cell& cFaces = mesh_.cells()[celli];
366 face frontFace(cFaces.size());
369 label nextFacei = cFaces[0];
371 const face&
f = faces[nextFacei];
374 if (mesh_.faceOwner()[nextFacei] == celli)
386 for (label i = 1; i < frontFace.size(); i++)
388 frontFace[i] = nextPointi;
393 label facei = cFaces[cFacei];
394 if (facei != nextFacei)
396 const face&
f = faces[facei];
398 if (
f[0] == nextPointi)
404 else if (
f[1] == nextPointi)
414 for (label layer = 0; layer < nLayers - 1; ++layer)
419 frontFace[fp] += mesh_.nPoints();
422 label offset = layer * mesh_.nCells();
425 if (layer != nLayers - 1)
427 nei = celli + offset + mesh_.nCells();
446 Info<< frontFace <<
" "
447 << celli + offset <<
" "
458 forAll(mesh_.cells(), celli)
460 const cell& cFaces = mesh_.cells()[celli];
462 face frontFace(cFaces.size());
465 label nextFacei = cFaces[0];
467 const face&
f = faces[nextFacei];
470 if (mesh_.faceOwner()[nextFacei] == celli)
482 for (label i = 1; i < frontFace.size(); i++)
484 frontFace[i] = nextPointi;
489 label facei = cFaces[cFacei];
490 if (facei != nextFacei)
492 const face&
f = faces[facei];
494 if (
f[0] == nextPointi)
500 else if (
f[1] == nextPointi)
513 frontFace.reverseFace(),
527 Info<<
nl<<frontFace.reverseFace() <<
" "
536 frontFace[fp] += mesh_.nPoints()* (nLayers);
539 label offset = (nLayers - 1) * mesh_.nCells();
557 Info<< frontFace <<
" "
558 << celli + offset <<
" "