/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 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 "faceSource.H" #include "fvMesh.H" #include "cyclicPolyPatch.H" #include "emptyPolyPatch.H" #include "coupledPolyPatch.H" #include "sampledSurface.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(Foam::fieldValues::faceSource, 0); namespace Foam { template<> const char* Foam::NamedEnum < Foam::fieldValues::faceSource::sourceType, 3 >::names[] = { "faceZone", "patch", "sampledSurface" }; template<> const char* Foam::NamedEnum < Foam::fieldValues::faceSource::operationType, 9 >::names[] = { "none", "sum", "average", "weightedAverage", "areaAverage", "areaIntegrate", "min", "max", "CoV" }; } const Foam::NamedEnum Foam::fieldValues::faceSource::sourceTypeNames_; const Foam::NamedEnum Foam::fieldValues::faceSource::operationTypeNames_; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::fieldValues::faceSource::setFaceZoneFaces() { label zoneId = mesh().faceZones().findZoneID(sourceName_); if (zoneId < 0) { FatalErrorIn("faceSource::faceSource::setFaceZoneFaces()") << type() << " " << name_ << ": " << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl << " Unknown face zone name: " << sourceName_ << ". Valid face zones are: " << mesh().faceZones().names() << nl << exit(FatalError); } const faceZone& fZone = mesh().faceZones()[zoneId]; faceId_.setSize(fZone.size()); facePatchId_.setSize(fZone.size()); faceSign_.setSize(fZone.size()); label count = 0; forAll(fZone, i) { label faceI = fZone[i]; label faceId = -1; label facePatchId = -1; if (mesh().isInternalFace(faceI)) { faceId = faceI; facePatchId = -1; } else { facePatchId = mesh().boundaryMesh().whichPatch(faceI); const polyPatch& pp = mesh().boundaryMesh()[facePatchId]; if (isA(pp)) { if (refCast(pp).owner()) { faceId = pp.whichFace(faceI); } else { faceId = -1; } } else if (!isA(pp)) { faceId = faceI - pp.start(); } else { faceId = -1; facePatchId = -1; } } if (faceId >= 0) { if (fZone.flipMap()[i]) { faceSign_[count] = -1; } else { faceSign_[count] = 1; } faceId_[count] = faceId; facePatchId_[count] = facePatchId; count++; } } faceId_.setSize(count); facePatchId_.setSize(count); faceSign_.setSize(count); nFaces_ = returnReduce(faceId_.size(), sumOp