1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Attach/detach boundary mesh modifier. This modifier takes a set of
29 internal faces and converts them into boundary faces and vice versa
30 based on the given activation switch.
32 The patch is oriented using the flip map in the face zone. The
33 oriented faces are put into the master patch and their mirror
34 images into the slave.
40 attachDetachPointMatchMap.C
42 \*---------------------------------------------------------------------------*/
44 #ifndef attachDetach_H
45 #define attachDetach_H
47 #include "polyMeshModifier.H"
48 #include "polyPatchID.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 /*---------------------------------------------------------------------------*\
57 Class attachDetach Declaration
58 \*---------------------------------------------------------------------------*/
62 public polyMeshModifier
66 //- State of the modifier
77 //- Master face zone ID
78 faceZoneID faceZoneID_;
80 //- Master patch ID. Holds faces with original orientation
81 polyPatchID masterPatchID_;
83 //- Slave patch ID. Holds mirrored faces
84 polyPatchID slavePatchID_;
86 //- List of trigger times
87 scalarField triggerTimes_;
89 //- Use manual trigger
90 Switch manualTrigger_;
92 //- Trigger time index
93 mutable label triggerIndex_;
95 //- State of the modifier
96 mutable modifierState state_;
98 //- Attach/detach trigger
99 mutable bool trigger_;
102 // Private addressing data. Created on topology change
104 //- Map of matching points
105 mutable Map<label>* pointMatchMapPtr_;
108 // Private Member Functions
110 //- Disallow default bitwise copy construct
111 attachDetach(const attachDetach&);
113 //- Disallow default bitwise assignment
114 void operator=(const attachDetach&);
116 //- Check validity of construction data
117 void checkDefinition();
119 // Topological changes
122 void attachInterface(polyTopoChange&) const;
125 void detachInterface(polyTopoChange&) const;
127 //- Calculate point match addressing
128 void calcPointMatchMap() const;
130 //- Return point match map
131 const Map<label>& pointMatchMap() const;
134 void clearAddressing() const;
137 // Static data members
139 //- Relative vertex position tolerance
140 static const scalar positionDifference_;
145 //- Runtime type information
146 TypeName("attachDetach");
151 //- Construct from components
156 const polyTopoChanger& mme,
157 const word& faceZoneName,
158 const word& masterPatchName,
159 const word& slavePatchName,
160 const scalarField& triggerTimes,
161 const bool manualTrigger = false
164 //- Construct from dictionary
168 const dictionary& dict,
170 const polyTopoChanger& mesh
175 virtual ~attachDetach();
180 //- Return master patch ID
181 const polyPatchID& masterPatchID() const
183 return masterPatchID_;
186 //- Return slave patch ID
187 const polyPatchID& slavePatchID() const
189 return slavePatchID_;
192 //- Is the interface attached?
193 bool attached() const
195 return state_ == ATTACHED;
198 const Switch& manualTrigger() const
200 return manualTrigger_;
203 // Manually set attach. Use only with manual trigger
204 bool setAttach() const;
206 // Manually set detach. Use only with manual trigger
207 bool setDetach() const;
209 //- Check for topology change
210 virtual bool changeTopology() const;
212 //- Insert the layer addition/removal instructions
213 // into the topological change
214 virtual void setRefinement(polyTopoChange&) const;
216 //- Modify motion points to comply with the topological change
217 virtual void modifyMotionPoints(pointField& motionPoints) const;
219 //- Force recalculation of locally stored data on topological change
220 virtual void updateMesh(const mapPolyMesh&);
222 //- Get reference to trigger times
223 const scalarField& triggerTimes() const
225 return triggerTimes_;
230 virtual void write(Ostream&) const;
233 virtual void writeDict(Ostream&) const;
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 } // End namespace Foam
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 // ************************************************************************* //