OpenFOAM logo
Open Source CFD Toolkit

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-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 Description
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "polyMesh.H"
00030 
00031 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00032 
00033 
00034 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00035 
00036 // Null constructor
00037 inline Foam::directionInfo::directionInfo()
00038 :
00039     index_(-3),
00040     n_(vector::zero)
00041 {}
00042 
00043 
00044 // Construct from components
00045 inline Foam::directionInfo::directionInfo
00046 (
00047     const label index,
00048     const vector& n
00049 )
00050 :
00051     index_(index),
00052     n_(n)
00053 {}
00054 
00055 
00056 // Construct as copy
00057 inline Foam::directionInfo::directionInfo(const directionInfo& w2)
00058 :
00059     index_(w2.index()),
00060     n_(w2.n())
00061 {}
00062 
00063 
00064 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00065 
00066 inline bool Foam::directionInfo::valid() const
00067 {
00068     return index_ != -3;
00069 }
00070 
00071 
00072 // No geometric data so never any problem on cyclics
00073 inline bool Foam::directionInfo::sameGeometry
00074 (
00075     const directionInfo& w2,
00076     const scalar tol
00077 )
00078  const
00079 {
00080     return true;
00081 }
00082 
00083 
00084 // index_ is already offset in face
00085 inline void Foam::directionInfo::leaveDomain
00086 (
00087     const polyPatch& patch,
00088     const label patchFaceI,
00089     const point& faceCentre
00090 )
00091 {}
00092 
00093 
00094 // index_ is offset in face on other side. So reverse it here.
00095 // (Note: f[0] on other domain is connected to f[0] in this domain,
00096 //        f[1]      ,,                         f[size-1]   ,, 
00097 // etc.)
00098 inline void Foam::directionInfo::enterDomain
00099 (
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(const tensor& rotTensor)
00116 {}
00117 
00118 
00119 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00120 
00121 inline bool Foam::directionInfo::operator==(const Foam::directionInfo& rhs)
00122  const
00123 {
00124     return  index() == rhs.index() && n() == rhs.n();
00125 }
00126 
00127 
00128 inline bool Foam::directionInfo::operator!=(const Foam::directionInfo& rhs)
00129  const
00130 {
00131     return !(*this == rhs);
00132 }
00133 
00134 
00135 // ************************************************************************* //
For further information go to www.openfoam.org