55 void Foam::attachDetach::checkDefinition()
60 || !masterPatchID_.
active()
66 "void Foam::attachDetach::checkDefinition()"
67 ) <<
"Not all zones and patches needed in the definition "
68 <<
"have been found. Please check your mesh definition."
76 Pout<<
"Attach/detach object " <<
name() <<
" :" <<
nl
77 <<
" faceZoneID: " << faceZoneID_ <<
nl
78 <<
" masterPatchID: " << masterPatchID_ <<
nl
79 <<
" slavePatchID: " << slavePatchID_ <<
endl;
85 mesh.boundaryMesh()[masterPatchID_.
index()].empty()
86 && mesh.boundaryMesh()[slavePatchID_.
index()].empty()
92 Pout<<
" Attached on construction" <<
endl;
98 if (mesh.faceZones()[faceZoneID_.
index()].empty())
102 "void Foam::attachDetach::checkDefinition()"
103 ) <<
"Attach/detach zone contains no faces. Please check your "
104 <<
"mesh definition."
113 DynamicList<label> bouFacesInZone(addr.size());
117 if (!mesh.isInternalFace(addr[faceI]))
119 bouFacesInZone.append(addr[faceI]);
123 if (bouFacesInZone.size())
127 "void Foam::attachDetach::checkDefinition()"
128 ) <<
"Found boundary faces in the zone defining "
129 <<
"attach/detach boundary "
130 <<
" for object " <<
name()
131 <<
" : . This is not allowed." <<
nl
132 <<
"Boundary faces: " << bouFacesInZone
142 Pout<<
" Detached on construction" <<
endl;
152 mesh.boundaryMesh()[masterPatchID_.
index()].size()
153 != mesh.boundaryMesh()[slavePatchID_.
index()].size()
156 mesh.boundaryMesh()[masterPatchID_.
index()].size()
157 != mesh.faceZones()[faceZoneID_.
index()].size()
163 "void Foam::attachDetach::checkDefinition()"
164 ) <<
"Problem with sizes in mesh modifier. The face zone,"
165 <<
" master and slave patch should have the same size"
166 <<
" for object " <<
name() <<
". " <<
nl
168 << mesh.faceZones()[faceZoneID_.
index()].size()
169 <<
" Master patch size: "
170 << mesh.boundaryMesh()[masterPatchID_.
index()].size()
171 <<
" Slave patch size: "
172 << mesh.boundaryMesh()[slavePatchID_.
index()].size()
181 DynamicList<label> zoneProblemFaces(addr.size());
186 mesh.boundaryMesh().whichPatch(addr[faceI]);
190 facePatch != masterPatchID_.
index()
191 && facePatch != slavePatchID_.
index()
194 zoneProblemFaces.append(addr[faceI]);
198 if (zoneProblemFaces.size())
202 "void Foam::attachDetach::checkDefinition()"
203 ) <<
"Found faces in the zone defining "
204 <<
"attach/detach boundary which do not belong to "
205 <<
"either master or slave patch. "
206 <<
"This is not allowed." <<
nl
207 <<
"Problem faces: " << zoneProblemFaces
214 bool triggersOK =
true;
216 for (label i = 0; i < triggerTimes_.
size() - 1; i++)
218 triggersOK = triggersOK && (triggerTimes_[i] < triggerTimes_[i + 1]);
229 "void Foam::attachDetach::checkDefinition()"
230 ) <<
"Problem with definition of trigger times: "
237 void Foam::attachDetach::clearAddressing()
const
246 Foam::attachDetach::attachDetach
251 const word& faceZoneName,
252 const word& masterPatchName,
253 const word& slavePatchName,
255 const bool manualTrigger
262 triggerTimes_(triggerTimes),
263 manualTrigger_(manualTrigger),
267 pointMatchMapPtr_(NULL)
274 Foam::attachDetach::attachDetach
285 dict.
lookup(
"faceZoneName"),
290 dict.
lookup(
"masterPatchName"),
295 dict.
lookup(
"slavePatchName"),
298 triggerTimes_(dict.
lookup(
"triggerTimes")),
299 manualTrigger_(dict.
lookup(
"manualTrigger")),
303 pointMatchMapPtr_(NULL)
355 Pout<<
"bool attachDetach::changeTopology() const "
356 <<
" for object " <<
name() <<
" : "
357 <<
"Manual trigger" <<
endl;
369 Pout<<
"bool attachDetach::changeTopology() const "
370 <<
" for object " <<
name() <<
" : "
371 <<
"Already triggered for current time step" <<
endl;
379 if (triggerIndex_ >= triggerTimes_.size())
383 Pout<<
"bool attachDetach::changeTopology() const "
384 <<
" for object " <<
name() <<
" : "
385 <<
"Reached end of trigger list" <<
endl;
392 Pout<<
"bool attachDetach::changeTopology() const "
393 <<
" for object " <<
name() <<
" : "
394 <<
"Triggering attach/detach topology change." <<
nl
395 <<
"Current time: " << topoChanger().mesh().time().value()
396 <<
" current trigger time: " << triggerTimes_[triggerIndex_]
397 <<
" trigger index: " << triggerIndex_ <<
endl;
402 if (topoChanger().
mesh().time().value() >= triggerTimes_[triggerIndex_])
426 if (state_ == ATTACHED)
428 detachInterface(ref);
433 else if (state_ == DETACHED)
435 attachInterface(ref);
444 "void attachDetach::setRefinement(polyTopoChange&) const"
445 ) <<
"Requested attach/detach event and currect state "
458 const polyMesh& mesh = topoChanger().mesh();
472 << faceZoneID_.name() <<
nl
473 << masterPatchID_.name() <<
nl
474 << slavePatchID_.name() <<
nl
475 << triggerTimes_ <<
endl;
482 <<
" type " <<
type()
484 <<
" faceZoneName " << faceZoneID_.name()
486 <<
" masterPatchName " << masterPatchID_.name()
488 <<
" slavePatchName " << slavePatchID_.name()
490 <<
" triggerTimes " << triggerTimes_
492 <<
" manualTrigger " << manualTrigger()
494 <<
" active " << active()