1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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
176 virtual ~attachDetach();
181 //- Return master patch ID
182 const polyPatchID& masterPatchID() const
184 return masterPatchID_;
187 //- Return slave patch ID
188 const polyPatchID& slavePatchID() const
190 return slavePatchID_;
193 //- Is the interface attached?
194 bool attached() const
196 return state_ == ATTACHED;
199 const Switch& manualTrigger() const
201 return manualTrigger_;
204 // Manually set attach. Use only with manual trigger
205 bool setAttach() const;
207 // Manually set detach. Use only with manual trigger
208 bool setDetach() const;
210 //- Check for topology change
211 virtual bool changeTopology() const;
213 //- Insert the layer addition/removal instructions
214 // into the topological change
215 virtual void setRefinement(polyTopoChange&) const;
217 //- Modify motion points to comply with the topological change
218 virtual void modifyMotionPoints(pointField& motionPoints) const;
220 //- Force recalculation of locally stored data on topological change
221 virtual void updateMesh(const mapPolyMesh&);
223 //- Get reference to trigger times
224 const scalarField& triggerTimes() const
226 return triggerTimes_;
231 virtual void write(Ostream&) const;
234 virtual void writeDict(Ostream&) const;
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 } // End namespace Foam
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 // ************************************************************************* //