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])()];
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< labelList > labelListList
List of labelList.
static const unsigned facesPerPoint_
Estimated number of faces per point.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< face > faceList
List of faces.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
label index() const
The index of the first matching items, -1 if no matches.
int debug
Static debugging option.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
const word & name() const
Return name of this modifier.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
List< label > labelList
A List of labels.
const polyMesh & mesh() const
Return the mesh reference.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.