35 mirrorMeshDict_(dictIO)
37 plane mirrorPlane(mirrorMeshDict_);
41 mirrorMeshDict_.lookup<scalar>(
"planeTolerance")
47 const label nOldInternalFaces = nInternalFaces();
51 Info<<
"Mirroring points. Old points: " << oldPoints.size();
56 labelList mirrorPointLookup(oldPoints.size(), -1);
61 newPoints[nNewPoints] = oldPoints[pointi];
68 mirrorPlane.normalIntersect
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;
258 const label curPatchSize = boundaryMesh()[
patchi].size();
259 const label curPatchStart = boundaryMesh()[
patchi].start();
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(),
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label)
Reset size of List.
mirrorFvMesh(const IOobject &io, const IOobject &dictIO)
Construct from IOobject.
~mirrorFvMesh()
Destructor.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar e
Elementary charge.
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.
List< cell > cellList
list of cells
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
List< labelList > labelListList
A List of labelList.
dimensioned< scalar > mag(const dimensioned< Type > &)
List< List< bool > > boolListList
PtrList< polyPatch > polyPatchList
container classes for polyPatch
UList< label > labelUList
faceListList boundary(nPatches)