/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2016-2017 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 "tetOverlapVolume.H" #include "tetrahedron.H" #include "tetPoints.H" #include "polyMesh.H" #include "OFstream.H" #include "treeBoundBox.H" #include "indexedOctree.H" #include "treeDataCell.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(tetOverlapVolume, 0); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::tetOverlapVolume::tetOverlapVolume() {} // * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb ( const pointField& points, const face& f, const point& fc ) { treeBoundBox bb(fc); bb.add(points, f); return bb; } // * * * * * * * * * * * Public Member Functions * * * * * * * * * * * * * // bool Foam::tetOverlapVolume::cellCellOverlapMinDecomp ( const primitiveMesh& meshA, const label cellAI, const primitiveMesh& meshB, const label cellBI, const treeBoundBox& cellBbB, const scalar threshold ) const { hasOverlapOp overlapCheckOp(threshold); cellCellOverlapMinDecomp ( meshA, cellAI, meshB, cellBI, cellBbB, overlapCheckOp ); return overlapCheckOp.ok_; } Foam::scalar Foam::tetOverlapVolume::cellCellOverlapVolumeMinDecomp ( const primitiveMesh& meshA, const label cellAI, const primitiveMesh& meshB, const label cellBI, const treeBoundBox& cellBbB ) const { sumOverlapOp overlapSumOp; cellCellOverlapMinDecomp ( meshA, cellAI, meshB, cellBI, cellBbB, overlapSumOp ); return overlapSumOp.iop_.vol_; } Foam::Tuple2 Foam::tetOverlapVolume::cellCellOverlapMomentMinDecomp ( const primitiveMesh& meshA, const label cellAI, const primitiveMesh& meshB, const label cellBI, const treeBoundBox& cellBbB ) const { sumOverlapMomentOp overlapSumOp; cellCellOverlapMinDecomp ( meshA, cellAI, meshB, cellBI, cellBbB, overlapSumOp ); return overlapSumOp.iop_.vol_; } Foam::labelList Foam::tetOverlapVolume::overlappingCells ( const polyMesh& fromMesh, const polyMesh& toMesh, const label iTo ) const { const indexedOctree& treeA = fromMesh.cellTree(); treeBoundBox bbB(toMesh.points(), toMesh.cellPoints()[iTo]); return treeA.findBox(bbB); } // ************************************************************************* //