/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "attachDetach.H"
#include "polyMesh.H"
#include "primitiveMesh.H"
#include "polyTopoChange.H"
#include "polyTopoChanger.H"
#include "polyRemovePoint.H"
#include "polyRemoveFace.H"
#include "polyModifyFace.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::attachDetach::positionDifference_ = 1e-8;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::attachDetach::attachInterface
(
polyTopoChange& ref
) const
{
// Algorithm:
// 1. Create the reverse patch out of the slave faces.
// 2. Go through all the mesh points from the master and slave patch.
// If the point labels are different, insert them into the point
// renumbering list and remove them from the mesh.
// 3. Remove all faces from the slave patch
// 4. Modify all the faces from the master patch by making them internal
// between the faceCell cells for the two patches. If the master owner
// is higher than the slave owner, turn the face around
// 5. Get all the faces attached to the slave patch points.
// If they have not been removed, renumber them using the
// point renumbering list.
if (debug)
{
Pout<< "void attachDetach::attachInterface("
<< "polyTopoChange& ref) const "
<< " for object " << name() << " : "
<< "Attaching interface" << endl;
}
const polyMesh& mesh = topoChanger().mesh();
const faceList& faces = mesh.faces();
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchID_.index()];
const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchID_.index()];
const label masterPatchStart = masterPatch.start();
const label slavePatchStart = slavePatch.start();
const labelList& slaveMeshPoints = slavePatch.meshPoints();
const Map