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

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