37 const Foam::scalar Foam::attachDetach::positionDifference_ = 1
e-8;
41 void Foam::attachDetach::attachInterface
61 Pout<<
"void attachDetach::attachInterface("
62 <<
"polyTopoChange& ref) const "
63 <<
" for object " <<
name() <<
" : "
64 <<
"Attaching interface" <<
endl;
68 const faceList& faces = mesh.faces();
70 const labelList& nei = mesh.faceNeighbour();
72 const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchID_.
index()];
73 const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchID_.
index()];
75 const label masterPatchStart = masterPatch.start();
76 const label slavePatchStart = slavePatch.start();
78 const labelList& slaveMeshPoints = slavePatch.meshPoints();
80 const Map<label>& removedPointMap = pointMatchMap();
82 const labelList removedPoints = removedPointMap.toc();
84 forAll (removedPoints, pointI)
86 ref.setAction(polyRemovePoint(removedPoints[pointI]));
91 for (label i = 0; i < slavePatch.size(); i++)
93 ref.setAction(polyRemoveFace(i + slavePatchStart));
98 const labelList& masterFaceCells = masterPatch.faceCells();
99 const labelList& slaveFaceCells = slavePatch.faceCells();
101 const boolList& mfFlip = mesh.faceZones()[faceZoneID_.
index()].flipMap();
103 forAll (masterFaceCells, faceI)
107 if (masterFaceCells[faceI] < slaveFaceCells[faceI])
113 faces[masterPatchStart + faceI],
114 masterPatchStart + faceI,
115 masterFaceCells[faceI],
116 slaveFaceCells[faceI],
132 faces[masterPatchStart + faceI].reverseFace(),
133 masterPatchStart + faceI,
134 slaveFaceCells[faceI],
135 masterFaceCells[faceI],
158 forAll (slaveMeshPoints, pointI)
160 const labelList& curFaces = pf[slaveMeshPoints[pointI]];
164 if (!ref.faceRemoved(curFaces[faceI]))
166 facesToModifyMap.insert(curFaces[faceI]);
172 const labelList ftm = facesToModifyMap.toc();
179 label curFaceID = ftm[faceI];
181 face newFace(faces[curFaceID]);
186 removedPointMap.
find(newFace[pointI]);
188 if (rpmIter != removedPointMap.end())
191 newFace[pointI] = rpmIter();
198 label modifiedFaceZone = mesh.faceZones().whichZone(curFaceID);
199 bool modifiedFaceZoneFlip =
false;
201 if (modifiedFaceZone >= 0)
203 modifiedFaceZoneFlip =
204 mesh.faceZones()[modifiedFaceZone].flipMap()
206 mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
211 label patchID = mesh.boundaryMesh().whichPatch(curFaceID);
215 neiCell = nei[curFaceID];
243 Pout<<
"void attachDetach::attachInterface("
244 <<
"polyTopoChange& ref) const "
245 <<
" for object " <<
name() <<
" : "
246 <<
"Finished attaching interface" <<
endl;
256 const Map<label>& removedPointMap = pointMatchMap();
262 Pout<<
"void attachDetach::modifyMotionPoints("
263 <<
"pointField& motionPoints) const "
264 <<
" for object " <<
name() <<
" : "
265 <<
"Adjusting motion points." <<
endl;
268 scalar pointDiff = 0;
270 forAll (removedPoints, pointI)
275 motionPoints[removedPoints[pointI]]
276 - motionPoints[removedPointMap.
find(removedPoints[pointI])()]
280 if (pointDiff > removedPoints.
size()*positionDifference_)
282 Pout<<
"Point motion difference = " << pointDiff <<
endl;
287 forAll (removedPoints, pointI)
289 motionPoints[removedPoints[pointI]] =
290 motionPoints[removedPointMap.
find(removedPoints[pointI])()];