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();
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)
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)
213 point newPoint = model_
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 <<
" " List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
PtrList< T > clone(Args &&... args) const
Make a copy by cloning each of the list elements.
constexpr char nl
The newline '\n' character (0x0a)
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
List< face > faceList
A List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addFrontBackPatches()
Add front and back patches.
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
label size() const noexcept
The number of elements in the list.
virtual const faceList & faces() const
Return raw faces.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
vector point
Point is a vector.
const polyBoundaryMesh & patches
messageStream Info
Information stream (stdout output on master, null elsewhere)
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
void setRefinement(polyTopoChange &)
Play commands into polyTopoChange to extrude mesh.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.