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 "
60 const dictionary&
dict,
61 const extrudeModel& model
67 modelType_(
dict.lookup(
"extrudeModel")),
68 patchType_(
dict.lookup(
"patchType")),
71 cellZonesAddedCells_(mesh.cellZones().size())
87 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
89 frontPatchi_ =
patches.findIndex(
"front");
90 backPatchi_ =
patches.findIndex(
"back");
109 if (frontPatchi_ == -1)
113 newPatches[frontPatchi_] =
124 Info<<
"Adding patch " << newPatches[frontPatchi_]->name()
125 <<
" at index " << frontPatchi_
126 <<
" for front faces." <<
nl <<
endl;
129 if (backPatchi_ == -1)
133 newPatches[backPatchi_] =
144 Info<<
"Adding patch " << newPatches[backPatchi_]->name()
145 <<
" at index " << backPatchi_
146 <<
" for back faces." <<
nl <<
endl;
149 mesh_.removeBoundary();
150 mesh_.addPatches(newPatches);
156 polyTopoChange& meshMod
159 const label nLayers = model_.nLayers();
163 for (
label layer = 0; layer < nLayers; ++layer)
167 forAll(mesh_.cells(), celli)
169 const label newCelli = meshMod.addCell
174 const labelList zones(mesh_.cellZones().whichZones(celli));
177 cellZonesAddedCells_[zonei].insert(newCelli);
186 for (
label layer = 0; layer <= nLayers; ++layer)
194 point newPoint = model_
217 const faceList& faces = mesh_.faces();
218 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
220 for (
label layer = 0; layer < nLayers; ++layer)
222 label currentLayerOffset = layer * mesh_.nPoints();
223 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
225 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
228 const face&
f = faces[facei];
229 newFace[0] =
f[0] + currentLayerOffset;
230 newFace[1] =
f[1] + currentLayerOffset;
231 newFace[2] =
f[1] + nextLayerOffset;
232 newFace[3] =
f[0] + nextLayerOffset;
239 mesh_.faceOwner()[facei] +
offset,
240 mesh_.faceNeighbour()[facei] +
offset,
248 Info<< newFace <<
" "
249 << mesh_.faceOwner()[facei] +
offset <<
" "
250 << mesh_.faceNeighbour()[facei] +
offset <<
" "
259 for (
label layer=0; layer < nLayers; layer++)
261 label currentLayerOffset = layer*mesh_.nPoints();
262 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
267 for (
label facei = startFacei; facei < endFacei; facei++)
270 const face&
f = faces[facei];
271 newFace[0] =
f[0] + currentLayerOffset;
272 newFace[1] =
f[1] + currentLayerOffset;
273 newFace[2] =
f[1] + nextLayerOffset;
274 newFace[3] =
f[0] + nextLayerOffset;
281 mesh_.faceOwner()[facei] +
offset,
290 Info<< newFace <<
" "
291 << mesh_.faceOwner()[facei] +
offset <<
" "
301 forAll(mesh_.cells(), celli)
303 const cell& cFaces = mesh_.cells()[celli];
305 face frontFace(cFaces.size());
308 label nextFacei = cFaces[0];
310 const face&
f = faces[nextFacei];
313 if (mesh_.faceOwner()[nextFacei] == celli)
325 for (
label i = 1; i < frontFace.size(); i++)
327 frontFace[i] = nextPointi;
332 label facei = cFaces[cFacei];
333 if (facei != nextFacei)
335 const face&
f = faces[facei];
337 if (
f[0] == nextPointi)
343 else if (
f[1] == nextPointi)
353 for (
label layer = 0; layer < nLayers - 1; ++layer)
358 frontFace[fp] += mesh_.nPoints();
364 if (layer != nLayers - 1)
366 nei = celli +
offset + mesh_.nCells();
381 Info<< frontFace <<
" "
393 forAll(mesh_.cells(), celli)
395 const cell& cFaces = mesh_.cells()[celli];
397 face frontFace(cFaces.size());
400 label nextFacei = cFaces[0];
402 const face&
f = faces[nextFacei];
405 if (mesh_.faceOwner()[nextFacei] == celli)
417 for (
label i = 1; i < frontFace.size(); i++)
419 frontFace[i] = nextPointi;
424 label facei = cFaces[cFacei];
425 if (facei != nextFacei)
427 const face&
f = faces[facei];
429 if (
f[0] == nextPointi)
435 else if (
f[1] == nextPointi)
448 frontFace.reverseFace(),
458 Info<<
nl<<frontFace.reverseFace() <<
" "
467 frontFace[fp] += mesh_.nPoints()* (nLayers);
484 Info<< frontFace <<
" "
496 mesh_.cellZones().insert(cellZonesAddedCells_);
#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)
void updateZones()
Update the mesh zones.
~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)
List< label > labelList
A List of labels.
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)