FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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