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
66 patchType_(
dict.lookup(
"patchType")),
69 cellZonesAddedCells_(
mesh.cellZones().size())
85 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
87 frontPatchi_ =
patches.findIndex(
"front");
88 backPatchi_ =
patches.findIndex(
"back");
107 if (frontPatchi_ == -1)
111 newPatches[frontPatchi_] =
122 Info<<
"Adding patch " << newPatches[frontPatchi_]->name()
123 <<
" at index " << frontPatchi_
124 <<
" for front faces." <<
nl <<
endl;
127 if (backPatchi_ == -1)
131 newPatches[backPatchi_] =
142 Info<<
"Adding patch " << newPatches[backPatchi_]->name()
143 <<
" at index " << backPatchi_
144 <<
" for back faces." <<
nl <<
endl;
147 mesh_.removeBoundary();
148 mesh_.addPatches(newPatches);
154 polyTopoChange& meshMod
157 const label nLayers = model_.nLayers();
161 for (
label layer = 0; layer < nLayers; ++layer)
165 forAll(mesh_.cells(), celli)
167 const label newCelli = meshMod.addCell
172 const labelList zones(mesh_.cellZones().whichZones(celli));
175 cellZonesAddedCells_[zonei].insert(newCelli);
184 for (
label layer = 0; layer <= nLayers; ++layer)
192 point newPoint = model_
215 const faceList& faces = mesh_.faces();
216 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
218 for (
label layer = 0; layer < nLayers; ++layer)
220 label currentLayerOffset = layer * mesh_.nPoints();
221 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
223 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
226 const face&
f = faces[facei];
227 newFace[0] =
f[0] + currentLayerOffset;
228 newFace[1] =
f[1] + currentLayerOffset;
229 newFace[2] =
f[1] + nextLayerOffset;
230 newFace[3] =
f[0] + nextLayerOffset;
237 mesh_.faceOwner()[facei] +
offset,
238 mesh_.faceNeighbour()[facei] +
offset,
246 Info<< newFace <<
" "
247 << mesh_.faceOwner()[facei] +
offset <<
" "
248 << mesh_.faceNeighbour()[facei] +
offset <<
" "
257 for (
label layer=0; layer < nLayers; layer++)
259 label currentLayerOffset = layer*mesh_.nPoints();
260 label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
265 for (
label facei = startFacei; facei < endFacei; facei++)
268 const face&
f = faces[facei];
269 newFace[0] =
f[0] + currentLayerOffset;
270 newFace[1] =
f[1] + currentLayerOffset;
271 newFace[2] =
f[1] + nextLayerOffset;
272 newFace[3] =
f[0] + nextLayerOffset;
279 mesh_.faceOwner()[facei] +
offset,
288 Info<< newFace <<
" "
289 << mesh_.faceOwner()[facei] +
offset <<
" "
299 forAll(mesh_.cells(), celli)
301 const cell& cFaces = mesh_.cells()[celli];
303 face frontFace(cFaces.size());
306 label nextFacei = cFaces[0];
308 const face&
f = faces[nextFacei];
311 if (mesh_.faceOwner()[nextFacei] == celli)
323 for (
label i = 1; i < frontFace.size(); i++)
325 frontFace[i] = nextPointi;
330 label facei = cFaces[cFacei];
331 if (facei != nextFacei)
333 const face&
f = faces[facei];
335 if (
f[0] == nextPointi)
341 else if (
f[1] == nextPointi)
351 for (
label layer = 0; layer < nLayers - 1; ++layer)
356 frontFace[fp] += mesh_.nPoints();
362 if (layer != nLayers - 1)
364 nei = celli +
offset + mesh_.nCells();
379 Info<< frontFace <<
" "
391 forAll(mesh_.cells(), celli)
393 const cell& cFaces = mesh_.cells()[celli];
395 face frontFace(cFaces.size());
398 label nextFacei = cFaces[0];
400 const face&
f = faces[nextFacei];
403 if (mesh_.faceOwner()[nextFacei] == celli)
415 for (
label i = 1; i < frontFace.size(); i++)
417 frontFace[i] = nextPointi;
422 label facei = cFaces[cFacei];
423 if (facei != nextFacei)
425 const face&
f = faces[facei];
427 if (
f[0] == nextPointi)
433 else if (
f[1] == nextPointi)
446 frontFace.reverseFace(),
456 Info<<
nl<<frontFace.reverseFace() <<
" "
465 frontFace[fp] += mesh_.nPoints()* (nLayers);
482 Info<< frontFace <<
" "
494 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.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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)