1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 \*---------------------------------------------------------------------------*/
28 #include "twoStrokeEngine.H"
29 #include "slidingInterface.H"
30 #include "layerAdditionRemoval.H"
31 #include "surfaceFields.H"
32 #include "regionSplit.H"
33 #include "componentMixedTetPolyPatchVectorField.H"
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 void Foam::twoStrokeEngine::correctVerticalMotion()
41 void Foam::twoStrokeEngine::calcMovingMasks() const
45 Info<< "void movingSquaresTM::calcMovingMasks() const : "
46 << "Calculating point and cell masks"
50 if (movingPointsMaskPtr_)
52 FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
53 << "point mask already calculated"
58 movingPointsMaskPtr_ = new scalarField(allPoints().size(), 0);
59 scalarField& movingPointsMask = *movingPointsMaskPtr_;
61 const cellList& c = cells();
62 const faceList& f = allFaces();
64 const labelList& cellAddr =
65 cellZones()[cellZones().findZoneID("movingCells")];
67 forAll (cellAddr, cellI)
69 const cell& curCell = c[cellAddr[cellI]];
71 forAll (curCell, faceI)
73 // Mark all the points as moving
74 const face& curFace = f[curCell[faceI]];
76 forAll (curFace, pointI)
78 movingPointsMask[curFace[pointI]] = 1;
85 // Return moving points mask. Moving points marked with 1
86 const Foam::scalarField& Foam::twoStrokeEngine::movingPointsMask() const
88 if(movingPointsMaskPtr_)
90 movingPointsMaskPtr_ = NULL;
93 if (!movingPointsMaskPtr_)
98 return *movingPointsMaskPtr_;
101 void Foam::twoStrokeEngine::applyMovingMask()