OpenFOAM logo
Open Source CFD Toolkit

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-2005 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 "scalar.H"
00059 #include "tensor.H"
00060 
00061 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00062 
00063 namespace Foam
00064 {
00065 class polyPatch;
00066 class polyMesh;
00067 class primitiveMesh;
00068 class edge;
00069 class face;
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 meshWave
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(const directionInfo&, const scalar) const;
00164 
00165             //- Convert any absolute coordinates into relative to (patch)face
00166             //  centre
00167             inline void leaveDomain
00168             (
00169                 const polyPatch& patch,
00170                 const label patchFaceI,
00171                 const point& faceCentre
00172             );
00173 
00174             //- Reverse of leaveDomain
00175             inline void enterDomain
00176             (
00177                 const polyPatch& patch,
00178                 const label patchFaceI,
00179                 const point& faceCentre
00180             );
00181 
00182             //- Apply rotation matrix to any coordinates
00183             inline void transform(const tensor& rotTensor);
00184 
00185             //- Influence of neighbouring face.
00186             bool updateCell
00187             (
00188                 const polyMesh& mesh,
00189                 const label thisCellI,
00190                 const label neighbourFaceI,
00191                 const directionInfo& neighbourInfo,
00192                 const scalar tol
00193             );
00194 
00195             //- Influence of neighbouring cell.
00196            bool updateFace
00197             (
00198                 const polyMesh& mesh,
00199                 const label thisFaceI,
00200                 const label neighbourCellI,
00201                 const directionInfo& neighbourInfo,
00202                 const scalar tol
00203             );
00204 
00205             //- Influence of different value on same face.
00206             bool updateFace
00207             (
00208                 const polyMesh& mesh,
00209                 const label thisFaceI,
00210                 const directionInfo& neighbourInfo,
00211                 const scalar tol
00212             );
00213 
00214     // Member Operators
00215 
00216         //Note: Used to determine whether to call update.
00217         inline bool operator==(const directionInfo&) const;
00218 
00219         inline bool operator!=(const directionInfo&) const;
00220 
00221 
00222     // IOstream Operators
00223 
00224         friend Ostream& operator<<(Ostream&, const directionInfo&);
00225         friend Istream& operator>>(Istream&, directionInfo&);
00226 };
00227 
00228 
00229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00230 
00231 } // End namespace Foam
00232 
00233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00234 
00235 #include "directionInfoI.H"
00236 
00237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00238 
00239 #endif
00240 
00241 // ************************************************************************* //
For further information go to www.openfoam.org