OpenFOAM logo
Open Source CFD Toolkit

cellInfoI.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 "cellClassification.H"
00030 #include "polyMesh.H"
00031 
00032 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00033 
00034 // Update this with w2 information
00035 inline bool Foam::cellInfo::update
00036 (
00037     const cellInfo& w2,
00038     const label thisFaceI,
00039     const label thisCellI,
00040     const label neighbourFaceI,
00041     const label neighbourCellI
00042 )
00043 {
00044     if
00045     (
00046         (w2.type() == cellClassification::NOTSET)
00047      || (w2.type() == cellClassification::CUT)
00048     )
00049     {
00050         FatalErrorIn("cellInfo::update(const cellInfo&)")
00051             << "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
00052             << " into cell/face with type:" << type() << endl
00053             << "thisFaceI:" << thisFaceI
00054             << "  thisCellI:" << thisCellI
00055             << "  neighbourFaceI:" << neighbourFaceI
00056             << "  neighbourCellI:" << neighbourCellI
00057             << abort(FatalError);
00058         return false;
00059     }
00060 
00061     if (type() == cellClassification::NOTSET)
00062     {
00063         type_ = w2.type();
00064 
00065         return true;
00066     }
00067 
00068     if (type() == cellClassification::CUT)
00069     {
00070         // Reached boundary. Stop.
00071         return false;
00072     }
00073 
00074     if (type() == w2.type())
00075     {
00076         // Should never happen; already checked in meshWave
00077         return false;
00078     }
00079 
00080     // Two conflicting types
00081     FatalErrorIn("cellInfo::update(const cellInfo&)")
00082         << "Problem: trying to propagate conflicting types:" << w2.type()
00083         << " into cell/face with type:" << type() << endl
00084         << "thisFaceI:" << thisFaceI
00085         << "  thisCellI:" << thisCellI
00086         << "  neighbourFaceI:" << neighbourFaceI
00087         << "  neighbourCellI:" << neighbourCellI
00088         << abort(FatalError);
00089 
00090     return false;
00091 }
00092     
00093 
00094 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00095 
00096 // Null constructor
00097 inline Foam::cellInfo::cellInfo()
00098 :
00099     type_(cellClassification::NOTSET)
00100 {}
00101 
00102 
00103 // Construct from components
00104 inline Foam::cellInfo::cellInfo(const label type)
00105 :
00106     type_(type)
00107 {}
00108 
00109 
00110 // Construct as copy
00111 inline Foam::cellInfo::cellInfo(const cellInfo& w2)
00112 :
00113     type_(w2.type())
00114 {}
00115 
00116 
00117 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00118 
00119 inline bool Foam::cellInfo::valid() const
00120 {
00121     return type_ != cellClassification::NOTSET;
00122 }
00123 
00124 
00125 // No geometric data so never any problem on cyclics
00126 inline bool Foam::cellInfo::sameGeometry(const cellInfo& w2, const scalar tol)
00127  const
00128 {
00129     return true;
00130 }
00131 
00132 
00133 // No geometric data.
00134 inline void Foam::cellInfo::leaveDomain
00135 (
00136     const polyPatch& patch,
00137     const label patchFaceI,
00138     const point& faceCentre
00139 )
00140 {}
00141 
00142 
00143 // No geometric data.
00144 inline void Foam::cellInfo::transform(const tensor& rotTensor)
00145 {}
00146 
00147 
00148 // No geometric data.
00149 inline void Foam::cellInfo::enterDomain
00150 (
00151     const polyPatch& patch,
00152     const label patchFaceI,
00153     const point& faceCentre
00154 )
00155 {}
00156 
00157 
00158 // Update this with neighbour information
00159 inline bool Foam::cellInfo::updateCell
00160 (
00161     const polyMesh& mesh,
00162     const label thisCellI,
00163     const label neighbourFaceI,
00164     const cellInfo& neighbourInfo,
00165     const scalar tol
00166 )
00167 {
00168     return update
00169     (
00170         neighbourInfo,
00171         -1,
00172         thisCellI,
00173         neighbourFaceI,
00174         -1
00175     );
00176 }    
00177 
00178 
00179 // Update this with neighbour information
00180 inline bool Foam::cellInfo::updateFace
00181 (
00182     const polyMesh& mesh,
00183     const label thisFaceI,
00184     const label neighbourCellI,
00185     const cellInfo& neighbourInfo,
00186     const scalar tol
00187 )
00188 {
00189     return update
00190     (
00191         neighbourInfo,
00192         thisFaceI,
00193         -1,
00194         -1,
00195         neighbourCellI
00196     );
00197 }    
00198 
00199 // Update this with neighbour information
00200 inline bool Foam::cellInfo::updateFace
00201 (
00202     const polyMesh& mesh,
00203     const label thisFaceI,
00204     const cellInfo& neighbourInfo,
00205     const scalar tol
00206 )
00207 {
00208     return update
00209     (
00210         neighbourInfo,
00211         thisFaceI,
00212         -1,
00213         -1,
00214         -1
00215     );
00216 }    
00217 
00218 
00219 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00220 
00221 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
00222 {
00223     return type() == rhs.type();
00224 }
00225 
00226 
00227 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
00228 {
00229     return !(*this == rhs);
00230 }
00231 
00232 
00233 // ************************************************************************* //
For further information go to www.openfoam.org