55 void Foam::attachDetach::checkDefinition()
60 || !masterPatchID_.active()
61 || !slavePatchID_.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." 72 const polyMesh& mesh = topoChanger().mesh();
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." 111 const labelList& addr = mesh.faceZones()[faceZoneID_.index()];
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()
179 const labelList& addr = mesh.faceZones()[faceZoneID_.index()];
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]);
224 || (triggerTimes_.empty() && !manualTrigger())
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()
const faceZoneMesh & faceZones() const
Return face zone mesh.
virtual void writeDict(Ostream &) const
Write dictionary.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
word name(const complex &)
Return a string representation of a complex.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Virtual base class for mesh modifiers.
void deleteDemandDrivenData(DataPtr &dataPtr)
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool changeTopology() const
Check for topology change.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
const polyMesh & mesh() const
Return the mesh reference.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
virtual ~attachDetach()
Destructor.
Macros for easy insertion into run-time selection tables.
List of mesh modifiers defining the mesh dynamics.
errorManip< error > abort(error &err)
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
List< label > labelList
A List of labels.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Direct mesh changes based on v1.3 polyTopoChange syntax.
virtual void write(Ostream &) const
Write.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")