1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "twoStrokeEngine.H"
28 #include "slidingInterface.H"
29 #include "layerAdditionRemoval.H"
30 #include "surfaceFields.H"
31 #include "regionSplit.H"
32 #include "componentMixedTetPolyPatchVectorField.H"
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 void Foam::twoStrokeEngine::correctVerticalMotion()
40 void Foam::twoStrokeEngine::calcMovingMasks() const
44 Info<< "void movingSquaresTM::calcMovingMasks() const : "
45 << "Calculating point and cell masks"
49 if (movingPointsMaskPtr_)
51 FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
52 << "point mask already calculated"
57 movingPointsMaskPtr_ = new scalarField(allPoints().size(), 0);
58 scalarField& movingPointsMask = *movingPointsMaskPtr_;
60 const cellList& c = cells();
61 const faceList& f = allFaces();
63 const label movingCellsID = cellZones().findZoneID("movingCells");
65 // If moving cell zone is found, mark the vertices
66 if (movingCellsID > -1)
68 const labelList& cellAddr = cellZones()[movingCellsID];
70 forAll (cellAddr, cellI)
72 const cell& curCell = c[cellAddr[cellI]];
74 forAll (curCell, faceI)
76 // Mark all the points as moving
77 const face& curFace = f[curCell[faceI]];
79 forAll (curFace, pointI)
81 movingPointsMask[curFace[pointI]] = 1;
89 // Return moving points mask. Moving points marked with 1
90 const Foam::scalarField& Foam::twoStrokeEngine::movingPointsMask() const
92 if(movingPointsMaskPtr_)
94 movingPointsMaskPtr_ = NULL;
97 if (!movingPointsMaskPtr_)
102 return *movingPointsMaskPtr_;
105 void Foam::twoStrokeEngine::applyMovingMask()