/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 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 "probes.H" #include "volFields.H" #include "dictionary.H" #include "Time.H" #include "IOmanip.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(probes, 0); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::probes::findElements(const fvMesh& mesh) { elementList_.clear(); elementList_.setSize(size()); faceList_.clear(); faceList_.setSize(size()); forAll(*this, probeI) { const vector& location = operator[](probeI); const label cellI = mesh.findCell(location); elementList_[probeI] = cellI; if (cellI != -1) { const labelList& cellFaces = mesh.cells()[cellI]; const vector& cellCentre = mesh.cellCentres()[cellI]; scalar minDistance = GREAT; label minFaceID = -1; forAll (cellFaces, i) { label faceI = cellFaces[i]; vector dist = mesh.faceCentres()[faceI] - cellCentre; if (mag(dist) < minDistance) { minDistance = mag(dist); minFaceID = faceI; } } faceList_[probeI] = minFaceID; } else { faceList_[probeI] = -1; } if (debug && (elementList_[probeI] != -1 || faceList_[probeI] != -1)) { Pout<< "probes : found point " << location << " in cell " << elementList_[probeI] << " and face " << faceList_[probeI] << endl; } } // Check if all probes have been found. forAll(elementList_, probeI) { const vector& location = operator[](probeI); label cellI = elementList_[probeI]; label faceI = faceList_[probeI]; // Check at least one processor with cell. reduce(cellI, maxOp