|
|
|
attachDetach.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2007 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 /*---------------------------------------------------------------------------*\ 00058 Class attachDetach Declaration 00059 \*---------------------------------------------------------------------------*/ 00060 00061 class attachDetach 00062 : 00063 public polyMeshModifier 00064 { 00065 // Data types 00066 00067 //- State of the modifier 00068 enum modifierState 00069 { 00070 UNKNOWN, 00071 ATTACHED, 00072 DETACHED 00073 }; 00074 00075 00076 // Private data 00077 00078 //- Master face zone ID 00079 faceZoneID faceZoneID_; 00080 00081 //- Master patch ID. Holds faces with original orientation 00082 polyPatchID masterPatchID_; 00083 00084 //- Slave patch ID. Holds mirrored faces 00085 polyPatchID slavePatchID_; 00086 00087 //- List of trigger times 00088 scalarField triggerTimes_; 00089 00090 //- Use manual trigger 00091 Switch manualTrigger_; 00092 00093 //- Trigger time index 00094 mutable label triggerIndex_; 00095 00096 //- State of the modifier 00097 mutable modifierState state_; 00098 00099 //- Attach/detach trigger 00100 mutable bool trigger_; 00101 00102 00103 // Private addressing data. Created on topology change 00104 00105 //- Map of matching points 00106 mutable Map<label>* pointMatchMapPtr_; 00107 00108 00109 // Private Member Functions 00110 00111 //- Disallow default bitwise copy construct 00112 attachDetach(const attachDetach&); 00113 00114 //- Disallow default bitwise assignment 00115 void operator=(const attachDetach&); 00116 00117 //- Check validity of construction data 00118 void checkDefinition(); 00119 00120 // Topological changes 00121 00122 //- Attach interface 00123 void attachInterface(polyTopoChange&) const; 00124 00125 //- Detach interface 00126 void detachInterface(polyTopoChange&) const; 00127 00128 //- Calculate point match addressing 00129 void calcPointMatchMap() const; 00130 00131 //- Return point match map 00132 const Map<label>& pointMatchMap() const; 00133 00134 //- Clear addressing 00135 void clearAddressing() const; 00136 00137 00138 // Static data members 00139 00140 //- Relative vertex position tolerance 00141 static const scalar positionDifference_; 00142 00143 00144 public: 00145 00146 //- Runtime type information 00147 TypeName("attachDetach"); 00148 00149 00150 // Constructors 00151 00152 //- Construct from components 00153 attachDetach 00154 ( 00155 const word& name, 00156 const label index, 00157 const polyTopoChanger& mme, 00158 const word& faceZoneName, 00159 const word& masterPatchName, 00160 const word& slavePatchName, 00161 const scalarField& triggerTimes, 00162 const bool manualTrigger = false 00163 ); 00164 00165 //- Construct from dictionary 00166 attachDetach 00167 ( 00168 const word& name, 00169 const dictionary& dict, 00170 const label index, 00171 const polyTopoChanger& mesh 00172 ); 00173 00174 00175 // Destructor 00176 00177 virtual ~attachDetach(); 00178 00179 00180 // Member Functions 00181 00182 //- Return master patch ID 00183 const polyPatchID& masterPatchID() const 00184 { 00185 return masterPatchID_; 00186 } 00187 00188 //- Return slave patch ID 00189 const polyPatchID& slavePatchID() const 00190 { 00191 return slavePatchID_; 00192 } 00193 00194 //- Is the interface attached? 00195 bool attached() const 00196 { 00197 return state_ == ATTACHED; 00198 } 00199 00200 const Switch& manualTrigger() const 00201 { 00202 return manualTrigger_; 00203 } 00204 00205 // Manually set attach. Use only with manual trigger 00206 bool setAttach() const; 00207 00208 // Manually set detach. Use only with manual trigger 00209 bool setDetach() const; 00210 00211 //- Check for topology change 00212 virtual bool changeTopology() const; 00213 00214 //- Insert the layer addition/removal instructions 00215 // into the topological change 00216 virtual void setRefinement(polyTopoChange&) const; 00217 00218 //- Modify motion points to comply with the topological change 00219 virtual void modifyMotionPoints(pointField& motionPoints) const; 00220 00221 //- Force recalculation of locally stored data on topological change 00222 virtual void updateMesh(const mapPolyMesh&); 00223 00224 //- Get reference to trigger times 00225 const scalarField& triggerTimes() const 00226 { 00227 return triggerTimes_; 00228 } 00229 00230 00231 //- Write 00232 virtual void write(Ostream&) const; 00233 00234 //- Write dictionary 00235 virtual void writeDict(Ostream&) const; 00236 }; 00237 00238 00239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00240 00241 } // End namespace Foam 00242 00243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00244 00245 #endif 00246 00247 // ************************************************************************* // |