OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

directionInfo.H

Go 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-2009 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     Foam::directionInfo
00027 
00028 Description
00029     Holds direction in which to split cell (in fact a local coordinate axes).
00030     Information is a label and a direction.
00031 
00032     The direction is the normal
00033     direction to cut in. The label's meaning depends on whether the info
00034     is on a cell or on a face:
00035         - in cell: edge that is being cut. (determines for hex how cut is)
00036         - in face: local face point that is being cut or -1.
00037             -# (-1)  : cut is tangential to plane
00038             -# (>= 0): edge fp..fp+1 is cut
00039 
00040             (has to be facepoint, not vertex since vertex not valid across
00041              processors whereas f[0] should correspond to f[0] on other side)
00042 
00043     The rule is that if the label is set (-1 or higher) it is used
00044     (topological information only), otherwise the vector is used. This makes 
00045     sure that we use topological information as much as possible and so a
00046     hex mesh is cut purely topologically. All other shapes are cut
00047     geometrically.
00048 
00049 SourceFiles
00050     directionInfoI.H
00051     directionInfo.C
00052 
00053 \*---------------------------------------------------------------------------*/
00054 
00055 #ifndef directionInfo_H
00056 #define directionInfo_H
00057 
00058 #include "point.H"
00059 #include "labelList.H"
00060 #include "tensor.H"
00061 
00062 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00063 
00064 namespace Foam
00065 {
00066 class polyPatch;
00067 class polyMesh;
00068 class primitiveMesh;
00069 class edge;
00070 class face;
00071 class polyMesh;
00072 
00073 /*---------------------------------------------------------------------------*\
00074                            Class directionInfo Declaration
00075 \*---------------------------------------------------------------------------*/
00076 
00077 class directionInfo
00078 {
00079     // Private data
00080 
00081         // Either mesh edge or face point
00082         label index_;
00083 
00084         // Local n axis
00085         vector n_;
00086 
00087         
00088     // Private Member Functions
00089 
00090         //- edge uses two labels
00091         static bool equal(const edge& e, const label, const label);
00092 
00093         //- Calculate mid point of edge.
00094         static point eMid(const primitiveMesh& mesh, const label edgeI);
00095 
00096         //- Find edge among edgeLabels that uses v0 and v1
00097         static label findEdge
00098         (
00099             const primitiveMesh& mesh,
00100             const labelList& edgeLabels,
00101             const label v1,
00102             const label v0
00103         );
00104 
00105         //- Return 'lowest' of a,b in face of size.
00106         static label lowest
00107         (
00108             const label size,
00109             const label a,
00110             const label b
00111         );
00112 
00113 public:
00114 
00115     // Static Functions
00116 
00117         //- Given edge on hex cell find corresponding edge on face. Is either
00118         //  index in face or -1 (cut tangential to face). Public since is
00119         //  needed to fill in seed faces in meshWave.
00120         static label edgeToFaceIndex
00121         (
00122             const primitiveMesh& mesh,
00123             const label cellI,
00124             const label faceI,
00125             const label edgeI
00126         );
00127 
00128     // Constructors
00129 
00130         //- Construct null
00131         inline directionInfo();
00132 
00133         //- Construct from components
00134         inline directionInfo
00135         (
00136             const label,
00137             const vector& n
00138         );
00139 
00140         //- Construct as copy
00141         inline directionInfo(const directionInfo&);
00142 
00143 
00144     // Member Functions
00145 
00146         // Access
00147 
00148             inline label index() const
00149             {
00150                 return index_;
00151             }
00152 
00153             inline const vector& n() const
00154             {
00155                 return n_;
00156             }
00157 
00158         // Needed by FaceCellWave
00159 
00160             //- Check whether origin has been changed at all or
00161             //  still contains original (invalid) value.
00162             inline bool valid() const;
00163 
00164             //- Check for identical geometrical data. Used for cyclics checking.
00165             inline bool sameGeometry
00166             (
00167                 const polyMesh&,
00168                 const directionInfo&,
00169                 const scalar
00170             ) const;
00171 
00172             //- Convert any absolute coordinates into relative to (patch)face
00173             //  centre
00174             inline void leaveDomain
00175             (
00176                 const polyMesh&,
00177                 const polyPatch&,
00178                 const label patchFaceI,
00179                 const point& faceCentre
00180             );
00181 
00182             //- Reverse of leaveDomain
00183             inline void enterDomain
00184             (
00185                 const polyMesh&,
00186                 const polyPatch&,
00187                 const label patchFaceI,
00188                 const point& faceCentre
00189             );
00190 
00191             //- Apply rotation matrix to any coordinates
00192             inline void transform
00193             (
00194                 const polyMesh&,
00195                 const tensor&
00196             );
00197 
00198             //- Influence of neighbouring face.
00199             bool updateCell
00200             (
00201                 const polyMesh&,
00202                 const label thisCellI,
00203                 const label neighbourFaceI,
00204                 const directionInfo& neighbourInfo,
00205                 const scalar tol
00206             );
00207 
00208             //- Influence of neighbouring cell.
00209             bool updateFace
00210             (
00211                 const polyMesh&,
00212                 const label thisFaceI,
00213                 const label neighbourCellI,
00214                 const directionInfo& neighbourInfo,
00215                 const scalar tol
00216             );
00217 
00218             //- Influence of different value on same face.
00219             bool updateFace
00220             (
00221                 const polyMesh&,
00222                 const label thisFaceI,
00223                 const directionInfo& neighbourInfo,
00224                 const scalar tol
00225             );
00226 
00227     // Member Operators
00228 
00229         // Needed for List IO
00230         inline bool operator==(const directionInfo&) const;
00231 
00232         inline bool operator!=(const directionInfo&) const;
00233 
00234 
00235     // IOstream Operators
00236 
00237         friend Ostream& operator<<(Ostream&, const directionInfo&);
00238         friend Istream& operator>>(Istream&, directionInfo&);
00239 };
00240 
00241 
00242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00243 
00244 } // End namespace Foam
00245 
00246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00247 
00248 #include "directionInfoI.H"
00249 
00250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00251 
00252 #endif
00253 
00254 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd