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