![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 attachDetach 00027 00028 Description 00029 Attach/detach boundary mesh modifier. This modifier takes a set of 00030 internal faces and converts them into boundary faces and vice versa 00031 based on the given activation switch. 00032 00033 The patch is oriented using the flip map in the face zone. The 00034 oriented faces are put into the master patch and their mirror 00035 images into the slave. 00036 00037 SourceFiles 00038 attachDetach.C 00039 attachInterface.C 00040 detachInterface.C 00041 attachDetachPointMatchMap.C 00042 00043 \*---------------------------------------------------------------------------*/ 00044 00045 #ifndef attachDetach_H 00046 #define attachDetach_H 00047 00048 #include "polyMeshModifier.H" 00049 #include "polyPatchID.H" 00050 #include "ZoneIDs.H" 00051 00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00053 00054 namespace Foam 00055 { 00056 00057 // Class forward declarations 00058 00059 /*---------------------------------------------------------------------------*\ 00060 Class attachDetach Declaration 00061 \*---------------------------------------------------------------------------*/ 00062 00063 class attachDetach 00064 : 00065 public polyMeshModifier 00066 { 00067 // Data types 00068 00069 //- State of the modifier 00070 enum modifierState 00071 { 00072 UNKNOWN, 00073 ATTACHED, 00074 DETACHED 00075 }; 00076 00077 00078 // Private data 00079 00080 //- Master face zone ID 00081 faceZoneID faceZoneID_; 00082 00083 //- Master patch ID. Holds faces with original orientation 00084 polyPatchID masterPatchID_; 00085 00086 //- Slave patch ID. Holds mirrored faces 00087 polyPatchID slavePatchID_; 00088 00089 //- List of trigger times 00090 scalarField triggerTimes_; 00091 00092 //- Use manual trigger 00093 Switch manualTrigger_; 00094 00095 //- Trigger time index 00096 mutable label triggerIndex_; 00097 00098 //- State of the modifier 00099 mutable modifierState state_; 00100 00101 //- Attach/detach trigger 00102 mutable bool trigger_; 00103 00104 00105 // Private addressing data. Created on topology change 00106 00107 //- Map of matching points 00108 mutable Map<label>* pointMatchMapPtr_; 00109 00110 00111 // Private Member Functions 00112 00113 //- Disallow default bitwise copy construct 00114 attachDetach(const attachDetach&); 00115 00116 //- Disallow default bitwise assignment 00117 void operator=(const attachDetach&); 00118 00119 //- Check validity of construction data 00120 void checkDefinition(); 00121 00122 // Topological changes 00123 00124 //- Attach interface 00125 void attachInterface(polyTopoChange&) const; 00126 00127 //- Detach interface 00128 void detachInterface(polyTopoChange&) const; 00129 00130 //- Calculate point match addressing 00131 void calcPointMatchMap() const; 00132 00133 //- Return point match map 00134 const Map<label>& pointMatchMap() const; 00135 00136 //- Clear addressing 00137 void clearAddressing() const; 00138 00139 00140 // Static data members 00141 00142 //- Relative vertex position tolerance 00143 static const scalar positionDifference_; 00144 00145 00146 public: 00147 00148 //- Runtime type information 00149 TypeName("attachDetach"); 00150 00151 00152 // Constructors 00153 00154 //- Construct from components 00155 attachDetach 00156 ( 00157 const word& name, 00158 const label index, 00159 const polyTopoChanger& mme, 00160 const word& faceZoneName, 00161 const word& masterPatchName, 00162 const word& slavePatchName, 00163 const scalarField& triggerTimes, 00164 const bool manualTrigger = false 00165 ); 00166 00167 //- Construct from dictionary 00168 attachDetach 00169 ( 00170 const word& name, 00171 const dictionary& dict, 00172 const label index, 00173 const polyTopoChanger& mesh 00174 ); 00175 00176 00177 // Destructor 00178 00179 virtual ~attachDetach(); 00180 00181 00182 // Member Functions 00183 00184 //- Return master patch ID 00185 const polyPatchID& masterPatchID() const 00186 { 00187 return masterPatchID_; 00188 } 00189 00190 //- Return slave patch ID 00191 const polyPatchID& slavePatchID() const 00192 { 00193 return slavePatchID_; 00194 } 00195 00196 //- Is the interface attached? 00197 bool attached() const 00198 { 00199 return state_ == ATTACHED; 00200 } 00201 00202 const Switch& manualTrigger() const 00203 { 00204 return manualTrigger_; 00205 } 00206 00207 // Manually set attach. Use only with manual trigger 00208 bool setAttach() const; 00209 00210 // Manually set detach. Use only with manual trigger 00211 bool setDetach() const; 00212 00213 //- Check for topology change 00214 virtual bool changeTopology() const; 00215 00216 //- Insert the layer addition/removal instructions 00217 // into the topological change 00218 virtual void setRefinement(polyTopoChange&) const; 00219 00220 //- Modify motion points to comply with the topological change 00221 virtual void modifyMotionPoints(pointField& motionPoints) const; 00222 00223 //- Force recalculation of locally stored data on topological change 00224 virtual void updateMesh(const mapPolyMesh&); 00225 00226 //- Get reference to trigger times 00227 const scalarField& triggerTimes() const 00228 { 00229 return triggerTimes_; 00230 } 00231 00232 00233 //- Write 00234 virtual void write(Ostream&) const; 00235 00236 //- Write dictionary 00237 virtual void writeDict(Ostream&) const; 00238 }; 00239 00240 00241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00242 00243 } // End namespace Foam 00244 00245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00246 00247 #endif 00248 00249 // ************************************************************************* //