OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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