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

directionInfoI.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 \*---------------------------------------------------------------------------*/
00025 
00026 #include <OpenFOAM/polyMesh.H>
00027 
00028 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00029 
00030 
00031 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00032 
00033 // Null constructor
00034 inline Foam::directionInfo::directionInfo()
00035 :
00036     index_(-3),
00037     n_(vector::zero)
00038 {}
00039 
00040 
00041 // Construct from components
00042 inline Foam::directionInfo::directionInfo
00043 (
00044     const label index,
00045     const vector& n
00046 )
00047 :
00048     index_(index),
00049     n_(n)
00050 {}
00051 
00052 
00053 // Construct as copy
00054 inline Foam::directionInfo::directionInfo(const directionInfo& w2)
00055 :
00056     index_(w2.index()),
00057     n_(w2.n())
00058 {}
00059 
00060 
00061 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00062 
00063 inline bool Foam::directionInfo::valid() const
00064 {
00065     return index_ != -3;
00066 }
00067 
00068 
00069 // No geometric data so never any problem on cyclics
00070 inline bool Foam::directionInfo::sameGeometry
00071 (
00072     const polyMesh&,
00073     const directionInfo& w2,
00074     const scalar tol
00075 )
00076  const
00077 {
00078     return true;
00079 }
00080 
00081 
00082 // index_ is already offset in face
00083 inline void Foam::directionInfo::leaveDomain
00084 (
00085     const polyMesh&,
00086     const polyPatch& patch,
00087     const label patchFaceI,
00088     const point& faceCentre
00089 )
00090 {}
00091 
00092 
00093 // index_ is offset in face on other side. So reverse it here.
00094 // (Note: f[0] on other domain is connected to f[0] in this domain,
00095 //        f[1]      ,,                         f[size-1]   ,, 
00096 // etc.)
00097 inline void Foam::directionInfo::enterDomain
00098 (
00099     const polyMesh&,
00100     const polyPatch& patch,
00101     const label patchFaceI,
00102     const point& faceCentre
00103 )
00104 {
00105     if (index_ >= 0)
00106     {
00107         const face& f = patch[patchFaceI];
00108 
00109         index_ = (f.size() - index_) % f.size();
00110     }
00111 }
00112 
00113 
00114 // No geometric data.
00115 inline void Foam::directionInfo::transform
00116 (
00117     const polyMesh&,
00118     const tensor& rotTensor
00119 )
00120 {}
00121 
00122 
00123 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00124 
00125 inline bool Foam::directionInfo::operator==(const Foam::directionInfo& rhs)
00126  const
00127 {
00128     return  index() == rhs.index() && n() == rhs.n();
00129 }
00130 
00131 
00132 inline bool Foam::directionInfo::operator!=(const Foam::directionInfo& rhs)
00133  const
00134 {
00135     return !(*this == rhs);
00136 }
00137 
00138 
00139 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines