1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Attach/detach boundary mesh modifier. This modifier takes a set of
30 internal faces and converts them into boundary faces and vice versa
31 based on the given activation switch.
33 The patch is oriented using the flip map in the face zone. The
34 oriented faces are put into the master patch and their mirror
35 images into the slave.
41 attachDetachPointMatchMap.C
43 \*---------------------------------------------------------------------------*/
45 #ifndef attachDetach_H
46 #define attachDetach_H
48 #include "polyMeshModifier.H"
49 #include "polyPatchID.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 /*---------------------------------------------------------------------------*\
58 Class attachDetach Declaration
59 \*---------------------------------------------------------------------------*/
63 public polyMeshModifier
67 //- State of the modifier
78 //- Master face zone ID
79 faceZoneID faceZoneID_;
81 //- Master patch ID. Holds faces with original orientation
82 polyPatchID masterPatchID_;
84 //- Slave patch ID. Holds mirrored faces
85 polyPatchID slavePatchID_;
87 //- List of trigger times
88 scalarField triggerTimes_;
90 //- Use manual trigger
91 Switch manualTrigger_;
93 //- Trigger time index
94 mutable label triggerIndex_;
96 //- State of the modifier
97 mutable modifierState state_;
99 //- Attach/detach trigger
100 mutable bool trigger_;
103 // Private addressing data. Created on topology change
105 //- Map of matching points
106 mutable Map<label>* pointMatchMapPtr_;
109 // Private Member Functions
111 //- Disallow default bitwise copy construct
112 attachDetach(const attachDetach&);
114 //- Disallow default bitwise assignment
115 void operator=(const attachDetach&);
117 //- Check validity of construction data
118 void checkDefinition();
120 // Topological changes
123 void attachInterface(polyTopoChange&) const;
126 void detachInterface(polyTopoChange&) const;
128 //- Calculate point match addressing
129 void calcPointMatchMap() const;
131 //- Return point match map
132 const Map<label>& pointMatchMap() const;
135 void clearAddressing() const;
138 // Static data members
140 //- Relative vertex position tolerance
141 static const scalar positionDifference_;
146 //- Runtime type information
147 TypeName("attachDetach");
152 //- Construct from components
157 const polyTopoChanger& mme,
158 const word& faceZoneName,
159 const word& masterPatchName,
160 const word& slavePatchName,
161 const scalarField& triggerTimes,
162 const bool manualTrigger = false
165 //- Construct from dictionary
169 const dictionary& dict,
171 const polyTopoChanger& mesh
177 virtual ~attachDetach();
182 //- Return master patch ID
183 const polyPatchID& masterPatchID() const
185 return masterPatchID_;
188 //- Return slave patch ID
189 const polyPatchID& slavePatchID() const
191 return slavePatchID_;
194 //- Is the interface attached?
195 bool attached() const
197 return state_ == ATTACHED;
200 const Switch& manualTrigger() const
202 return manualTrigger_;
205 // Manually set attach. Use only with manual trigger
206 bool setAttach() const;
208 // Manually set detach. Use only with manual trigger
209 bool setDetach() const;
211 //- Check for topology change
212 virtual bool changeTopology() const;
214 //- Insert the layer addition/removal instructions
215 // into the topological change
216 virtual void setRefinement(polyTopoChange&) const;
218 //- Modify motion points to comply with the topological change
219 virtual void modifyMotionPoints(pointField& motionPoints) const;
221 //- Force recalculation of locally stored data on topological change
222 virtual void updateMesh(const mapPolyMesh&);
224 //- Get reference to trigger times
225 const scalarField& triggerTimes() const
227 return triggerTimes_;
232 virtual void write(Ostream&) const;
235 virtual void writeDict(Ostream&) const;
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 } // End namespace Foam
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 // ************************************************************************* //