35 mirrorMeshDict_(dictIO)
37 plane mirrorPlane(mirrorMeshDict_);
41 mirrorMeshDict_.lookup<scalar>(
"planeTolerance")
51 Info<<
"Mirroring points. Old points: " << oldPoints.size();
56 labelList mirrorPointLookup(oldPoints.size(), -1);
61 newPoints[nNewPoints] = oldPoints[pointi];
68 mirrorPlane.normalIntersect
75 if (
mag(alpha) > planeTolerance)
78 newPoints[nNewPoints] =
79 oldPoints[pointi] + 2.0*alpha*mirrorPlane.normal();
82 mirrorPointLookup[pointi] = nNewPoints;
89 newPoints[nNewPoints] =
90 oldPoints[pointi] + alpha*mirrorPlane.normal();
92 mirrorPointLookup[pointi] = pointi;
97 Info<<
" New points: " << nNewPoints <<
endl;
98 newPoints.setSize(nNewPoints);
101 pointMapPtr_.reset(
new labelList(newPoints.size()));
104 forAll(oldPoints, oldPointi)
106 pointMap[oldPointi] = oldPointi;
108 forAll(mirrorPointLookup, oldPointi)
110 pointMap[mirrorPointLookup[oldPointi]] = oldPointi;
115 Info<<
"Mirroring faces. Old faces: " << oldFaces.size();
135 const labelUList& oldOwnerStart = lduAddr().ownerStartAddr();
137 forAll(newCellFaces, celli)
139 labelList& curFaces = newCellFaces[celli];
141 const label s = oldOwnerStart[celli];
142 const label e = oldOwnerStart[celli + 1];
144 curFaces.setSize(e - s);
158 const polyPatch& curPatch = oldPatches[
patchi];
160 if (curPatch.coupled())
163 <<
"Found coupled patch " << curPatch.name() << endl
164 <<
" Mirroring faces on coupled patches destroys" 165 <<
" the ordering. This might be fixed by running a dummy" 166 <<
" createPatch afterwards." <<
endl;
171 curInsBouFace.
setSize(curPatch.size());
172 curInsBouFace =
false;
175 const labelUList& curFaceCells = curPatch.faceCells();
176 const label curStart = curPatch.start();
183 const face& origFace = curPatch[facei];
185 face mirrorFace(origFace.size());
186 forAll(mirrorFace, pointi)
188 mirrorFace[pointi] = mirrorPointLookup[origFace[pointi]];
191 if (origFace == mirrorFace)
195 const label oldSize = newCellFaces[curFaceCells[facei]].size();
197 newCellFaces[curFaceCells[facei]].setSize(oldSize + 1);
198 newCellFaces[curFaceCells[facei]][oldSize] = curStart + facei;
200 curInsBouFace[facei] =
true;
210 labelList masterFaceLookup(oldFaces.size(), -1);
211 labelList mirrorFaceLookup(oldFaces.size(), -1);
213 faceList newFaces(2*oldFaces.size());
217 forAll(newCellFaces, celli)
219 const labelList& curCellFaces = newCellFaces[celli];
223 newFaces[nNewFaces] = oldFaces[curCellFaces[cfI]];
224 masterFaceLookup[curCellFaces[cfI]] = nNewFaces;
231 for (
label facei = 0; facei < nOldInternalFaces; facei++)
233 const face& oldFace = oldFaces[facei];
234 face& nf = newFaces[nNewFaces];
235 nf.setSize(oldFace.size());
237 nf[0] = mirrorPointLookup[oldFace[0]];
239 for (
label i = 1; i < oldFace.size(); i++)
241 nf[i] = mirrorPointLookup[oldFace[oldFace.size() - i]];
244 mirrorFaceLookup[facei] = nNewFaces;
254 label nNewPatches = 0;
262 newPatchStarts[nNewPatches] = nNewFaces;
265 for (
label facei = 0; facei < curPatchSize; facei++)
269 if (!curInserted[facei])
271 newFaces[nNewFaces] = oldFaces[curPatchStart + facei];
273 masterFaceLookup[curPatchStart + facei] = nNewFaces;
279 for (
label facei = 0; facei < curPatchSize; facei++)
283 if (!curInserted[facei])
285 const face& oldFace = oldFaces[curPatchStart + facei];
286 face& nf = newFaces[nNewFaces];
289 nf[0] = mirrorPointLookup[oldFace[0]];
291 for (
label i = 1; i < oldFace.size(); i++)
293 nf[i] = mirrorPointLookup[oldFace[oldFace.size() - i]];
296 mirrorFaceLookup[curPatchStart + facei] = nNewFaces;
302 mirrorFaceLookup[curPatchStart + facei] =
303 masterFaceLookup[curPatchStart + facei];
308 if (nNewFaces > newPatchStarts[nNewPatches])
310 newToOldPatch[nNewPatches] =
patchi;
312 newPatchSizes[nNewPatches] =
313 nNewFaces - newPatchStarts[nNewPatches];
320 newFaces.setSize(nNewFaces);
321 Info<<
" New faces: " << nNewFaces <<
endl;
323 newToOldPatch.setSize(nNewPatches);
324 newPatchSizes.setSize(nNewPatches);
325 newPatchStarts.setSize(nNewPatches);
327 Info<<
"Mirroring patches. Old patches: " <<
boundary().size()
328 <<
" New patches: " << nNewPatches <<
endl;
330 Info<<
"Mirroring cells. Old cells: " << oldCells.size()
331 <<
" New cells: " << 2*oldCells.size() <<
endl;
333 cellList newCells(2*oldCells.size());
337 cellMapPtr_.reset(
new labelList(newCells.size()));
343 const cell& oc = oldCells[celli];
345 cell& nc = newCells[nNewCells];
346 nc.setSize(oc.size());
350 nc[i] = masterFaceLookup[oc[i]];
353 cellMap[nNewCells] = celli;
361 const cell& oc = oldCells[celli];
363 cell& nc = newCells[nNewCells];
364 nc.setSize(oc.size());
368 nc[i] = mirrorFaceLookup[oc[i]];
371 cellMap[nNewCells] = celli;
377 Info<<
"Mirroring cell shapes." <<
endl;
385 std::move(newPoints),
391 fvMesh& pMesh = mirrorMeshPtr_();
394 List<polyPatch*>
p(newPatchSizes.size());
400 pMesh.boundaryMesh(),
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
PtrList< polyPatch > polyPatchList
container classes for polyPatch
List< labelList > labelListList
A List of labelList.
autoPtr< IOobject > clone() const
Clone.
#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.
List< List< bool > > boolListList
label nInternalFaces() const
mirrorFvMesh(const IOobject &io, const IOobject &dictIO)
Construct from IOobject.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
label size() const
Return number of elements in table.
UList< label > labelUList
virtual const pointField & points() const
Return raw points.
List< bool > boolList
Bool container classes.
vectorField pointField
pointField is a vectorField.
List< label > labelList
A List of labels.
faceListList boundary(nPatches)
virtual const faceList & faces() const
Return raw faces.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > mag(const dimensioned< Type > &)
List< cell > cellList
list of cells
~mirrorFvMesh()
Destructor.