33 void Foam::slidingInterface::calcAttachedAddressing()
const
37 Pout<<
"void Foam::slidingInterface::calcAttachedAddressing() const "
38 <<
" for object " <<
name() <<
" : "
39 <<
"Calculating zone face-cell addressing."
46 clearAttachedAddressing();
50 const labelList& nei = mesh.faceNeighbour();
56 faceZones[masterFaceZoneID_.
index()]();
59 faceZones[masterFaceZoneID_.
index()];
62 faceZones[masterFaceZoneID_.
index()].flipMap();
64 masterFaceCellsPtr_ =
new labelList(masterPatchFaces.size());
67 forAll(masterPatchFaces, facei)
69 if (masterFlip[facei])
71 mfc[facei] = nei[masterPatchFaces[facei]];
75 mfc[facei] = own[masterPatchFaces[facei]];
82 faceZones[slaveFaceZoneID_.
index()]();
85 faceZones[slaveFaceZoneID_.
index()];
88 faceZones[slaveFaceZoneID_.
index()].flipMap();
90 slaveFaceCellsPtr_ =
new labelList(slavePatchFaces.size());
93 forAll(slavePatchFaces, facei)
97 sfc[facei] = nei[slavePatchFaces[facei]];
101 sfc[facei] = own[slavePatchFaces[facei]];
106 if (
min(mfc) < 0 ||
min(sfc) < 0)
114 Pout<<
"No cell next to master patch face " << facei
115 <<
". Global face no: " << mfc[facei]
116 <<
" own: " << own[masterPatchFaces[facei]]
117 <<
" nei: " << nei[masterPatchFaces[facei]]
118 <<
" flip: " << masterFlip[facei] <<
endl;
126 Pout<<
"No cell next to slave patch face " << facei
127 <<
". Global face no: " << sfc[facei]
128 <<
" own: " << own[slavePatchFaces[facei]]
129 <<
" nei: " << nei[slavePatchFaces[facei]]
130 <<
" flip: " << slaveFlip[facei] <<
endl;
136 <<
"decoupled mesh or sliding interface definition."
149 const labelList& masterMeshPoints = masterPatch.meshPoints();
151 forAll(masterMeshPoints, pointi)
153 const labelList& curFaces = pointFaces[masterMeshPoints[pointi]];
161 faceZones.whichZone(curFaces[facei])
162 != masterFaceZoneID_.
index()
165 masterStickOutFaceMap.insert(curFaces[facei]);
170 masterStickOutFacesPtr_ =
new labelList(masterStickOutFaceMap.toc());
178 const labelList& slaveMeshPoints = slavePatch.meshPoints();
180 forAll(slaveMeshPoints, pointi)
182 const labelList& curFaces = pointFaces[slaveMeshPoints[pointi]];
190 faceZones.whichZone(curFaces[facei])
191 != slaveFaceZoneID_.
index()
194 slaveStickOutFaceMap.insert(curFaces[facei]);
199 slaveStickOutFacesPtr_ =
new labelList(slaveStickOutFaceMap.toc());
204 retiredPointMapPtr_ =
207 2*faceZones[slaveFaceZoneID_.
index()]().nPoints()
212 cutPointEdgePairMapPtr_ =
215 faceZones[slaveFaceZoneID_.
index()]().nEdges()
221 <<
"cannot be assembled for object " <<
name()
227 Pout<<
"void Foam::slidingInterface::calcAttachedAddressing() const "
228 <<
" for object " <<
name() <<
" : "
229 <<
"Finished calculating zone face-cell addressing."
235 void Foam::slidingInterface::clearAttachedAddressing()
const
248 void Foam::slidingInterface::renumberAttachedAddressing
250 const polyTopoChangeMap& m
256 const labelList& reverseCellMap = m.reverseCellMap();
258 const labelList& mfc = masterFaceCells();
266 m.faceZoneFaceMap()[masterFaceZoneID_.index()];
270 label newCelli = reverseCellMap[mfc[mfzRenumber[facei]]];
274 newMfc[facei] = newCelli;
283 m.faceZoneFaceMap()[slaveFaceZoneID_.index()];
287 label newCelli = reverseCellMap[sfc[sfzRenumber[facei]]];
291 newSfc[facei] = newCelli;
298 if (
min(newMfc) < 0 ||
min(newSfc) < 0)
301 <<
"Error in cell renumbering for object " <<
name()
302 <<
". Some of master cells next "
303 <<
"to the interface have been removed."
310 const labelList& reverseFaceMap = m.reverseFaceMap();
313 const labelList& msof = masterStickOutFaces();
320 label newFacei = reverseFaceMap[msof[facei]];
324 newMsof[facei] = newFacei;
329 const labelList& ssof = slaveStickOutFaces();
336 label newFacei = reverseFaceMap[ssof[facei]];
340 newSsof[facei] = newFacei;
347 if (
min(newMsof) < 0 ||
min(newSsof) < 0)
350 <<
"Error in face renumbering for object " <<
name()
351 <<
". Some of stick-out next "
352 <<
"to the interface have been removed."
358 const Map<label> rpm = retiredPointMap();
360 Map<label>* newRpmPtr =
new Map<label>(rpm.size());
361 Map<label>& newRpm = *newRpmPtr;
366 const labelList& reversePointMap = m.reversePointMap();
372 key = reversePointMap[rpmToc[rpmTocI]];
374 value = reversePointMap[rpm.find(rpmToc[rpmTocI])()];
379 if (key < 0 || value < 0)
382 <<
"Error in retired point numbering for object "
383 <<
name() <<
". Some of master "
384 <<
"points have been removed."
389 newRpm.insert(key, value);
393 const Map<Pair<edge>> cpepm = cutPointEdgePairMap();
395 Map<Pair<edge>>* newCpepmPtr =
new Map<Pair<edge>>(cpepm.size());
396 Map<Pair<edge>>& newCpepm = *newCpepmPtr;
400 forAll(cpepmToc, cpepmTocI)
402 key = reversePointMap[cpepmToc[cpepmTocI]];
404 const Pair<edge>& oldPe = cpepm.find(cpepmToc[cpepmTocI])();
407 const label ms = reversePointMap[oldPe.first().start()];
408 const label me = reversePointMap[oldPe.first().end()];
410 const label ss = reversePointMap[oldPe.second().start()];
411 const label se = reversePointMap[oldPe.second().end()];
416 if (key < 0 || ms < 0 ||
me < 0 || ss < 0 || se < 0)
419 <<
"Error in cut point edge pair map numbering for object "
420 <<
name() <<
". Some of master points have been removed."
425 newCpepm.insert(key, Pair<edge>(edge(ms,
me), edge(ss, se)));
428 if (!projectedSlavePointsPtr_)
431 <<
"Error in projected point numbering for object " <<
name()
436 const pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
442 pointField& newProjectedSlavePoints = *newProjectedSlavePointsPtr;
445 m.faceZonePointMap()[slaveFaceZoneID_.index()];
447 forAll(newProjectedSlavePoints, pointi)
449 if (sfzPointRenumber[pointi] > -1)
451 newProjectedSlavePoints[pointi] =
452 projectedSlavePoints[sfzPointRenumber[pointi]];
457 clearAttachedAddressing();
461 masterFaceCellsPtr_ = newMfcPtr;
462 slaveFaceCellsPtr_ = newSfcPtr;
464 masterStickOutFacesPtr_ = newMsofPtr;
465 slaveStickOutFacesPtr_ = newSsofPtr;
467 retiredPointMapPtr_ = newRpmPtr;
468 cutPointEdgePairMapPtr_ = newCpepmPtr;
469 projectedSlavePointsPtr_ = newProjectedSlavePointsPtr;
475 if (!masterFaceCellsPtr_)
478 <<
"Master zone face-cell addressing not available for object "
483 return *masterFaceCellsPtr_;
489 if (!slaveFaceCellsPtr_)
492 <<
"Slave zone face-cell addressing not available for object "
497 return *slaveFaceCellsPtr_;
501 const Foam::labelList& Foam::slidingInterface::masterStickOutFaces()
const
503 if (!masterStickOutFacesPtr_)
506 <<
"Master zone stick-out face addressing not available for object "
511 return *masterStickOutFacesPtr_;
515 const Foam::labelList& Foam::slidingInterface::slaveStickOutFaces()
const
517 if (!slaveStickOutFacesPtr_)
520 <<
"Slave zone stick-out face addressing not available for object "
525 return *slaveStickOutFacesPtr_;
531 if (!retiredPointMapPtr_)
534 <<
"Retired point map not available for object " <<
name()
538 return *retiredPointMapPtr_;
543 Foam::slidingInterface::cutPointEdgePairMap()
const
545 if (!cutPointEdgePairMapPtr_)
548 <<
"Retired point map not available for object " <<
name()
552 return *cutPointEdgePairMapPtr_;
#define forAll(list, i)
Loop across all elements in list.
label index() const
Return index of first matching zone.
A HashTable to objects of type <T> with a label key.
const word & name() const
Return name of this modifier.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
const polyMesh & mesh() const
Return the mesh reference.
static const unsigned facesPerCell_
Estimated number of faces per cell.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar me
Electron mass.
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.
word name(const bool)
Return a word representation of a bool.
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
void deleteDemandDrivenData(DataPtr &dataPtr)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< labelList > labelListList
A List of labelList.
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
Foam::primitiveFacePatch.
MeshZones< faceZone, polyMesh > meshFaceZones
A MeshZones with the type faceZone.