/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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 "meshStructure.H"
#include "FaceCellWave.H"
#include "topoDistanceData.H"
#include "pointTopoDistanceData.H"
#include "PointEdgeWave.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(meshStructure, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::meshStructure::isStructuredCell
(
const polyMesh& mesh,
const label layerI,
const label cellI
) const
{
const cell& cFaces = mesh.cells()[cellI];
// Count number of side faces
label nSide = 0;
forAll(cFaces, i)
{
if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
{
nSide++;
}
}
if (nSide != cFaces.size()-2)
{
return false;
}
// Check that side faces have correct point layers
forAll(cFaces, i)
{
if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
{
const face& f = mesh.faces()[cFaces[i]];
label nLayer = 0;
label nLayerPlus1 = 0;
forAll(f, fp)
{
label pointI = f[fp];
if (pointLayer_[pointI] == layerI)
{
nLayer++;
}
else if (pointLayer_[pointI] == layerI+1)
{
nLayerPlus1++;
}
}
if (f.size() != 4 || (nLayer+nLayerPlus1 != 4))
{
return false;
}
}
}
return true;
}
void Foam::meshStructure::correct
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp
)
{
// Field on cells and faces.
List cellData(mesh.nCells());
List faceData(mesh.nFaces());
{
if (debug)
{
Info<< typeName << " : seeding "
<< returnReduce(pp.size(), sumOp