39 void Foam::extrude2DMesh::check2D()
const
44 if (faces[facei].size() != 2)
47 <<
"Face " << facei <<
" size " << faces[facei].size()
48 <<
" is not of size 2: mesh is not a valid two-dimensional "
85 const dictionary&
dict,
86 const extrudeModel& model
93 modelType_(
dict.lookup(
"extrudeModel")),
94 patchType_(
dict.lookup(
"patchType")),
112 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
114 frontPatchi_ =
patches.findPatchID(
"front");
115 backPatchi_ =
patches.findPatchID(
"back");
134 if (frontPatchi_ == -1)
138 newPatches[frontPatchi_] =
157 Info<<
"Adding patch " << newPatches[frontPatchi_]->name()
158 <<
" at index " << frontPatchi_
159 <<
" for front faces." <<
nl <<
endl;
162 if (backPatchi_ == -1)
166 newPatches[backPatchi_] =
185 Info<<
"Adding patch " << newPatches[backPatchi_]->name()
186 <<
" at index " << backPatchi_
187 <<
" for back faces." <<
nl <<
endl;
190 mesh_.removeBoundary();
191 mesh_.addPatches(newPatches);
197 polyTopoChange& meshMod
200 const label nLayers = model_.nLayers();
204 for (
label layer = 0; layer < nLayers; ++layer)
208 forAll(mesh_.cells(), celli)
216 mesh_.cellZones().whichZone(celli)
225 for (
label layer = 0; layer <= nLayers; ++layer)
233 point newPoint = model_
257 const faceList& faces = mesh_.faces();
258 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
260 for (
label layer = 0; layer < nLayers; ++layer)
262 label currentLayerOffset = layer * mesh_.nPoints();
263 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
265 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
267 label zoneID = mesh_.faceZones().whichZone(facei);
268 bool zoneFlip =
false;
271 const faceZone& fZone = mesh_.faceZones()[zoneID];
272 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
276 const face&
f = faces[facei];
277 newFace[0] =
f[0] + currentLayerOffset;
278 newFace[1] =
f[1] + currentLayerOffset;
279 newFace[2] =
f[1] + nextLayerOffset;
280 newFace[3] =
f[0] + nextLayerOffset;
304 mesh_.faceOwner()[facei] +
offset,
305 mesh_.faceNeighbour()[facei] +
offset,
317 Info<< newFace <<
" "
318 << mesh_.faceOwner()[facei] +
offset <<
" "
319 << mesh_.faceNeighbour()[facei] +
offset <<
" "
328 for (
label layer=0; layer < nLayers; layer++)
330 label currentLayerOffset = layer*mesh_.nPoints();
331 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
336 for (
label facei = startFacei; facei < endFacei; facei++)
338 label zoneID = mesh_.faceZones().whichZone(facei);
339 bool zoneFlip =
false;
342 const faceZone& fZone = mesh_.faceZones()[zoneID];
343 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
347 const face&
f = faces[facei];
348 newFace[0] =
f[0] + currentLayerOffset;
349 newFace[1] =
f[1] + currentLayerOffset;
350 newFace[2] =
f[1] + nextLayerOffset;
351 newFace[3] =
f[0] + nextLayerOffset;
358 mesh_.faceOwner()[facei] +
offset,
371 Info<< newFace <<
" "
372 << mesh_.faceOwner()[facei] +
offset <<
" "
382 forAll(mesh_.cells(), celli)
384 const cell& cFaces = mesh_.cells()[celli];
386 face frontFace(cFaces.size());
389 label nextFacei = cFaces[0];
391 const face&
f = faces[nextFacei];
394 if (mesh_.faceOwner()[nextFacei] == celli)
406 for (
label i = 1; i < frontFace.size(); i++)
408 frontFace[i] = nextPointi;
413 label facei = cFaces[cFacei];
414 if (facei != nextFacei)
416 const face&
f = faces[facei];
418 if (
f[0] == nextPointi)
424 else if (
f[1] == nextPointi)
434 for (
label layer = 0; layer < nLayers - 1; ++layer)
439 frontFace[fp] += mesh_.nPoints();
445 if (layer != nLayers - 1)
447 nei = celli +
offset + mesh_.nCells();
466 Info<< frontFace <<
" "
478 forAll(mesh_.cells(), celli)
480 const cell& cFaces = mesh_.cells()[celli];
482 face frontFace(cFaces.size());
485 label nextFacei = cFaces[0];
487 const face&
f = faces[nextFacei];
490 if (mesh_.faceOwner()[nextFacei] == celli)
502 for (
label i = 1; i < frontFace.size(); i++)
504 frontFace[i] = nextPointi;
509 label facei = cFaces[cFacei];
510 if (facei != nextFacei)
512 const face&
f = faces[facei];
514 if (
f[0] == nextPointi)
520 else if (
f[1] == nextPointi)
533 frontFace.reverseFace(),
547 Info<<
nl<<frontFace.reverseFace() <<
" "
556 frontFace[fp] += mesh_.nPoints()* (nLayers);
577 Info<< frontFace <<
" "
#define forAll(list, i)
Loop across all elements in list.
void size(const label)
Override size to be inconsistent with allocated storage.
label size() const
Return the number of elements in the UPtrList.
extrude2DMesh(polyMesh &, const dictionary &dict, const extrudeModel &model)
~extrude2DMesh()
Destructor.
void setRefinement(polyTopoChange &)
Play commands into polyTopoChange to extrude mesh.
void addFrontBackPatches()
Add front and back patches.
virtual const faceList & faces() const
Return raw faces.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Vector< scalar > vector
A scalar version of the templated Vector.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
void offset(label &lst, const label o)