initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / dynamicMesh / meshCut / directions / directionInfo / directionInfo.H
blob72bc37c28007155944cf8b51a760a492cb5ec2d8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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::directionInfo
28 Description
29     Holds direction in which to split cell (in fact a local coordinate axes).
30     Information is a label and a direction.
32     The direction is the normal
33     direction to cut in. The label's meaning depends on whether the info
34     is on a cell or on a face:
35         - in cell: edge that is being cut. (determines for hex how cut is)
36         - in face: local face point that is being cut or -1.
37             -# (-1)  : cut is tangential to plane
38             -# (>= 0): edge fp..fp+1 is cut
40             (has to be facepoint, not vertex since vertex not valid across
41              processors whereas f[0] should correspond to f[0] on other side)
43     The rule is that if the label is set (-1 or higher) it is used
44     (topological information only), otherwise the vector is used. This makes 
45     sure that we use topological information as much as possible and so a
46     hex mesh is cut purely topologically. All other shapes are cut
47     geometrically.
49 SourceFiles
50     directionInfoI.H
51     directionInfo.C
53 \*---------------------------------------------------------------------------*/
55 #ifndef directionInfo_H
56 #define directionInfo_H
58 #include "point.H"
59 #include "labelList.H"
60 #include "tensor.H"
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 namespace Foam
66 class polyPatch;
67 class polyMesh;
68 class primitiveMesh;
69 class edge;
70 class face;
71 class polyMesh;
73 /*---------------------------------------------------------------------------*\
74                            Class directionInfo Declaration
75 \*---------------------------------------------------------------------------*/
77 class directionInfo
79     // Private data
81         // Either mesh edge or face point
82         label index_;
84         // Local n axis
85         vector n_;
87         
88     // Private Member Functions
90         //- edge uses two labels
91         static bool equal(const edge& e, const label, const label);
93         //- Calculate mid point of edge.
94         static point eMid(const primitiveMesh& mesh, const label edgeI);
96         //- Find edge among edgeLabels that uses v0 and v1
97         static label findEdge
98         (
99             const primitiveMesh& mesh,
100             const labelList& edgeLabels,
101             const label v1,
102             const label v0
103         );
105         //- Return 'lowest' of a,b in face of size.
106         static label lowest
107         (
108             const label size,
109             const label a,
110             const label b
111         );
113 public:
115     // Static Functions
117         //- Given edge on hex cell find corresponding edge on face. Is either
118         //  index in face or -1 (cut tangential to face). Public since is
119         //  needed to fill in seed faces in meshWave.
120         static label edgeToFaceIndex
121         (
122             const primitiveMesh& mesh,
123             const label cellI,
124             const label faceI,
125             const label edgeI
126         );
128     // Constructors
130         //- Construct null
131         inline directionInfo();
133         //- Construct from components
134         inline directionInfo
135         (
136             const label,
137             const vector& n
138         );
140         //- Construct as copy
141         inline directionInfo(const directionInfo&);
144     // Member Functions
146         // Access
148             inline label index() const
149             {
150                 return index_;
151             }
153             inline const vector& n() const
154             {
155                 return n_;
156             }
158         // Needed by FaceCellWave
160             //- Check whether origin has been changed at all or
161             //  still contains original (invalid) value.
162             inline bool valid() const;
164             //- Check for identical geometrical data. Used for cyclics checking.
165             inline bool sameGeometry
166             (
167                 const polyMesh&,
168                 const directionInfo&,
169                 const scalar
170             ) const;
172             //- Convert any absolute coordinates into relative to (patch)face
173             //  centre
174             inline void leaveDomain
175             (
176                 const polyMesh&,
177                 const polyPatch&,
178                 const label patchFaceI,
179                 const point& faceCentre
180             );
182             //- Reverse of leaveDomain
183             inline void enterDomain
184             (
185                 const polyMesh&,
186                 const polyPatch&,
187                 const label patchFaceI,
188                 const point& faceCentre
189             );
191             //- Apply rotation matrix to any coordinates
192             inline void transform
193             (
194                 const polyMesh&,
195                 const tensor&
196             );
198             //- Influence of neighbouring face.
199             bool updateCell
200             (
201                 const polyMesh&,
202                 const label thisCellI,
203                 const label neighbourFaceI,
204                 const directionInfo& neighbourInfo,
205                 const scalar tol
206             );
208             //- Influence of neighbouring cell.
209             bool updateFace
210             (
211                 const polyMesh&,
212                 const label thisFaceI,
213                 const label neighbourCellI,
214                 const directionInfo& neighbourInfo,
215                 const scalar tol
216             );
218             //- Influence of different value on same face.
219             bool updateFace
220             (
221                 const polyMesh&,
222                 const label thisFaceI,
223                 const directionInfo& neighbourInfo,
224                 const scalar tol
225             );
227     // Member Operators
229         // Needed for List IO
230         inline bool operator==(const directionInfo&) const;
232         inline bool operator!=(const directionInfo&) const;
235     // IOstream Operators
237         friend Ostream& operator<<(Ostream&, const directionInfo&);
238         friend Istream& operator>>(Istream&, directionInfo&);
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 } // End namespace Foam
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 #include "directionInfoI.H"
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 #endif
254 // ************************************************************************* //