40 const Foam::scalar Foam::attachDetach::positionDifference_ = 1
e-8;
44 void Foam::attachDetach::attachInterface
64 Pout<<
"void attachDetach::attachInterface("
65 <<
"polyTopoChange& ref) const "
66 <<
" for object " <<
name() <<
" : "
67 <<
"Attaching interface" <<
endl;
75 const polyPatch& masterPatch =
mesh.boundaryMesh()[masterPatchID_.
index()];
76 const polyPatch& slavePatch =
mesh.boundaryMesh()[slavePatchID_.
index()];
78 const label masterPatchStart = masterPatch.start();
79 const label slavePatchStart = slavePatch.start();
81 const labelList& slaveMeshPoints = slavePatch.meshPoints();
83 const Map<label>& removedPointMap = pointMatchMap();
85 const labelList removedPoints = removedPointMap.toc();
87 forAll(removedPoints, pointi)
93 ref.setAction(polyRemovePoint(removedPoints[pointi]));
109 ref.setAction(polyRemoveFace(i + slavePatchStart));
113 const labelList& masterFaceCells = masterPatch.faceCells();
114 const labelList& slaveFaceCells = slavePatch.faceCells();
119 bitSet faceModified(
mesh.nFaces());
121 forAll(masterFaceCells, facei)
125 if (masterFaceCells[facei] < slaveFaceCells[facei])
131 faces[masterPatchStart + facei],
132 masterPatchStart + facei,
133 masterFaceCells[facei],
134 slaveFaceCells[facei],
150 faces[masterPatchStart + facei].reverseFace(),
151 masterPatchStart + facei,
152 slaveFaceCells[facei],
153 masterFaceCells[facei],
162 faceModified[masterPatchStart + facei] =
true;
177 forAll(slaveMeshPoints, pointi)
179 const labelList& curFaces = pf[slaveMeshPoints[pointi]];
185 !
ref.faceRemoved(curFaces[facei])
186 && !faceModified[curFaces[facei]]
189 facesToModifyMap.insert(curFaces[facei]);
195 const labelList ftm = facesToModifyMap.toc();
202 label curFaceID = ftm[facei];
204 face newFace(faces[curFaceID]);
208 const auto rpmIter = removedPointMap.cfind(newFace[pointi]);
213 newFace[pointi] = rpmIter();
223 label modifiedFaceZone =
mesh.faceZones().whichZone(curFaceID);
224 bool modifiedFaceZoneFlip =
false;
226 if (modifiedFaceZone >= 0)
228 modifiedFaceZoneFlip =
229 mesh.faceZones()[modifiedFaceZone].flipMap()
231 mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
236 const label
patchID =
mesh.boundaryMesh().whichPatch(curFaceID);
240 neiCell = nei[curFaceID];
268 Pout<<
"void attachDetach::attachInterface("
269 <<
"polyTopoChange& ref) const "
270 <<
" for object " <<
name() <<
" : "
271 <<
"Finished attaching interface" <<
endl;
281 const Map<label>& removedPointMap = pointMatchMap();
283 const labelList removedPoints = removedPointMap.toc();
287 Pout<<
"void attachDetach::modifyMotionPoints("
288 <<
"pointField& motionPoints) const "
289 <<
" for object " <<
name() <<
" : "
290 <<
"Adjusting motion points." <<
endl;
293 scalar pointDiff = 0;
295 forAll(removedPoints, pointi)
300 motionPoints[removedPoints[pointi]]
301 - motionPoints[removedPointMap.find(removedPoints[pointi])()]
305 if (pointDiff > removedPoints.size()*positionDifference_)
307 Pout<<
"Point motion difference = " << pointDiff <<
endl;
312 forAll(removedPoints, pointi)
314 motionPoints[removedPoints[pointi]] =
315 motionPoints[removedPointMap.find(removedPoints[pointi])()];