initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / dynamicMesh / layerAdditionRemoval / layerAdditionRemoval.H
blob6816da8c9240106a8dd35b901214af5b48c67354
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::layerAdditionRemoval
28 Description
29     Cell layer addition mesh modifier
31 SourceFiles
32     layerAdditionRemoval.C
33     addCellLayer.C
34     removeCellLayer.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef layerAdditionRemoval_H
39 #define layerAdditionRemoval_H
41 #include "polyMeshModifier.H"
42 #include "primitiveFacePatch.H"
43 #include "ZoneIDs.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                      Class layerAdditionRemoval Declaration
52 \*---------------------------------------------------------------------------*/
54 class layerAdditionRemoval
56     public polyMeshModifier
58     // Private data
60         //- Master face zone ID
61         faceZoneID faceZoneID_;
63         //- Min thickness of extrusion layer.  Triggers layer removal
64         mutable scalar minLayerThickness_;
66         //- Max thickness of extrusion layer.  Triggers layer addition
67         mutable scalar maxLayerThickness_;
69         //- Layer thickness from previous step
70         //  Used to decide whether to add or remove layers
71         mutable scalar oldLayerThickness_;
73         //- Point pairing
74         mutable labelList* pointsPairingPtr_;
76         //- Face pairing
77         mutable labelList* facesPairingPtr_;
79         //- Layer removal trigger time index
80         mutable label triggerRemoval_;
82         //- Layer addition trigger  time index
83         mutable label triggerAddition_;
86     // Private Member Functions
88         //- Disallow default bitwise copy construct
89         layerAdditionRemoval(const layerAdditionRemoval&);
91         //- Disallow default bitwise assignment
92         void operator=(const layerAdditionRemoval&);
94         //- Check validity of construction data
95         void checkDefinition();
98         // Topological changes
100             //- Check for valid layer
101             bool validCollapse() const;
103             //- Set layer pairing.  Return true if a valid layer exists
104             bool setLayerPairing() const;
106             //- Return points pairing in a layer (not automatic!)
107             const labelList& pointsPairing() const;
109             //- Return faces pairing in a layer (not automatic!)
110             const labelList& facesPairing() const;
112             //- Calculate the offset to the next layer
113             tmp<vectorField> extrusionDir() const;
115             //- Add a layer of cells
116             void addCellLayer(polyTopoChange&) const;
118             //- Remove a layer of cells
119             void removeCellLayer(polyTopoChange&) const;
121             //- Clear addressing
122             void clearAddressing() const;
124         // Helpers
126             //- Optionally read old thickness
127             static scalar readOldThickness(const dictionary&);
130     // Static data members
132         //- Thickness insertion fraction for the pre-motion
133         static const scalar addDelta_;
135         //- Thickness removal fraction for the cell collapse
136         //  Note: the cell will be collapsed to this relative
137         //  thickness before the layer is removed.
138         static const scalar removeDelta_;
140 public:
142     //- Runtime type information
143     TypeName("layerAdditionRemoval");
146     // Constructors
148         //- Construct from components
149         layerAdditionRemoval
150         (
151             const word& name,
152             const label index,
153             const polyTopoChanger& mme,
154             const word& zoneName,
155             const scalar minThickness,
156             const scalar maxThickness
157         );
159         //- Construct from dictionary
160         layerAdditionRemoval
161         (
162             const word& name,
163             const dictionary& dict,
164             const label index,
165             const polyTopoChanger& mme
166         );
169     // Destructor
171         virtual ~layerAdditionRemoval();
174     // Member Functions
176         //- Check for topology change
177         virtual bool changeTopology() const;
179         //- Insert the layer addition/removal instructions
180         //  into the topological change
181         virtual void setRefinement(polyTopoChange&) const;
183         //- Modify motion points to comply with the topological change
184         virtual void modifyMotionPoints(pointField& motionPoints) const;
186         //- Force recalculation of locally stored data on topological change
187         virtual void updateMesh(const mapPolyMesh&);
190         // Edit
192             //- Return min layer thickness which triggers removal
193             scalar minLayerThickness() const
194             {
195                 return minLayerThickness_;
196             }
198             //- Set min layer thickness which triggers removal
199            void setMinLayerThickness(const scalar t) const;
201             //- Return max layer thickness which triggers removal
202             scalar maxLayerThickness() const
203             {
204                 return maxLayerThickness_;
205             }
207             //- Set max layer thickness which triggers removal
208            void setMaxLayerThickness(const scalar t) const;
211         //- Write
212         virtual void write(Ostream&) const;
214         //- Write dictionary
215         virtual void writeDict(Ostream&) const;
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 } // End namespace Foam
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 #endif
227 // ************************************************************************* //