/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
#include "slidingInterface.H"
#include "polyMesh.H"
#include "primitiveMesh.H"
#include "polyTopoChange.H"
#include "polyTopoChanger.H"
#include "polyModifyFace.H"
#include "polyModifyPoint.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::slidingInterface::decoupleInterface
(
polyTopoChange& ref
) const
{
if (debug)
{
Pout<< "void slidingInterface::decoupleInterface("
<< "polyTopoChange& ref) const : "
<< "Decoupling sliding interface " << name() << endl;
}
if (!attached_)
{
if (debug)
{
Pout<< "void slidingInterface::decoupleInterface("
<< "polyTopoChange& ref) const : "
<< "Interface already decoupled." << endl;
}
return;
}
// Clear previous couple
clearCouple(ref);
const polyMesh& mesh = topoChanger().mesh();
const faceList& faces = mesh.faces();
const cellList& cells = mesh.cells();
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
// Master side
const primitiveFacePatch& masterPatch =
mesh.faceZones()[masterFaceZoneID_.index()]();
const labelList& masterPatchAddr =
mesh.faceZones()[masterFaceZoneID_.index()];
const boolList& masterPatchFlip =
mesh.faceZones()[masterFaceZoneID_.index()].flipMap();
const labelList& masterFc = masterFaceCells();
// Recover faces in master patch
forAll(masterPatchAddr, faceI)
{
// Make a copy of the face and turn it if necessary
face newFace = faces[masterPatchAddr[faceI]];
if (masterPatchFlip[faceI])
{
newFace.flip();
}
ref.setAction
(
polyModifyFace
(
newFace, // new face
masterPatchAddr[faceI], // master face index
masterFc[faceI], // owner
-1, // neighbour
false, // flux flip
masterPatchID_.index(), // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
false // zone flip. Face corrected
)
);
// Pout<< "Modifying master patch face no "
// << masterPatchAddr[faceI]
// << " face: " << faces[masterPatchAddr[faceI]]
// << " old owner: " << own[masterPatchAddr[faceI]]
// << " new owner: " << masterFc[faceI]
// << endl;
}
// Slave side
const primitiveFacePatch& slavePatch =
mesh.faceZones()[slaveFaceZoneID_.index()]();
const labelList& slavePatchAddr =
mesh.faceZones()[slaveFaceZoneID_.index()];
const boolList& slavePatchFlip =
mesh.faceZones()[slaveFaceZoneID_.index()].flipMap();
const labelList& slaveFc = slaveFaceCells();
// Grab retired point mapping
const Map