39 void Foam::extrude2DMesh::check2D()
const 41 const faceList& faces = mesh_.faces();
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");
118 List<polyPatch*> newPatches(patches.size() + 2);
122 const polyPatch& pp = patches[
patchi];
134 if (frontPatchi_ == -1)
136 frontPatchi_ = patches.size();
138 newPatches[frontPatchi_] =
157 Info<<
"Adding patch " << newPatches[frontPatchi_]->name()
158 <<
" at index " << frontPatchi_
159 <<
" for front faces." <<
nl <<
endl;
162 if (backPatchi_ == -1)
164 backPatchi_ = patches.size() + 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
204 for (
label layer = 0; layer < nLayers; ++layer)
206 label offset = layer * mesh_.nCells();
208 forAll(mesh_.cells(), celli)
216 mesh_.cellZones().whichZone(celli)
225 for (
label layer = 0; layer <= nLayers; ++layer)
227 label offset = layer * points.size();
233 point newPoint = model_
249 Pout<<
"Added " << points.size() <<
" points to layer " 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;
299 label offset = layer * mesh_.nCells();
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();
334 label endFacei = startFacei + patches[
patchi].size();
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;
353 label offset = layer * mesh_.nCells();
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();
442 label offset = layer * mesh_.nCells();
445 if (layer != nLayers - 1)
447 nei = celli + offset + mesh_.nCells();
466 Info<< frontFace <<
" " 467 << celli + offset <<
" " 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);
559 label offset = (nLayers - 1) * mesh_.nCells();
577 Info<< frontFace <<
" " 578 << celli + offset <<
" " const fvPatchList & patches
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< scalar > vector
A scalar version of the templated Vector.
void addFrontBackPatches()
Add front and back patches.
~extrude2DMesh()
Destructor.
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
defineTypeNameAndDebug(combustionModel, 0)
vector point
Point is a vector.
prefixOSstream Pout(cout, "Pout")
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.
extrude2DMesh(polyMesh &, const dictionary &dict, const extrudeModel &model)
void setRefinement(polyTopoChange &)
Play commands into polyTopoChange to extrude mesh.