1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 inline Foam::sumData::sumData()
43 // Construct from components
44 inline Foam::sumData::sumData
57 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
59 inline bool Foam::sumData::valid() const
61 return oldFace_ != -1;
65 // No geometric data so never any problem on cyclics
66 inline bool Foam::sumData::sameGeometry
78 inline void Foam::sumData::leaveDomain
81 const polyPatch& patch,
82 const label patchFaceI,
83 const point& faceCentre
89 inline void Foam::sumData::transform
92 const tensor& rotTensor
98 inline void Foam::sumData::enterDomain
101 const polyPatch& patch,
102 const label patchFaceI,
103 const point& faceCentre
110 // Update cell with neighbouring face information
111 inline bool Foam::sumData::updateCell
114 const label thisCellI,
115 const label neighbourFaceI,
116 const sumData& neighbourInfo,
122 FatalErrorIn("sumData::updateCell") << "problem"
123 << abort(FatalError);
130 sum_ += neighbourInfo.sum();
131 count_ = neighbourInfo.count() + 1;
132 oldFace_ = neighbourFaceI;
142 // Update face with neighbouring cell information
143 inline bool Foam::sumData::updateFace
145 const polyMesh& mesh,
146 const label thisFaceI,
147 const label neighbourCellI,
148 const sumData& neighbourInfo,
152 // From cell to its faces.
154 // Check that face is opposite the previous one.
155 const cell& cFaces = mesh.cells()[neighbourCellI];
157 label wantedFaceI = cFaces.opposingFaceLabel
159 neighbourInfo.oldFace(),
163 if (thisFaceI == wantedFaceI)
167 FatalErrorIn("sumData::updateFace") << "problem"
168 << abort(FatalError);
172 sum_ += neighbourInfo.sum();
173 count_ = neighbourInfo.count();
174 oldFace_ = thisFaceI;
184 // Update face with coupled face information
185 inline bool Foam::sumData::updateFace
188 const label thisFaceI,
189 const sumData& neighbourInfo,
193 // From face to face (e.g. coupled faces)
196 sum_ += neighbourInfo.sum();
197 count_ = neighbourInfo.count();
198 oldFace_ = thisFaceI;
208 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
210 inline bool Foam::sumData::operator==(const Foam::sumData& rhs)
214 oldFace() == rhs.oldFace()
215 && sum() == rhs.sum()
216 && count() == rhs.count();
220 inline bool Foam::sumData::operator!=(const Foam::sumData& rhs)
223 return !(*this == rhs);
227 // ************************************************************************* //